Author Topic: Mapview rte= functionality  (Read 23599 times)

0 Members and 4 Guests are viewing this topic.

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Yesterday at 10:17:44 pm
Mapview rte= functionality
« on: June 05, 2020, 04:18:43 pm »
I'm busy converting all existing Mapview functionality to use the new underlying engine developed for the scrollable Mapview that's now available.  I'm hoping it's going to knock off some things that have been on wish lists for years and maybe even introduce some new useful functionality you might not have thought about.

For things like combinations of rg= and sys= QS parameters, it's easy enough and I plan to match existing functionality.  rg= alone shows all routes in the given region(s),  sys= alone shows all routes in the given system(s), and rg= and sys= together shows all routes in the regions that are in the systems.  These are used in links from various places on the site.

The country= parameter can replace or supplement the rg= parameter, and all regions of the given country are added to the region list before processing, and we can still restrict by systems, optionally.  I intend to maintain this, even though it invites massive queries that are likely to lead to long load times and overburdened map navigation.  But if you want it, it should be there.

The rte= parameter is a little more strange.  As pointed out in some recent discussions here and/or in GitHub Issues, the rte= parameter alone gives all "related" routes that use that as the "route" field in the routes table, ignoring banner, abbrev, and city.  So if you specify rte=I-90, you not only get all of the regional segments of mainline I-90 from usai, but you all get each of the business loops and spurs in usaib.  That seems like a reasonable feature and would not be hard to continue to provide.  However, we also use it to generate some links to mapview such as rte=I-84&sys=usai, which I believe are intended to show all segments of a connected route.  However, as this parameter gives no information about which connected route if there is more than one with the same "route" field, it just shows all.  Those interested can see the discussion in https://github.com/TravelMapping/Web/issues/101 .  I propose that we either disallow the system restriction  in Mapview altogether or leave the functionality as-is, but provide true connected route capabilities in an improved version of the HB (see: https://github.com/TravelMapping/Web/issues/421 ).

I'm bringing this last issue to the forum to try to get some wider feedback on it.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: Mapview rte= functionality
« Reply #1 on: June 05, 2020, 04:54:41 pm »
I find the system restriction useful, and use it pretty frequently.
Let's leave the functionality as-is, and provide true connected route capabilities in an improved version of the HB.

Thoughts on a banner= parameter?
« Last Edit: June 05, 2020, 05:01:35 pm by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline si404

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2067
  • Last Login:Today at 07:06:38 am
Re: Mapview rte= functionality
« Reply #2 on: June 05, 2020, 05:54:37 pm »
So if you specify rte=I-90, you not only get all of the regional segments of mainline I-90 from usai, but you all get each of the business loops and spurs in usaib.  That seems like a reasonable feature and would not be hard to continue to provide.
That's useful. rte=A1 and similar isn't so much.

The I-90 business routes are related to I-90. A1 gives you 41 different actual A1 routes (some consisting of several segments and related routes themselves): Albania, Australia, Austria, Belgium, Botswana, Bulgaria, Bosnia, Croatia, Cyprus, France, Gabon, Germany, Great Britain, Greece, Isle of Man, Italy, Jamaica, Jersey, Kazakhstan, Kenya, Latvia, Lesotho, Lithuania, Luxembourg, Martinique, Morocco, Mauritius, Namibia, Netherlands, Northern Ireland, North Macedonia, Poland, Portugal, Romania, Senegal, Serbia, Slovenia, Spain, Sri Lanka, Switzerland and Tunisia. And also two that aren't: Florida's FLA1A and Massachusetts' MA1A.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: Mapview rte= functionality
« Reply #3 on: June 05, 2020, 06:34:49 pm »
And also two that aren't: Florida's FLA1A and Massachusetts' MA1A.
Is there a way to replicate the '^' functionality of a Un*x regex?
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: Mapview rte= functionality
« Reply #4 on: June 05, 2020, 10:37:20 pm »
The I-90 business routes are related to I-90. A1 gives you 41 different actual A1 routes
One way to make the "Related Routes" link from the HB immensely more useful would be to add a sys= restriction to the mapview URL, E.G.
http://travelmapping.net/user/mapview.php?rte=A1&sys=alba
http://travelmapping.net/user/mapview.php?rte=A1&sys=bela
http://travelmapping.net/user/mapview.php?rte=A1&sys=bgra
http://travelmapping.net/user/mapview.php?rte=A1&sys=cypa
http://travelmapping.net/user/mapview.php?rte=A1&sys=fraa
http://travelmapping.net/user/mapview.php?rte=A1&sys=deua
http://travelmapping.net/user/mapview.php?rte=A1&sys=gbna
http://travelmapping.net/user/mapview.php?rte=A1&sys=grca
http://travelmapping.net/user/mapview.php?rte=A1&sys=imna
http://travelmapping.net/user/mapview.php?rte=A1&sys=itaa
http://travelmapping.net/user/mapview.php?rte=A1&sys=jama
http://travelmapping.net/user/mapview.php?rte=A1&sys=ltua
http://travelmapping.net/user/mapview.php?rte=A1&sys=luxa
http://travelmapping.net/user/mapview.php?rte=A1&sys=mtqa
http://travelmapping.net/user/mapview.php?rte=A1&sys=nlda
http://travelmapping.net/user/mapview.php?rte=A1&sys=nira
http://travelmapping.net/user/mapview.php?rte=A1&sys=pola
http://travelmapping.net/user/mapview.php?rte=A1&sys=prta
http://travelmapping.net/user/mapview.php?rte=A1&sys=roua
http://travelmapping.net/user/mapview.php?rte=A1&sys=espa
http://travelmapping.net/user/mapview.php?rte=A1&sys=chea
http://travelmapping.net/user/mapview.php?rte=A1&sys=tuna

etc.
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline si404

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2067
  • Last Login:Today at 07:06:38 am
Re: Mapview rte= functionality
« Reply #5 on: June 06, 2020, 03:53:55 am »
One way to make the "Related Routes" link from the HB immensely more useful would be to add a sys= restriction to the mapview URL, E.G.
Sure, though my main problem is that FLA1A and MA1A are in.

And if you default to the system, you'd want the bannered routes as well - which makes the code more complex.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: Mapview rte= functionality
« Reply #6 on: June 06, 2020, 01:22:31 pm »
Thus we would want to search for the relevant string at the beginning of the route name, rather than anywhere within it. This is what the ^ character does in a Un*x regex.
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Yesterday at 10:17:44 pm
Re: Mapview rte= functionality
« Reply #7 on: June 06, 2020, 02:27:15 pm »
It wasn't my code in the original rte= support, but the current code achieves its results with this as part of its SQL query:

https://github.com/TravelMapping/Web/blob/028605b8e4b1dfd1ef3877bb1076eaa19d9c036b/user/mapview.php#L273-L274

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Yesterday at 10:17:44 pm
Re: Mapview rte= functionality
« Reply #8 on: June 07, 2020, 09:09:07 am »
I am not seeing any reason we need all the regex stuff here.  As I have implemented it in the new Mapview, rte= requires an exact match in the routes.route field.  And you can optionally restrict to one or more systems with sys=.

Those interested in this functionality, please give it a try, and let me know if it behaves as you expect.  Keep in mind there is nothing done at this point to restrict to only the same connected route.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: Mapview rte= functionality
« Reply #9 on: June 07, 2020, 11:28:27 am »
So if you specify rte=I-90, you not only get all of the regional segments of mainline I-90 from usai, but you all get each of the business loops and spurs in usaib.  That seems like a reasonable feature and would not be hard to continue to provide.
I am not seeing any reason we need all the regex stuff here.  As I have implemented it in the new Mapview, rte= requires an exact match in the routes.route field.  And you can optionally restrict to one or more systems with sys=.
How about letter-suffixed children, such as ME4A, NY17*, etc?

