1

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

http://esri.github.io/esri-leaflet/api-reference/tasks/query.html

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

var query = L.esri.Tasks.query({
            url:'http://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/services/stops/FeatureServer/0'
});

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

The feature collection is GeoJSON:

var myGeoJSON = JSON.stringify(featureCollection)
console.log(myGeoJSON)
  • Thank You, simple answer that works, I did try to parse JSON on it but that failed, so close but.... Thanks... – Bill Chappell Sep 17 '15 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.