Greetings!
JSAPI 4.7
The user workflow is to have a user draw a polygon over some linear features. At "draw-complete" the polygon is coerced to a polyline and I want to find the line features that intersect the drawn polyline.
However the query informs me:
{"error":{"code":400,"message":"Unable to complete operation.","details":["Unable to perform query operation."]}}
The code appears simple enough:
action.on("draw-complete", function(evt){
// create a polyline from the drawn polygon evt.verticies
let selectionPolyline = new Polyline(evt.vertices);
// get the gas line layer from the layers in the map using the title
let gasLineLayer = mapView.map.allLayers.find(function(layer) {
return layer.title === GAS_LINE_LAYER_TITLE;
});
let query = new Query({
geometry: selectionPolyline,
spatialRelationship: "intersects"
});
gasLineLayer.queryFeatures(query).then(function(evt){
alert("SUCCESS");
})
});
If I do a simple query with just a where:'1=1', all features are selected, so it must be something in the query definition about the spatialRelationship. Are spatial references this issue perhaps?
Help please. TIA!
Solved! Go to Solution.
Dirk,
The draw-complete event returns a Geometry so I am not sure where you saw in the documentation that a geometry has a vertices property. A Polygon geometry has Rings property:
https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html#rings
Dirk,
The draw-complete event returns a Geometry so I am not sure where you saw in the documentation that a geometry has a vertices property. A Polygon geometry has Rings property:
https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html#rings