Those interested in this functionality, please give it a try, and let me know if it behaves as you expect.  Keep in mind there is nothing done at this point to restrict to only the same connected route.
http://tmtest.teresco.org/user/mapview.php?units=miles&rte=NY17 has vanilla NY17 and PA NY17SWa panned off the west edge of the map. The westernmost bits of NY17Bin are also clipped; +X101 is at or just off the W edge of the map. I still need to zoom out one level to fit all NY17 segments within the viewport. 1680x1050 display.
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Yesterday at 10:17:44 pm
Re: Mapview rte= functionality
« Reply #10 on: June 07, 2020, 12:13:19 pm »
So if you specify rte=I-90, you not only get all of the regional segments of mainline I-90 from usai, but you all get each of the business loops and spurs in usaib.  That seems like a reasonable feature and would not be hard to continue to provide.
I am not seeing any reason we need all the regex stuff here.  As I have implemented it in the new Mapview, rte= requires an exact match in the routes.route field.  And you can optionally restrict to one or more systems with sys=.
How about letter-suffixed children, such as ME4A, NY17*, etc?

I would consider them separate routes entirely unless they're bannered versions with the same route.  Adding them seems to invite potentially-unintended/unrelated inclusions.

If we want such functionality, maybe it's better with some sort of separate "rp=" (for "route pattern") where you specify whatever regex you want, and it just gets passed along.

Quote
Those interested in this functionality, please give it a try, and let me know if it behaves as you expect.  Keep in mind there is nothing done at this point to restrict to only the same connected route.
http://tmtest.teresco.org/user/mapview.php?units=miles&rte=NY17 has vanilla NY17 and PA NY17SWa panned off the west edge of the map. The westernmost bits of NY17Bin are also clipped; +X101 is at or just off the W edge of the map. I still need to zoom out one level to fit all NY17 segments within the viewport. 1680x1050 display.

That seems to happen in various situations, and I'm stumped.  Try rg=CT,RI and western CT might be off the screen for you, as it is for me.  I must not be including something in the bounding box computation to send to the map's fitBounds method, but I can't find it.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: Mapview rte= functionality
« Reply #11 on: June 07, 2020, 08:04:07 pm »
I would consider them separate routes entirely unless they're bannered versions with the same route.
My first thought was that of the Related Routes feature shows child routes in the form of bannered routes, then similarly including letter-suffixed routes for systems that don't or rarely use banners (e.g. usanh) would be a good thing.

Adding them seems to invite potentially-unintended/unrelated inclusions.
A little exploring...
Code: [Select]
cat `ls | grep -v '_con\.csv$'` | cut -f3 -d';' | sort | uniq > ~/uniqrtes.txt
for rte in `cat ~/uniqrtes.txt`; do egrep "^$rte[A-Za-z]+$" ~/uniqrtes.txt | sed "s~^~$rte;~"; done | tee ~/letter_suffixes.csv
grep -v '[0-9]' ~/letter_suffixes.csv | less
...forces me to concede this point.
For instance, there are a few cases of routes using Roman numerals, and then a big chunk of the idnjt system.

If it's important to have similar behavior, maybe require that banners match?

If we want such functionality, maybe it's better with some sort of separate "rp=" (for "route pattern") where you specify whatever regex you want, and it just gets passed along.
I'll stop short of saying I want this.

Try rg=CT,RI and western CT might be off the screen for you, as it is for me.
Yep. I'm getting the same thing.
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Yesterday at 10:17:44 pm
Re: Mapview rte= functionality
« Reply #12 on: June 07, 2020, 10:40:50 pm »
That seems to happen in various situations, and I'm stumped.  Try rg=CT,RI and western CT might be off the screen for you, as it is for me.  I must not be including something in the bounding box computation to send to the map's fitBounds method, but I can't find it.

Found my dumb copy-and-paste-but-only-partially-modify error.  Looks like the bounds are now set properly.

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4849
  • Last Login:Yesterday at 11:21:09 am
Re: Mapview rte= functionality
« Reply #13 on: June 26, 2020, 02:05:26 pm »
Is anything open or can the topic be marked solved?

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Yesterday at 10:17:44 pm
Re: Mapview rte= functionality
« Reply #14 on: June 26, 2020, 03:01:56 pm »
I think existing Issues related probably cover it.