Identify Features at([]) error?

500
1
10-14-2014 11:58 AM
BarrettBurnworth
New Contributor

I am going to say this is an error, but I am no expert. Perhaps it is user-error. Same code (from API example) only difference is the lat long. The first code does not work. The second code does. Is this an error or is this a problem on my end?

L.esri.Tasks.identifyFeatures('http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer')

            .on(map)

            .at([45.543, -122.621])

            .layers('visible:1')

            .run(function(error, featureCollection, response){

                console.log("UTC Offset: " + featureCollection.features[0].properties.ZONE);

            });

L.esri.Tasks.identifyFeatures('http://sampleserver6.arcgisonline.com/arcgis/rest/services/WorldTimeZones/MapServer')

            .on(map)

            .at(L.latLng(45.543, -122.621))

            .layers('visible:1')

            .run(function(error, featureCollection, response){

                console.log("UTC Offset: " + featureCollection.features[0].properties.ZONE);

            });

0 Kudos
1 Reply
PatrickArlt1
Esri Contributor

Barrett,

Your right that the example on the website is incorrect. However it SHOULD be corrected and work. I've made an issue to track this for the next release Methods accepting LatLng and LatLngBounds should also accept simple forms. · Issue #373 · Esri/esri-...

Generally Leaflet will let you pass a LatLng, [lat,lng] or {lat: lat, lng: lng} object. Esri Leaflet needs to do the same.

For now your workaround of wrapping the input in a L.LatLng si the right way to go.

0 Kudos