Author Topic: Clinched Routes Highway Shields  (Read 151798 times)

0 Members and 4 Guests are viewing this topic.

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Today at 07:41:39 am
Re: Clinched Routes Highway Shields
« Reply #45 on: January 12, 2017, 04:08:24 pm »
There is a cache on the site, which I manually clear out each time updated code or svg files come in.  I'll do that again now just to be safe.  It would be nice to add some code that automatically regenerates shields if the PHP code or any svg template has been changed.

Offline Thing342

  • Computer Guy
  • TM Collaborator
  • Newbie
  • *****
  • Posts: 13
  • Gender: Male
  • Last Login:June 08, 2017, 10:58:40 pm
  • V.T.C.S.
    • Personal Page
Re: Clinched Routes Highway Shields
« Reply #46 on: January 12, 2017, 05:54:15 pm »
As the original author of the shield generator, allow me to provide some clarity:

There is a cache on the site, which I manually clear out each time updated code or svg files come in.  I'll do that again now just to be safe.  It would be nice to add some code that automatically regenerates shields if the PHP code or any svg template has been changed.
The php function used to generate the shield has a force_reload parameter, which regenerates the cached version if set to true. It's used in low-volume applications (i.e. the Highway Browser, where you only need to display one shield)

--

The "easy" (code-wise) way to accomplish systems with alternate / multiple shieldstyles would be to simply create separate systems for the portions using the alternate shields (ie FL Toll routes, TN secondary routes). However, that (and just straight checking against a list of route numbers) would take a large amount of work. My proposed solution for this would involve adding a tags field (allowing OSM-like tags) to each system .csv file and storing it as a new column in the "routes" table in the database. Take usafl.csv, for example:
Code: [Select]
system;region;route;banner;city;abbrev;root;tags;
(tags separated by commas)
...
usafl;FL;FL397;;;;fl.fl397;;
usafl;FL;FL400;;;;fl.fl400;;
usafl;FL;FL401;;;;fl.fl401;;
usafl;FL;FL404;;;;fl.fl404;;
usafl;FL;FL405;;;;fl.fl405;;
usafl;FL;FL406;;;;fl.fl406;;
usafl;FL;FL407;;;;fl.fl407;;
usafl;FL;FL408;;;;fl.fl408;toll=yes;
usafl;FL;FL408;Spr;;;fl.fl408spr;
usafl;FL;FL414;;;;fl.fl414;toll=yes;
usafl;FL;FL415;;;;fl.fl415;;
usafl;FL;FL416;;;;fl.fl416;;
usafl;FL;FL417;;;;fl.fl417;toll=yes;
usafl;FL;FL419;;;;fl.fl419;;
usafl;FL;FL421;;;;fl.fl421;;
usafl;FL;FL423;;;;fl.fl423;;
usafl;FL;FL424;;;;fl.fl424;;
usafl;FL;FL426;;;;fl.fl426;;
usafl;FL;FL429;;;;fl.fl429;toll=yes;
usafl;FL;FL430;;;;fl.fl430;;
usafl;FL;FL434;;;;fl.fl434;;
usafl;FL;FL435;;;;fl.fl435;;
usafl;FL;FL436;;;;fl.fl436;;
usafl;FL;FL437;;;;fl.fl437;;
...
The shield generator would then be able to give the routes marked with "toll=yes" the toll shield. This seems like the most straightforward way and would minimize the amount of duplication needed.

--

The most foolproof method I've found for making shields is:
1. Download shield SVG from Wikimedia commons;
2. Edit shield in inkscape to turn into a template, with ***NUMBER*** in place of the route number;
3. Save as "Optimized SVG" with the name "template_{system name}(_wide, _wide4).svg";
4. Copy to /Web/shields;
5. Wash, rinse, repeat.
« Last Edit: January 12, 2017, 06:35:55 pm by Thing342 »

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: Clinched Routes Highway Shields
« Reply #47 on: January 12, 2017, 06:06:21 pm »
Quote
Can anyone reproduce the same behavior?
It's looking fine on my end. :-\
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline rschen7754

  • Jr. Member
  • **
  • Posts: 51
  • Gender: Male
  • Last Login:Yesterday at 08:06:13 pm
    • Rschen7754
Re: Clinched Routes Highway Shields
« Reply #48 on: January 12, 2017, 08:24:57 pm »
As the original author of the shield generator, allow me to provide some clarity:

