I'm using ArcGIS for JavaScript 3.36. I have the geometry for a route from the Directions widget. Using the geometry, I query the FeatureLayer that contains the route linework to get the features that are contained in the geometry. This works.
However, when the results come back from the query, the features are not in order from one end of the geometry to the other. What determines the order that the features come back in when no order by fields are provided? How can I ensure the features come back in order? If that isn't possible, is there a function in the ArcGIS API for JavaScript to join the features in the order based on their geometry?
Thanks to anyone out there that has any input on this.
This is my query:
const query = new Query();
query.returnGeometry = true;
query.outSpatialReference = new SpatialReference(102100);
query.geometry = geometry;
query.spatialRelationship = Query.SPATIAL_REL_CONTAINS;
query.outFields = ["*"];
query.distance = 3;
query.units = "feet";
const prom = layers.routesFeatureLayer.queryFeatures(query);