Author Topic: SVG Banners  (Read 8718 times)

0 Members and 1 Guest are viewing this topic.

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 134
  • Gender: Male
  • Last Login:June 30, 2023, 02:59:08 pm
SVG Banners
« on: February 16, 2021, 06:45:49 pm »
TM has been without proper banners long enough so I spent the last week coding up an implementation for dynamically generating SVG banners. I tried to write it in a way that is hopefully modular so different variations can be easily added. It should also account for routes that have multiple banners like those Alt Truck routes in PA. I made a pull request for a simple beta implementation on clinched.php:

https://github.com/TravelMapping/Web/pull/631

My dev environment for php stuff has been dismantled for a while since I have been mainly using other languages recently, so the server-side code is mostly untested. I at least tested preg_split() to make sure it worked as expected in the w3schools editor.

The result should output similar to this on clinched.php


The svg templates are based on the svgs found in Wikimedia Commons: https://commons.wikimedia.org/wiki/Commons:WikiProject_U.S._Roads/Auxiliary_plates

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
Re: SVG Banners
« Reply #1 on: February 16, 2021, 07:47:55 pm »
Thanks for this contribution.  I've got it up on tmstage.teresco.org for some testing, but it's looking good to me.

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 134
  • Gender: Male
  • Last Login:June 30, 2023, 02:59:08 pm
Re: SVG Banners
« Reply #2 on: February 16, 2021, 08:28:45 pm »
I had forgotten future Interstates were their own system and forgot to include them in the switch statement along side usai.

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
Re: SVG Banners
« Reply #3 on: February 16, 2021, 09:38:53 pm »
I had forgotten future Interstates were their own system and forgot to include them in the switch statement along side usai.

Added, thanks.

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1627
  • Last Login:Today at 10:09:32 am
Re: SVG Banners
« Reply #4 on: February 17, 2021, 06:53:52 am »
Thanks for this contribution.  I've got it up on tmstage.teresco.org for some testing, but it's looking good to me.

Agreed!

In VA we're treating "Wye" as a banner, and "Wye" still shows up in text above the routes since there's no corresponding Wye plate in the new set. And there probably shouldn't be one, since those routes are marked with a Y in the shield under the number. Should we change how we handle wyes?
Clinched:

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
Re: SVG Banners
« Reply #5 on: February 17, 2021, 08:46:50 am »
Thanks for this contribution.  I've got it up on tmstage.teresco.org for some testing, but it's looking good to me.

Agreed!

In VA we're treating "Wye" as a banner, and "Wye" still shows up in text above the routes since there's no corresponding Wye plate in the new set. And there probably shouldn't be one, since those routes are marked with a Y in the shield under the number. Should we change how we handle wyes?

This is related to how we will handle the routes like NY's US 20A, which should get the A in the shield and have no banner.

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 134
  • Gender: Male
  • Last Login:June 30, 2023, 02:59:08 pm
Re: SVG Banners
« Reply #6 on: February 17, 2021, 10:53:06 am »
Right. I was thinking VA wyes should have the Y on the shield later on, so I left them unmodified for now.

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
Re: SVG Banners
« Reply #7 on: February 17, 2021, 04:11:42 pm »
I've put the banners on the main site.

Offline mapmikey

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1171
  • Last Login:Today at 09:31:39 am
    • Co-curator Virginia Highways Project
Re: SVG Banners
« Reply #8 on: February 17, 2021, 08:26:22 pm »
Right. I was thinking VA wyes should have the Y on the shield later on, so I left them unmodified for now.

Froggie made specific Y shields for our Virginia Highways Page.  You are welcome to use them if that would be helpful (these would be the only ones that will ever be on TM as all the unposted wye routes will fail one of the criteria):

http://www.vahighways.com/shields/1dvao6ysm.gif
http://www.vahighways.com/shields/va132y.gif
http://www.vahighways.com/shields/va180y.gif
http://www.vahighways.com/shields/va205y.gif
http://www.vahighways.com/shields/va300y.gif (will be added as one of the quasi-posted routes)


Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
Re: SVG Banners
« Reply #9 on: February 17, 2021, 11:30:52 pm »
I created templates and added code to use them for usava "Y" routes.  See what you think on tmstage.teresco.org.  I think maybe the route number font could be scaled up a bit.

Offline the_spui_ninja

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 721
  • Last Login:Today at 11:38:25 am
  • THE Western SD Highway Nut
Re: SVG Banners
« Reply #10 on: February 18, 2021, 12:56:33 am »
The svg templates are based on the svgs found in Wikimedia Commons: https://commons.wikimedia.org/wiki/Commons:WikiProject_U.S._Roads/Auxiliary_plates
Are the SC, SD, and VT variants going to be added in as well?
An adventure is only an inconvenience rightly considered. An inconvenience is only an adventure wrongly considered. - G.K. Chesterton

Offline mapcat

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 1627
  • Last Login:Today at 10:09:32 am
Re: SVG Banners
« Reply #11 on: February 18, 2021, 09:08:35 am »
I created templates and added code to use them for usava "Y" routes.  See what you think on tmstage.teresco.org.  I think maybe the route number font could be scaled up a bit.

Comparing this to this, I think you're right that the font could be just a little bigger.

Will these eventually appear on showroute as well?
« Last Edit: February 18, 2021, 09:17:01 am by mapcat »
Clinched:

Offline Jim

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 2732
  • Last Login:Today at 10:27:44 am
Re: SVG Banners
« Reply #12 on: February 18, 2021, 09:24:27 am »
I just made the fonts bigger in the Y shields, both for the number and the Y trying to look more like that 132Y.

The banners should get to other places that use shields: https://github.com/TravelMapping/Web/issues/632 . I'll look into it as time permits unless @theFXexpert beats me to it.

Offline theFXexpert

  • TM Collaborator
  • Full Member
  • *****
  • Posts: 134
  • Gender: Male
  • Last Login:June 30, 2023, 02:59:08 pm
Re: SVG Banners
« Reply #13 on: February 18, 2021, 11:13:16 am »
The svg templates are based on the svgs found in Wikimedia Commons: https://commons.wikimedia.org/wiki/Commons:WikiProject_U.S._Roads/Auxiliary_plates
Are the SC, SD, and VT variants going to be added in as well?
They were coded in initially but, I found an issue causing border colors to not be customized properly and submitted a fix https://github.com/TravelMapping/Web/pull/634

I just made the fonts bigger in the Y shields, both for the number and the Y trying to look more like that 132Y.
Yes. I think that looks a lot better!

Offline the_spui_ninja

  • TM Collaborator
  • Hero Member
  • *****
  • Posts: 721
  • Last Login:Today at 11:38:25 am
  • THE Western SD Highway Nut
Re: SVG Banners
« Reply #14 on: February 18, 2021, 11:18:51 am »
The svg templates are based on the svgs found in Wikimedia Commons: https://commons.wikimedia.org/wiki/Commons:WikiProject_U.S._Roads/Auxiliary_plates
Are the SC, SD, and VT variants going to be added in as well?
They were coded in initially but, I found an issue causing border colors to not be customized properly and submitted a fix https://github.com/TravelMapping/Web/pull/634
Cool, you don't have to worry about the WY variant because there's no bannered state routes, and there probably won't be in the future.
An adventure is only an inconvenience rightly considered. An inconvenience is only an adventure wrongly considered. - G.K. Chesterton