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);
When no order by fields are provided, the data will be returned in the same order it is grabbed from the table (which almost always means it is ordered by the object id).
If you want to do a join, you can use the union method from the geometry engine. That will turn them all into one feature, so they will be interconnected.
If you want to order the geometries but keep them separate, that's a bit more complicated. Ordering features based on geometry is very complicated. Assuming you're working with lines (since you mentioned roads), roads can curve back or circle around. If there are any additional features picked up from intersections, it can throw things for a loop as well.
Hi @CourtneyMenikheim, thank you for your insight on this! In my situation, I need the features ordered by their geometry. I've found a convoluted workaround, but if I could just get all features on the route in order, it would be super! I think I've seen that OBJECTID appears to be the default sort; and of course, this is not always in the order of the geometry.