I've followed the Esri Leaflet sample code found here:


//Querying features near a latlng
var latlng = L.latLng(45.51, -122.70);

var query = L.esri.Tasks.query({

query.nearby(latlng, 500);

query.run(function(error, featureCollection, response){
console.log('Found ' + featureCollection.features.length + ' features');

So now that I have the features any Idea of how to export them out as JSON or GeoJSON? I need them as input for another app. So far the only thing I found you could do is count them.

1 Answer 1


The feature collection is GeoJSON:

var myGeoJSON = JSON.stringify(featureCollection)
  • Thank You, simple answer that works, I did try to parse JSON on it but that failed, so close but.... Thanks... Sep 17, 2015 at 1:20

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.