stamen / terrain-classic

World-wide CartoCSS port of Stamen's classic terrain style
ISC License
144 stars 35 forks source link

Enable highway shields in other countries #37

Closed almccon closed 8 years ago

almccon commented 8 years ago

I'm not sure why the default shield isn't showing up, but when I use extracts outside the US I don't get any highway shields, and when I use extracts of other US states, I don't get any of their state shields.

screen shot 2015-10-06 at 5 26 39 pm screen shot 2015-10-06 at 5 21 46 pm screen shot 2015-10-06 at 5 39 15 pm

clhenrick commented 8 years ago

Looking into the highway_shields table in Postgres for a New York state extract and I only see shields for interstates. Perhaps the SQL is not capturing the "ref" tag for other states? Looking into it further now.

clhenrick commented 8 years ago

So it looks as if the shields are showing up in other U.S. states & countries now. I checked Tokyo, New York state, and Mexico City.

screen shot 2015-10-22 at 3 35 24 pm

screen shot 2015-10-22 at 3 39 16 pm

screen shot 2015-10-22 at 3 53 14 pm

One thing I've noticed is that we may want different widths for the default highway shield. Shields for Mexico City tend to overflow while those for Vancouver seem too large. Or perhaps for longer ref strings we can shrink the text size slightly.

screen shot 2015-10-22 at 3 56 43 pm

screen shot 2015-10-22 at 4 03 19 pm

almccon commented 8 years ago

I just did a bunch of work creating multiple-sized highway shields for another map we're working on, mostly borrowing from openstreetmap-carto (see for example this elaborate script that produces a ton of similar shields of various sizes. Those shields get saved into a folder like this: https://github.com/gravitystorm/openstreetmap-carto/tree/master/symbols/shields

I can try porting some of that code over to this repo, or if you felt like diving into it you could try borrowing some code from openstreetmap-carto to accomplish the same effect.

clhenrick commented 8 years ago

that looks interesting @almccon, I'm open to testing them out. Do you happen to know which .mss file contains the carto code for assigning the shields?

clhenrick commented 8 years ago

ah nevermind, found it: https://github.com/gravitystorm/openstreetmap-carto/blob/master/roads.mss#L2581

clhenrick commented 8 years ago

Looks like

select distinct char_length(ref) from highway_shields order by char_length;

typically returns 1 as the lowest and 7 being the largest value. However in Tokyo I noticed a 23 because someone edited ref as being "Road joining 408 and 53", so we'd also have to exclude values from ref > 7.

clhenrick commented 8 years ago

Think I've got it working so that we only render default tiles for non US interstates and that the default shield size changes based on the amount of text, ie: char_length(ref).

Here's Victoria, BC screen shot 2015-10-23 at 11 26 31 pm

And here's Seattle screen shot 2015-10-23 at 11 30 35 pm

Still need to test over-seas but think it's looking good so far.

clhenrick commented 8 years ago

closing for now.