Geographic Information Systems Asked on December 9, 2020
Using the ArcGIS Server JavaScript API, it’s possible to specify an attribute query in the form of a layerDefinition against a Dynamic layer.
For example, the following query will restrict the layer to show only features where the population is greater than 5,000,000:
var layerDefinitions = [];
layerDefinitions[0] = "POPULATION > 5000000";
dynamicMapServiceLayer.setLayerDefinitions(layerDefinitions);
Is it possible to specify a bounding box in the layer definition?
That is, apply a spatial query in addition to any attribute query. The query should be based directly on the layer’s geometry field (not an attribute derived from the geometry). Assume the data is stored in WGS84 and is "geometryType": "esriGeometryPoint"
.
If that Geometry Point is stored, then, it must have an OBJECTID.
You can just select it with a query like : OBJECTID = 1
Edit:
You could do a spatial intersect, using a polygon drawn with the coordinates you want as described here https://developers.arcgis.com/javascript/3/jsapi/polygon-amd.html#polygon3 and pass it to the query
var polygon = new Polygon([[50, 0], [150, 20], [150, -20], [50,0]]);
query.geometry = polygon;
query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
there are other spatial operations, maybe you'd prefer SPATIAL_REL_WITHIN https://developers.arcgis.com/javascript/3/jsapi/query-amd.html#constants
Answered by LMokrane on December 9, 2020
Unfortunately, layerdefinitions do not support geometry operations. Some workarounds are:
objectid in (1,2,...n)
Answered by Berend on December 9, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP