開放街圖標誌 OpenStreetMap 開放街圖

Sidewalks!

於 2016年三月13日 由 SomeoneElseEnglish發表。

(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…

電子郵件圖示 藍天圖示 Facebook 圖示 LinkedIn 圖示 乳齒象圖示 Telegram 圖示 X 圖示

討論

Stereo2016年03月13日 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?

SomeoneElse2016年03月13日 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.

Rovastar2016年03月15日 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.

SomeoneElse2016年03月24日 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”.

登入 來留下評論