I have few questions about TimeExtent property of MapView.
I have a little testing sample (solution is enclosed) with esri map services. The layer in question is this one:
https://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer/1
The layer has Start Time Field and End Time Field.
When I set TimeExtent on MapView like this:
DateTime date = new DateTime(2005, 9, 1);
DateTime endDate = new DateTime(2005, 9, 30);
TimeExtent tExtent = new TimeExtent(date, endDate);
this._mapView.TimeExtent = tExtent;
I can see features that have start time date and end time date between specified interval. If I click on map and call MapView.IdentifyLayerAsync on ArcGISMapImageLayer I get response and result line features are highlighted. So far, this is working as expected.
The issue arrise when I set TimeExtent on Map like this:
DateTime now = new DateTime(2005, 9, 17);
TimeExtent extent = new TimeExtent(now);
this._mapView.TimeExtent = extent;
With this time extent I can see only one feature. When I click on that feature and call IdentifyLayerAsync I get no results in code, the IdentifyLayerResult is empty, however I can see the request in Fiddler and it has response with one feature. So the response from web request is correct, but identify result in runtime .net api is empty. So my questions are:
1. Why there is no feature in IdentifyLayerResult when web response is clearly ok?
2. Why there is only one feature? I would expect to see every feature that has start date < time extent and end date > time extent. Is this correct expectation, or am I missing something?
If anyone could shed some light on this I would be very grateful, I am struggling with that time extent for eons and I am either missing something or there is something wrong with runtime api.
I can repro the issue you reported with Hurricane mapservice on sampleserver6. But I am failing to repro the with another time-aware dataset using same repro app.
Can you by chance try to test using a different dataset. In the meantime I will try to figure out what's wrong with Hurricanes MapService. Seems like a data related issue.
Thank you very much for the response.
I have exactly same issue with our (unfortunately not public available) time-aware service. I was searching for equivalent public service to report the issue. The Hurricanes was the only one I found, that have both start time field and end time field enabled. Other services I found used only start time field and that is, I guess, another story.
Can you please point me to some public available service with both start time field and end time field enabled, so I can give it a try?
I created another dataset with two fields. With this dataset I created a FeatureService and update the code a little bit.
- changed instance type of ArcGISMapImageLayer to FeatureLayer.
- updated following lines of code
```
//!!!!!!!this is not working!!!!!!!!!!
DateTime onedate = new DateTime(2018, 1,1, 16, 0, 0); Only pass one date i.e Jan 1st 2018, 4 PM as the date
TimeExtent extent = new TimeExtent(onedate);
this._mapView.TimeExtent = extent;
await this.Lyr.LoadAsync();
this._map.OperationalLayers.Add(this.Lyr);
await _mapView.SetViewpointAsync(new Viewpoint(this.Lyr.FullExtent));
//****AND in geoView_Tapped added logic to render point graphics****
if (feature.Geometry.GeometryType == GeometryType.Point)
{
Graphic gr = new Graphic(feature.Geometry as MapPoint, this._pointSymbol);
_gLyr.Graphics.Add(gr);
}
```
Note that when data has two fields passing one date means StartTime and EndTime must be same . For e.g for the dataset attached, if I want to query for Jan 1st that both start field or end field should have same date value.
I am sorry, I am little late to reply on this. I had other things to do and forget a little about this.
Nevertheless, switch from ArcGISMapImageLayer to FeatureLayer has no use for me, since I need it to be ArcGISMapImageLayer.
I have also came to strange conclusion, that if I set time extent like this:
DateTime date = new DateTime(2005, 9, 1);
DateTime endDate = new DateTime(2005, 9, 30);
TimeExtent tExtent = new TimeExtent(date, endDate);
then visible features are features, that have startDate < tExtned.StatTime and endDate > tExtent.EndTime. And that is not what I want.
I want to set extent and have all visible features that have startDate > tExtend.StartTime and endDate < tExtent.EndTime. So quite different than how it seems to work. I couldn't figure out how to get it to work this way, and it is quite strange to me, becase in arcgis javascript api or in argcis deskto time slider it works exactly this way.