Entonces, la API tiene una opción where y un método setWhere junto con otros métodos de filtro de tiempo.<\/P>
L.esri.Layers.FeatureLayer | Esri Leaflet<\/A><\/P> ¿Hay alguna manera de establecer también la geometría? Ahora mismo usa los límites del mapa para limitar las consultas, pero ¿puedo anular eso fácilmente en algún lugar?<\/P>Actualmente puedo hacer algunos trucos usando Turf para hacer búsquedas punto-en-polígono, pero no funciona si necesito verificar puntos fuera de los límites del mapa que aún no se han consultado.<\/P>Turfjs\/turf-inside GitHub<\/A><\/P> <\/P>Estoy pensando que podría simplemente consultar los datos por mi cuenta, convertirlos a GeoJSON y usar Turf + filtrado por propiedades para buscar en mis resultados, pero esperaba que ya hubiera un flujo de trabajo en Esri-Leaflet para hacer esto. ¿Alguna idea?<\/P> <\/P>Gracias.<\/P>
¿Hay alguna manera de establecer también la geometría? Ahora mismo usa los límites del mapa para limitar las consultas, pero ¿puedo anular eso fácilmente en algún lugar?<\/P>
Actualmente puedo hacer algunos trucos usando Turf para hacer búsquedas punto-en-polígono, pero no funciona si necesito verificar puntos fuera de los límites del mapa que aún no se han consultado.<\/P>
<\/P>
Estoy pensando que podría simplemente consultar los datos por mi cuenta, convertirlos a GeoJSON y usar Turf + filtrado por propiedades para buscar en mis resultados, pero esperaba que ya hubiera un flujo de trabajo en Esri-Leaflet para hacer esto. ¿Alguna idea?<\/P>
Gracias.<\/P>
Also forgot you could also use L.esri.get to query the endpoint directly and let the server do the spatial query for you.
L.esri.get(featureLayerQueryUrl, { spatialRel: "esriSpatialRelIntersects", geometryType: "esriGeometryPoint", geometry: L.esri.Utils.geojsonToArcGIS(geojsonPoint) }, function(error, response){ var geojson = L.esri.Utils.responseToFeatureCollection(response); });
This is dropping down pretty low into the request and utilities methods. But you will save yourself from using Turf and they are all documented in the API ref API Reference | Esri Leaflet
Thanks Patrick!
I think this will work, because ultimately what I end up doing is an attribute and spatial query of the data.
I keep forgetting about L.esri.get, ha.
I get where you are coming from Rene.
You were probably hoping for something like this
L.esri.featureLayer(featureLayer, { spatialMethod: 'intersects', geometry: latlng }).addTo(map);
Implementing this would be VERY difficult since the assumption that features are only loaded inside the current viewport is baked into Esri Leaflet all the way down to the core.
That said this did remind me of a feature I wanted to add Add additional spatial query types to L.esri.Tasks.Query · Issue #374 · Esri/esri-leaflet · GitHub.
Once this is implemented you could do something like the following to render all polygons that intersect a point.
L.esri.Tasks.query(featureLayer).intersects(latlng).run(function(error, geojson){ // use L.GeoJSON to add features to map });
For right now you can just use the raw L.esri.Tasks.query to query as many features as possible and use Turf on the client side for your point in polygon.
// queries all features up to the transfer limit (usually 1000-2000) L.esri.Tasks.query(featureLayer).run(function(error, geojson){ // now use Turf over all the geojson });
If you are doing it yourself, try the REST API - it will return JSON and allows you to select a geometry and a geometry type. Your URL should be
http://YourArcServerDomainName/ArcGIS/rest/services/yourFeatureName/FeatureServer/0/query
Hit that with a formatted AJAX request and get back the JSON rep of the results
Looks like the ESRI-Leaflet plugin only runs where on the whole data set. My money is on it just hitting your rest endpoint anyway so do it yourself.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.