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

0 Members and 1 Guest are viewing this topic.

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 127
  • Gender: Male
  • Last Login:Today at 02:42:43 pm
Re: Clinched Routes Highway Shields
« Reply #195 on: April 15, 2021, 10:51:03 am »
Added some new shields late last night https://github.com/TravelMapping/Web/pull/640

Manatoba Provincial Roads (the secondary system canmbp), Northwest Territory, Guam, and Texas Recreation Roads.

The Winnipeg City Routes also had really really bold numbers on them that didn't look right compared to the field posts on Streetview, so I trimmed them down.

I don't know how well the Guam shields will look since they are vertically oriented unlike almost everything else we have.

While setting up a case statement for usatxre in shieldgen to parse the numbers, I think I came up with a solution to the long standing problem of shields getting messed up when a region's tier 4 routes cross into other regions. I set up a regular expression to strip out prefixes that are exactly 2 uppercase letters. This works better than the default case which does a simple string replace based on the region. The regular expression can handle edge cases like FLA1A, TXOSR, and VTF5 easily too. With few exceptions that are already handled elsewhere, this can parse most tier 4/5 systems in the US and Canada. In the pull request, I'm using cannt as a pilot for this (a small system that crosses into Alberta a couple times). I don't think I want to make this the default case since the default case may handle prefixes we want to keep or something else.

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 127
  • Gender: Male
  • Last Login:Today at 02:42:43 pm
Re: Clinched Routes Highway Shields
« Reply #196 on: April 21, 2021, 02:13:20 pm »
4 character wide templates added for CT, MA, ME and VI https://github.com/TravelMapping/Web/pull/642
Other minor adjustments to other templates included.

cannt and usatxre look good using regex for shield generation, so I'll adjust most other tier 4/5 US and Canada systems to use it in a later pull request.

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 127
  • Gender: Male
  • Last Login:Today at 02:42:43 pm
Re: Clinched Routes Highway Shields
« Reply #197 on: April 29, 2021, 02:37:08 pm »
cannt and usatxre look good using regex for shield generation, so I'll adjust most other tier 4/5 US and Canada systems to use it in a later pull request.
and here is the rest of it https://github.com/TravelMapping/Web/pull/644
I also modified the American Samoa template in this pull request.

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 127
  • Gender: Male
  • Last Login:Today at 02:42:43 pm
Re: Clinched Routes Highway Shields
« Reply #198 on: May 07, 2021, 01:20:35 pm »
The above is live on the main site with a bonus canmb template although suffixes are plain for now.

What shields I plan to do next:
- canabs Alberta 500+ https://github.com/TravelMapping/Web/issues/606
- canons Ontario Secondary
- frad France Routes Départementales https://github.com/TravelMapping/Web/issues/594
- Great Britain/Northern Ireland B Roads; Ireland Regional https://github.com/TravelMapping/Web/issues/597
- Refined superscripted suffixes for canbc, canmb, canon

I'm looking into later doing:
- Australia systems https://github.com/TravelMapping/Web/issues/595
- Refining Arkansas + (special 980 Airport shields? Marine Fuel Tax shields?)
- Refining bannered Georgia Routes

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 127
  • Gender: Male
  • Last Login:Today at 02:42:43 pm
Re: Clinched Routes Highway Shields
« Reply #199 on: May 11, 2021, 01:09:13 pm »
https://github.com/TravelMapping/Web/pull/648 Big one

New templates:
- frad, fram
- gbnb, nirb, irlr
- canabs
- canons

Updated/Optimized templates:
- Generic wide
- canbc refined suffixes
- canmb refined suffixes
- canon refined suffixes
- canonf
- hunm, hunf - Ran these through the Inkscape optimizer and got rid of a couple of useless scale transforms. Maybe this will help with the rendering inconsistences going on with it. https://github.com/TravelMapping/Web/issues/615

Let shields auto scale to fit height on clinched.php https://github.com/TravelMapping/Web/issues/71

Online Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2137
  • Last Login:Today at 03:20:51 pm
Re: Clinched Routes Highway Shields
« Reply #200 on: May 11, 2021, 04:07:16 pm »
https://github.com/TravelMapping/Web/pull/648 Big one

This has been pulled in and is up for testing at tmstage.teresco.org .

Offline rickmastfan67

  • TM Collaborator (A)
  • Hero Member
  • *****
  • Posts: 1155
  • Gender: Male
  • Last Login:Yesterday at 10:33:13 pm
Re: Clinched Routes Highway Shields
« Reply #201 on: May 11, 2021, 11:26:14 pm »
theFXexpert, the Ontario secondary shields look great!  Plus thanks for getting the suffixes working on all the Ontario shields looking correct now!  ;D

Online si404

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1492
  • Last Login:Today at 03:20:58 pm
Re: Clinched Routes Highway Shields
« Reply #202 on: May 12, 2021, 07:15:07 am »
- gbnb, nirb, irlr
Liking these. And the B roads templates can be reused for other systems - the non-primary A roads, crown dependency stuff.

Need to work out an easy way to say which routes from those systems need what shields - primary, non-primary or both. I've made a .csv documenting this. It really ought to be a semi-automated process, as manually throwing in hundreds of exceptions isn't going to be good.

imnb and jeyc can use these white shields now, as they are all non-primary. The others (gnba, nira, imna, jeya and jeyb) have a mix.

---

Should the R road template not have slightly rounded external corners rather than square external ones? The signs have rounded corners, but not rounded as much as the internal boundary. The square corners look odd.

---

