Hello,
I have a map with points of full above, or zoom in or out I want to receive on javascript the list of items that is visible on the map , like airbnb website
Here is a sample list refresh suite the zoom in/out and move the map:
Thanks
Have you looked at http://esri.github.io/esri-leaflet/api-reference/tasks/query.html ?
My example was in Leaflet, In ArcGIS JS, you could basically do the same thing.
Get the map extent on change and then query the feature layers. This code may help.
require([
"esri/tasks/query", "esri/layers/FeatureLayer", ...
], function(Query, FeatureLayer, ... ) {
var query = new Query();
var featureLayer = new FeatureLayer( ... );
query.geometry = feature.geometry; /////////////////////////////////////////Plug in current map extent
featureLayer.selectFeatures(query,FeatureLayer.SELECTION_NEW);
...
});
////////////////////////////////////////////////
require(["esri/map"], function(Map) {
var map = new Map( ... );
map.on("extent-change", function(){
var geo = map.geographicExtent; /////////////Plug this into the query?
console.log(geo.xmin, geo.ymin, geo.xmax, geo.ymax);
});
...
});
in order to create something similar with the example provided you have to create and run a query task every time you change extent or move map.
This query Task will have as spatial geometry condition the map extent and as attributes the user parameters (money, area e.t.c).
spatially you can minimize the query using the parameter query.geometry and setting equal to the current map extent.