I'm using the ArcGIS JavaScript API to create a map. I need to select/highlight polygons on my feature layers around my geolocation. I use in-build "LocateButton" function for geolocation. I looked through all examples on Esri developer webpage and none of them are useful.

Do you have any idea how it can be done?

  • You might be able to create a point object using the location and pass that back as a query (or buffer) to select the features. Are you representing the location on the map? – Branco Jun 3 '15 at 14:45
  1. use the locate event emitted by the widget as your opportunity to get a reference to the geolocated coordinates.

    geoLocate = new LocateButton({
      map: map
    }, "LocateButton");

    geoLocate.on('locate', function(evt) {
  1. pass this geometry in a spatial query to your feature service of interest.

you can find an example of an app which fires a spatial query here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.