There is a cache on the site, which I manually clear out each time updated code or svg files come in.  I'll do that again now just to be safe.  It would be nice to add some code that automatically regenerates shields if the PHP code or any svg template has been changed.
The php function used to generate the shield has a force_reload parameter, which regenerates the cached version if set to true. It's used in low-volume applications (i.e. the Highway Browser, where you only need to display one shield)

--

The "easy" (code-wise) way to accomplish systems with alternate / multiple shieldstyles would be to simply create separate systems for the portions using the alternate shields (ie FL Toll routes, TN secondary routes). However, that (and just straight checking against a list of route numbers) would take a large amount of work. My proposed solution for this would involve adding a tags field (allowing OSM-like tags) to each system .csv file and storing it as a new column in the "routes" table in the database. Take usafl.csv, for example:
Code: [Select]
system;region;route;banner;city;abbrev;root;tags;
(tags separated by commas)
...
usafl;FL;FL397;;;;fl.fl397;;
usafl;FL;FL400;;;;fl.fl400;;
usafl;FL;FL401;;;;fl.fl401;;
usafl;FL;FL404;;;;fl.fl404;;
usafl;FL;FL405;;;;fl.fl405;;
usafl;FL;FL406;;;;fl.fl406;;
usafl;FL;FL407;;;;fl.fl407;;
usafl;FL;FL408;;;;fl.fl408;toll=yes;
usafl;FL;FL408;Spr;;;fl.fl408spr;
usafl;FL;FL414;;;;fl.fl414;toll=yes;
usafl;FL;FL415;;;;fl.fl415;;
usafl;FL;FL416;;;;fl.fl416;;
usafl;FL;FL417;;;;fl.fl417;toll=yes;
usafl;FL;FL419;;;;fl.fl419;;
usafl;FL;FL421;;;;fl.fl421;;
usafl;FL;FL423;;;;fl.fl423;;
usafl;FL;FL424;;;;fl.fl424;;
usafl;FL;FL426;;;;fl.fl426;;
usafl;FL;FL429;;;;fl.fl429;toll=yes;
usafl;FL;FL430;;;;fl.fl430;;
usafl;FL;FL434;;;;fl.fl434;;
usafl;FL;FL435;;;;fl.fl435;;
usafl;FL;FL436;;;;fl.fl436;;
usafl;FL;FL437;;;;fl.fl437;;
...
The shield generator would then be able to give the routes marked with "toll=yes" the toll shield. This seems like the most straightforward way and would minimize the amount of duplication needed.

--

The most foolproof method I've found for making shields is:
1. Download shield SVG from Wikimedia commons;
2. Edit shield in inkscape to turn into a template, with ***NUMBER*** in place of the route number;
3. Save as "Optimized SVG" with the name "template_{system name}(_wide, _wide4).svg";
4. Copy to /Web/shields;
5. Wash, rinse, repeat.

You have to make sure that the checkbox to leave the viewbox settings is enabled when you save as Optimized SVG, or you will get the sizing issues that I had earlier.

Offline the_spui_ninja

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 803
  • Last Login:Yesterday at 06:58:53 pm
  • THE Western SD Highway Nut
Re: Clinched Routes Highway Shields
« Reply #49 on: January 15, 2017, 12:19:00 am »
This seems like the most straightforward way and would minimize the amount of duplication needed.
Would this also work for the usanes system, as the links have a slightly different shield than the spurs?
An adventure is only an inconvenience rightly considered. An inconvenience is only an adventure wrongly considered. - G.K. Chesterton

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4422
  • Last Login:November 11, 2024, 12:50:03 pm
  • I like C++
Re: Clinched Routes Highway Shields
« Reply #50 on: January 16, 2017, 02:40:38 pm »
I didn't see any notice here about the usanh shields. Thanks for including them.
ME NH113B shield looks fine.
ME NH153 looks oogy. :)

In general, are there plans to remove the state abbreviation from "out-of-state" state route segments?
more examples
« Last Edit: January 16, 2017, 02:43:37 pm by yakra »
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline rschen7754

  • Jr. Member
  • **
  • Posts: 51
  • Gender: Male
  • Last Login:Yesterday at 08:06:13 pm
    • Rschen7754
Re: Clinched Routes Highway Shields
« Reply #51 on: January 16, 2017, 08:59:48 pm »
I didn't see any notice here about the usanh shields. Thanks for including them.
ME NH113B shield looks fine.
ME NH153 looks oogy. :)

In general, are there plans to remove the state abbreviation from "out-of-state" state route segments?
more examples

It is noted at https://github.com/TravelMapping/Web/issues/121.

Offline Griffith

  • Newbie
  • *
  • Posts: 8
  • Last Login:Yesterday at 10:57:40 pm
