Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify and Time Aware Layers #489

Closed
paulanergraz opened this issue Dec 2, 2015 · 13 comments
Closed

Identify and Time Aware Layers #489

paulanergraz opened this issue Dec 2, 2015 · 13 comments
Assignees
Milestone

Comments

@paulanergraz
Copy link

I have a Problem with Identify and Time aware Layers.

I use the advanced TimeSlider Widget and It is working fine for the display of the data in the map windows.
But my Problem is that the identify widget shows all the polygons without using the time.

The link to the website
http://46.163.106.182/cmv-app-master/viewer/

If you choose a time and select a layer (good example Capas / Territorios/ Provincias / Provincisa territorios identify brings the result of all polygons (even if you don't see them).

The Screenshot below shows my problem:
2015-12-02

I know that it's possible to only show the right data (for example the ESRI WebAppBuilder can do it or other templates) but my javascript is not good enough for this.

Thanks Paul

@kcarrier
Copy link

kcarrier commented Dec 2, 2015

I also had this same issue with the time slider, the UI for the widget was exactly what I needed but when I identify or query the layer it would return all attributes and not just the time selected. If this ever gets worked out it would be awesome and allow much more flexibility then the out of the box widget provided with WAB.

@Wernazuma
Copy link

I reckon it should be a rather simple thing, but I'm a javascript ignorant too

Esri js API among identifyParams has the parameter TimeExtent: https://developers.arcgis.com/javascript/jsapi/identifyparameters-amd.html

So (in identify.js) I simply tried to append
createIdentifyParams: function (point) { } by adding the line
identifyParams.TimeExtent = this.map.TimeExtent; before the return value .

There is no effect, however, maybe because "this.map.TimeExtent" just is not set or can't be called? I tried to simply include [esri/]TimeExtent into define and function, but failed (it broke the js).

The answer is out there, and probably doesn't need much code.

@tmcgee
Copy link
Member

tmcgee commented Apr 24, 2016

@Wernazuma Perhaps you have a typo? The timeExtent property should start with a lowercase t. You used a capital T in your comment above.

@Wernazuma
Copy link

@tmcgee

Thanks, that was one of the problems. Now, the identify works when loading the page! Great step forward.
However, once I change the time extent via the time slider, Identify breaks and refuses to identify anything.

The link to the app is the same as in the initial post by paulanergraz.

@tmcgee
Copy link
Member

tmcgee commented Apr 24, 2016

@Wernazuma Instead of setting the identifyParam's timeExtent property equal to the map's timeExtent property, you are probably better off getting the property from the layer's timeInfo property. Be sure to check that timeInfo is not null since it would cause an error. Additionally there is no point in passing along a timeExtent for a layer that is not time-enabled. Perhaps you can do something like this just below line 175 (untested):

if (layer.ref.timeInfo && layer.ref.timeInfo.timeExtent) {
    identifyParams.timeExtent = layer.ref.timeInfo.timeExtent;
}

(You might need to create a new TimeExtent instead of just using the one associated with the timeInfo. I don't think so but consider that if the above does not work).

@Wernazuma
Copy link

@tmcgee

My parragraph around line 175 reads like this:
array.forEach(this.layers, lang.hitch(this, function (layer) { var layerIds = this.getLayerIds(layer, selectedLayer); if (layerIds.length > 0) { var params = lang.clone(identifyParams); params.layerDefinitions = layer.ref.layerDefinitions; 175 params.layerIds = layerIds; identifies.push(layer.identifyTask.execute(params)); identifiedlayers.push(layer);

Also, from how I understand the timeInfo property, it does not help me, since almost all layers have valid data 1701-1808. Or is there something I miss?

Consider, in the app, the following layer visible:
Poblaciones --> Lugares poblados --> Ciudades

If you click Monterrey, in Mexico, one entry is valid 1701 through 1778, and another entry is 1779-1808. The plan is that Identify only shows that entry which is in accordance with the set time on the slider.

@tmcgee
Copy link
Member

tmcgee commented Apr 24, 2016

@Wernazuma Sorry I do not use time-aware layers so I hope my suggestions do not take you too far into a black hole. ;)

Line 175 is the correct location but my code should have used params instead of identifyParams

if (layer.ref.timeInfo && layer.ref.timeInfo.timeExtent) {
    params.timeExtent = layer.ref.timeInfo.timeExtent;
}

I see what you are saying about the layers timeInfo.timeExtent. I thought the values might change based on the time slider. To use the map's timeExtent, I suspect you will need to create a new TimeExtent like this:

if (layer.ref.timeInfo && layer.ref.timeInfo.timeExtent) {
    params.timeExtent = new TimeExtent(this.map.timeExtent.startTime, this.map.timeExtent.endTime);
}

To do that, you'll need to add esri/TimeExtent in the declare statement and TimeExtent as an argument in function at the top of the file.

I would still include the code as written above at line 175 so the timeExtent is only added to time-aware layers.

Let me know how it goes.

@Wernazuma
Copy link

@tmcgee : I included esri/TimeExtent and added TimeExtent in function as you said, also setting your
if (layer.ref.timeInfo && layer.ref.timeInfo.timeExtent) { params.timeExtent = new TimeExtent(this.map.timeExtent.startTime, this.map.timeExtent.endTime); }.

As before, it seems to work fine when loading the app but it doesn't survive any change in the time slider.
Maybe @vojvod has some idea?

@tmcgee
Copy link
Member

tmcgee commented Apr 24, 2016

@Wernazuma

You need to remove this at line 230:

identifyParams.timeExtent = this.map.timeExtent;

It was what you added originally and and is still causing the problem you see now.

@tmcgee
Copy link
Member

tmcgee commented Apr 24, 2016

When debugging your code and ignoring line 230, it appears to work as I would expect

@Wernazuma
Copy link

@tmcgee

Thank you very much, now it works the way I want it to work. I still need to check with some polygon layers, but I think that our problem is solved. That has been a crucial issue for us!

Cheers!

@paulanergraz
Copy link
Author

@tmcgee Thank you for your help

@tmcgee tmcgee added this to the v1.4.0 milestone Apr 25, 2016
@tmcgee tmcgee self-assigned this Apr 25, 2016
@tmcgee
Copy link
Member

tmcgee commented Apr 25, 2016

@Wernazuma @paulanergraz Excellent! I am glad we collectively got it working. I will add this new enhancement to the Identify widget for the next release of cmv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants