I'm currently set up as follows:
A large wetlands polygon dataset is stored in an arcgis.com account as a feature service (~395,000 polygons).
I'm using the Esri-leaflet javascript library in conjunction with leaflet to dynamically load polygons into my map by querying using the map bounds and limiting by zoom level (in order to avoid exceeding the feature limit). I set a minimum zoom level of 14 this purpose.
When I use a smaller dataset that is also stored on arcgis.com (~17,000 features) it works flawlessly but when I switch the URL to the larger dataset (~395,000) features it returns an empty dataset.
Here is a snippet of the working code with the "small" dataset test:
var wwi = L.esri.featureLayer("http://services.arcgis.com/F7DSX1DSNSiWmOqh/arcgis/rest/services/WAWFA_Small_test/FeatureServer/0",{
precision: 4,
style: function(feature){
return {
color: layerColorRamp(feature.properties,'wetlands','SP'),
weight: 1.5,
opacity: 1,
fillOpacity: 0.7
}
},
simplifyFactor: 0.3,
minZoom: 14
}).addTo(map);
The large dataset uses this url: http://services.arcgis.com/F7DSX1DSNSiWmOqh/arcgis/rest/services/WAWFA_Large_test/FeatureServer/0
but should otherwise be identical. When I look at the network tab of Chrome's web tools, I see that the actual REST query looks like this:
which produces a working geojson output but when I switch the prefix to http://services.arcgis.com/F7DSX1DSNSiWmOqh/arcgis/rest/services/WAWFA_Large_test/FeatureServer/0/ for the larger dataset I get an output like this:
{"type":"FeatureCollection","crs":{"type":"name","properties":{"name":"EPSG:4326"}},"features":[]}
Any ideas on why this might be happening and whether there is a way to address this?
Matthew,
It doesn't seem there are any features in the extent you're sending to the query for the large layer:
Large:
returnGeometry=true&
where=1=1&outSr=4326&
outFields=*&
inSr=4326&geometry={"xmin":-88.11035156249999,"
ymin":43.100982876188546,"xmax":-88.08837890625,"
ymax":43.11702412135048,"
spatialReference":{"wkid":4326}}&
geometryType=esriGeometryEnvelope&
spatialRel=esriSpatialRelIntersects&
geometryPrecision=4&
maxAllowableOffset=0.00003328443215608169&
f=geojson
Small:
returnGeometry=true&
where=1=1&outSr=4326&
outFields=*&
inSr=4326&geometry={"xmin":-88.11035156249999,"
ymin":43.100982876188546,"xmax":-88.08837890625,"
ymax":43.11702412135048,"
spatialReference":{"wkid":4326}}&
geometryType=esriGeometryEnvelope&
spatialRel=esriSpatialRelIntersects&
geometryPrecision=4&
maxAllowableOffset=0.00003328443215608169&
f=geojson
That extent looks to be around Milwaukee. The small layer has features here, it seems, but the large one does not... For example, the small dataset has TARGET_FID 34921 - this is not found in the large ds when I query for it. I also tried to find where [Name] = "City of Butler-Menomonee River" - this is not found in the large ds. I further checked where [HUC12] = "040400030403" - this wasn't found, either, in the large ds.
Thank you! It turns out the original dataset was incomplete (was supposed to be a statewide coverage) and I was unaware. Thank you for your help.