Select to view content in your preferred language

Re-ordering stops

09-22-2022 08:31 AM
New Contributor III

I have a route (line) and its stops organized by a field called order. I want to create a new stop and reorder the route. Do you have any idea how to solve this. I am trying to use queryPointAndDistance but I can't find this function in the geometryengine, I am using nearestVertex and nearestCoordinate but it always returns isRightSide false (because all stops must be on the right of the route direction).

I am waiting for your valuable help. @AndyGup @RobertScheitlin__GISP 


Screen Shot 2022-09-22 at 10.28.08 AM.png

0 Kudos
1 Reply
Occasional Contributor III

You don't really say what the 'stops' are for, but when I hear that I think of bus stops as I work for a transit agency. I have built an app to allow our member agencies to edit bus stops, including adding new ones. We are in the process of determining if we can get to where this can also be an editing of the bus stop sequencing, as that becomes complicated with other factors, namely:

  1. What route is this bus stop associated with
  2. Are there multiple routes associated with this bus stop
  3. Are all of the bus stops associated with this route viable (active, not test/temporary, etc)

And the final difficulty is making sure the stops follow a logical, networked path as just determining if it was the next stop based on distance does not always work due to complexities in the route or obstacles such as 1 way streets/ramps, water ways, etc.

I have often thought this would be best as a Python script, or maybe SQL Server stored procedure to run through all of the stops and determine  how best to sequence them. Something that could be run on a nightly  basis or maybe on demand. Having them as part of a Javascript app could be interesting though.

Not sure how your data is structured, but ours has related route information (and amenities) because each bus stop can have multiple routes, and they change often whereas the bus stops not so much. If I designed something to work for the Javascript side it would have to incorporate this relation to get started, as you really need to pull out just the stop points for 1 route at a time. If you are looking at stops for something else you maybe be able to just all of the points available as one route. That would definitely uncomplicate things.