OpenStreetMap-embleem OpenStreetMap

Sidewalks!

Plasing deur SomeoneElse op 13 Maart 2016 in English.

(or if you’re English, “Pavements!”)

I finally got this working for tertiary and secondary roads:

Sidewalk rendering example

That location corresponds to here in OSM.

There were three bits to it:

1) Determining which roads should have a sidewalk rendered. This is done in lua, and creates e.g. a road type “tertiary_sidewalk” to go with “tertiary” and “tertiary_link”:

https://github.com/SomeoneElseOSM/SomeoneElse-style/blob/sidewalk/style.lua#L230

2) Handle “tertiary_link” the same as “tertiary” in the style’s MML, e.g.:

https://github.com/SomeoneElseOSM/openstreetmap-carto-AJT/blob/sidewalk/project.mml#L403

3) Handle “tertiary_link” the same as “tertiary” in the style’s roads.mss, e.g.:

https://github.com/SomeoneElseOSM/openstreetmap-carto-AJT/blob/sidewalk/roads.mss#L2363

… except where we want to do something different:

https://github.com/SomeoneElseOSM/openstreetmap-carto-AJT/blob/sidewalk/roads.mss#L1114

“sidewalk_width-z13” etc. are declared at the top:

https://github.com/SomeoneElseOSM/openstreetmap-carto-AJT/blob/sidewalk/roads.mss#L119

There’s scope for further tinkering, and I’ve yet to see how usable it is on a small mobile phone screen in poor light, but it looks OK so far…

Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Discussion

Kommentaar van Stereo op 13 Maart 2016 om 20:51

Interesting! How are you planning to make it render just on the left side in this case?

While we’re talking about pavements, do you know of any routing engines that use that tagging for pedestrian routing?

Kommentaar van SomeoneElse op 13 Maart 2016 om 21:51

@Stereo I’m (mis)using the Mapnik “casing” to show a “sidewalk” on both sides of the road. I’ve no idea whether it’s possible to have a casing on only one side of a way, and if so how hard to do it would be. The “lua” side is pretty straightforward - instead of “tertiary_sidewalk” and “tertiary” you’d have “tertiary_left_sidewalk”, “tertiary_right_sidewalk” and “tertiary”. Of course, the more important information is “you can safely walk here” rather than “and it’s on the left as you go north”.

The router I use most often is the built-in Garmin eTrex one. Ages ago I did have a go at producing a Garmin map for “foot only use” (on it motorways weren’t usable roads, for example), using a version of the C# preprocessor that I used already. It sort-of worked but wasn’t ideal, since you couldn’t use the same .img for e.g. car routing too.

I’ve not looked at OSRM et al, but as I understand it if you run your own instance of that it’s highly configurable (see https://github.com/Project-OSRM/osrm-backend/wiki/Profiles ). It wouldn’t surprise me if you could persuade it (or some other online router) to support sidewalk tags.

Kommentaar van Rovastar op 15 Maart 2016 om 01:03

If you really want to have the left/right sidewalk as the casing maybe you could have the casing slightly narrower (than your both sides rendering) and offset to the left or right respectively. Just a theory but sounds hackable.

Kommentaar van SomeoneElse op 24 Maart 2016 om 21:19

Actually, I think the left/right thing could probably be handled by “line-offset”, as on the example here:

http://gis.stackexchange.com/questions/128244/tilemill-inset-line-with-negative-line-offset-property-value-produces-strange-a

However I don’t think I’ll worry about left vs right sidewalks (or at least not yet). I’d want to remove some of the duplication I’ve introduced into roads.mss first.

The “other” problem (where an unclassified road joined a tertiary it “poked through” and could be seen over the casing at the other side of the road was fixed by setting “line-cap: butt” instead of “round”.

Meld aan om kommentaar te lewer