I have a function that queries features that appear within a buffer around a given point on a feature layer.
function queryLayer(layer, buffer, point){
var query = layer.createQuery();
query.geometry = buffer;
query.spatialRelationship = "intersects";
layer.queryFeatures(query).then(function(results){
console.log(results.features);
});
}
I know that
query.orderByFields = "..."
exists but I'm not sure how to go about using it. Is there a good way I can use the point variable to say "order by closest to this point"?