Re: Clinched Routes Highway Shields
« Reply #52 on: January 21, 2017, 03:15:51 pm »
I've enabled "Disable Caching (slows loading) and it works for all chea shields correct now.
eure was correct 2 hours ago but the text is not displayed anymore since I've disabled caching for the first time. It's no longer working in the HB too.

I've checked it for 4 other users and it's always the same behavior: Minimum 1 chea shield is not replaced (default bk/wh instead of wh/rd) and some eure texts are displayed. After selecting "disable cache", all chea shields work but no eure text is displayed any more.

It's identical with FF or IE. That means, I "changed" the behavior only once with FF and it's identical when I load it with IE now.

How does the cache work, is the cache on my end or on the site? Do I generally change the behavior by selecting "disable cache" or is it just on my computer? Can anyone reproduce the same behavior?

I have the same issue. I tried FF, Safari and Opera on a variety of devices and on all of them the autb, cheh, and eure shields are blank.

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4849
  • Last Login:November 20, 2024, 11:21:09 am
Re: Clinched Routes Highway Shields
« Reply #53 on: January 21, 2017, 04:22:59 pm »
Thanks. It's a generally issue and I cannot fix it. I could remove the svg files so that the numbers are shown again.

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 136
  • Gender: Male
  • Last Login:July 12, 2024, 01:20:07 am
Re: Clinched Routes Highway Shields
« Reply #54 on: January 21, 2017, 04:59:32 pm »
Thanks. It's a generally issue and I cannot fix it. I could remove the svg files so that the numbers are shown again.
Submitted something that will hopefully fix it. https://github.com/TravelMapping/Web/pull/143/commits/b0f8f69f60a851654f745c74845ab5842c1db0a7
The $routeNum variable in the autb, cheh, and eure cases never got the route numbers from the database ($row['route']) and just replaced ***NUMBER*** with an empty string.
« Last Edit: January 21, 2017, 05:05:21 pm by theFXexpert »

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4849
  • Last Login:November 20, 2024, 11:21:09 am
Re: Clinched Routes Highway Shields
« Reply #55 on: January 22, 2017, 03:49:53 am »
Thanks. It's a generally issue and I cannot fix it. I could remove the svg files so that the numbers are shown again.
Submitted something that will hopefully fix it. https://github.com/TravelMapping/Web/pull/143/commits/b0f8f69f60a851654f745c74845ab5842c1db0a7
The $routeNum variable in the autb, cheh, and eure cases never got the route numbers from the database ($row['route']) and just replaced ***NUMBER*** with an empty string.

Thanks :) However, it's still the same. autb, cheh and eure don't work. $routeNum works fine for other systems.

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2856
  • Last Login:Today at 07:41:39 am
Re: Clinched Routes Highway Shields
« Reply #56 on: January 22, 2017, 03:30:37 pm »
I think I did not pull down the merged code before installing.  I did that now and I think things are a little better.

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4849
  • Last Login:November 20, 2024, 11:21:09 am
Re: Clinched Routes Highway Shields
« Reply #57 on: January 22, 2017, 03:57:42 pm »
Thanks, I think all my shields work now except the 3-digit autb, e.g.: http://tm.teresco.org/hb/?r=aut.b100. What's different to 2-digit B roads? A different (wider) svg file is loaded but the same code is processed.


Edit: I've checked the link of my post and... IT'S WORKING NOW ::)
Edit2: Got it!


Again, when do I have to use "$routeNum" and "row['route']"?
« Last Edit: January 22, 2017, 04:03:04 pm by michih »

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 136
  • Gender: Male
  • Last Login:July 12, 2024, 01:20:07 am
Re: Clinched Routes Highway Shields
« Reply #58 on: January 22, 2017, 05:00:56 pm »
Again, when do I have to use "$routeNum" and "row['route']"?
For each case in the switch statement, $row['route'] has to be used or stored in a variable (which is usually $routeNum) at least once. This takes the route number from the database:
$routeNum = $row['route'];

or if letters need to be filtered out:
$routeNum = str_replace("US", "", $row['route']);

Whenever $routeNum is used later in the case block, it will contain the route number without the text. So if there are other characters that need to be filtered you can just use str_replace() on $routeNum from then on.

Offline michih

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 4849
  • Last Login:November 20, 2024, 11:21:09 am
Re: Clinched Routes Highway Shields
« Reply #59 on: January 23, 2017, 02:25:41 pm »
Shame on me... I should think instead of blind copy-paste... Sorry!