I am trying to convert the selected regions in the following URL (marked in red) into geojson and retrieve administrative info (State, Country etc.)
https://esri.github.io/esri-leaflet/examples/spatial-queries.html
This is an example code that I found online.
var feature = L.esri.Util.arcgisToGeoJSON(neighborhoods[i], ids[i]);
var latlng = L.Projection.Mercator.unproject(L.point(feature.geometry.coordinates));
feature.geometry.coordinates = [latlng.lng, latlng.lat];
Please Help!
the short answer is that you don't need to convert clientside esri leaflet features to GeoJSON because they already are GeoJSON.
the only complication in the sample that you referenced is that the query to select an individual feature chains the
ids()
method, so only an identifier is requested for features that match search criteria (rather than raw GeoJSON features) because they've already been requested an drawn once.