Mostly for me, but yellow shielded R roads. Seems like (cf R135 sign, where one direction is yellow, one isn't, and it's all the same vintage) its only meant to be parts (where the parallel road is a motorway? Or perhaps on some routes specifically a tolled motorway - eg M8). Only one or two routes are even mostly signed with yellow, rather than white. Ignore for now. It seems like when signs are replaced, they put the yellow on. But most of these signs are pretty new (as they came up with the idea after most of the motorway network had been built), so we're looking at a good decade from now, if not longer, before most of the signs are even thought of wrt replacement.

Thankfully it's only a few routes that would need these shields:

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 127
  • Gender: Male
  • Last Login:Today at 02:42:43 pm
Re: Clinched Routes Highway Shields
« Reply #203 on: May 12, 2021, 03:27:39 pm »
Need to work out an easy way to say which routes from those systems need what shields - primary, non-primary or both. I've made a .csv documenting this. It really ought to be a semi-automated process, as manually throwing in hundreds of exceptions isn't going to be good.
I agree. Regardless of display method, identifying this some way in the csv side would be better for maintainability.
Or A Roads could be split into further subsystems (Motorways, primary, non-primary) but, I doubt that would be practical.

Should the R road template not have slightly rounded external corners rather than square external ones? The signs have rounded corners, but not rounded as much as the internal boundary. The square corners look odd.
The outside corner radius is 10 which looks quite square in clinched.php. (inside radius is 25)
The below modified mockup has 20 outer, 30 inner radius and increased border size from 5 to 10.


         current | modified

Online si404

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1492
  • Last Login:Today at 03:20:58 pm
Re: Clinched Routes Highway Shields
« Reply #204 on: May 20, 2021, 02:33:56 pm »
Need to work out an easy way to say which routes from those systems need what shields - primary, non-primary or both. I've made a .csv documenting this. It really ought to be a semi-automated process, as manually throwing in hundreds of exceptions isn't going to be good.
I agree. Regardless of display method, identifying this some way in the csv side would be better for maintainability.
Or A Roads could be split into further subsystems (Motorways, primary, non-primary) but, I doubt that would be practical.
The motorways are already separate. Primary vs non-primary is difficult for multiple reasons:

1) Routes can and do change back and forth multiple times
2) signage can muck about and be ambiguous as to where the changes are
3) splitting is a whole lot more work - and not just for me, but also for travellers

I think the best we can do is working out whether a road is primary, non-primary or has bits of both - which I've already done - and then using multiple shields. But then that's more work on the web design.
Quote
The outside corner radius is 10 which looks quite square in clinched.php. (inside radius is 25)
The below modified mockup has 20 outer, 30 inner radius and increased border size from 5 to 10.


         current | modified
The modified is better, I think.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 3292
  • Last Login:Today at 03:04:38 pm
Re: Clinched Routes Highway Shields
« Reply #205 on: May 25, 2021, 01:05:44 am »
https://travelmapping.net/hb/showroute.php?r=ar.ar9152
https://travelmapping.net/hb/showroute.php?r=ar.ar7221a

I checked out a couple similar hyphenated routes in usala and those look good.
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 127
  • Gender: Male
  • Last Login:Today at 02:42:43 pm
Re: Clinched Routes Highway Shields
« Reply #206 on: May 29, 2021, 12:41:21 pm »
https://travelmapping.net/hb/showroute.php?r=ar.ar9152
https://travelmapping.net/hb/showroute.php?r=ar.ar7221a

I checked out a couple similar hyphenated routes in usala and those look good.
Yeah. The hyphenated Arkansas routes have special "Marine Fuel Tax" shields that I'm interested in adding.
https://commons.wikimedia.org/wiki/File:Arkansas_915-2.svg

The shield generator has trouble parsing hyphenated routes that have a suffix too.

Offline yakra

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 3292
  • Last Login:Today at 03:04:38 pm
Re: Clinched Routes Highway Shields
« Reply #207 on: May 29, 2021, 01:08:44 pm »
I've never really peeked under the hood of the shield generator. What's the relevant part of the code?
Sri Syadasti Syadavaktavya Syadasti Syannasti Syadasti Cavaktavyasca Syadasti Syannasti Syadavatavyasca Syadasti Syannasti Syadavaktavyasca

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 127
  • Gender: Male
  • Last Login:Today at 02:42:43 pm
Re: Clinched Routes Highway Shields
« Reply #208 on: May 29, 2021, 02:42:14 pm »
Around line 658 of the latest version of shielden.php.
This is where the Arkansas specific case is.

Code: [Select]
    case 'usaar': // Arkansas
            $matches = [];
            $routeNum = str_replace('AR', "", $row['route']);
            if (preg_match('/(?<number>[0-9]+)(?<letter>[A-Za-z]+)/', $routeNum, $matches)) {
                $svg = str_replace("***NUMBER***", $matches['number'], $svg);
                $svg = str_replace("***LETTER***", $matches['letter'], $svg);
                break;
            }
The preg_match function takes each sub-pattern (?<number> and ?<letter>) and puts it into a corresponding array key in the array $matches.

[0-9]+ will match one or more numbers and store it in $matches['number'].
[A-Za-z]+ will match one or more letters case-insensitive and store it in $matches['letter'].

The str_replace functions then replace each array value into the SVG to give the effect of superscripted suffixes.

Hyphens are not accounted for in the matching code* and sees a number after a hyphen as another separate number. This will overwrite the number detected before the hyphen. Which is why 722-1A becomes just 1A.


*Hyphens have special meaning to depict ranges in a character class. [0-9] means: match the character '0' through character '9'. Literal hyphens can be included in a character class if it's escaped with a backslash '\' or placed where they can't be interpreted as a range such as [-0-9].