Opened 10 years ago

Closed 5 years ago

#1666 closed enhancement (duplicate)

[roads] Render custom route shields

Reported by: elyk Owned by: mapnik-team@…
Priority: major Milestone: Wishlist
Component: mapnik Version:
Keywords: Cc: deltafoxtrot256@…, JoshD, mxn@…

Description

For relations of type=route; route=road; symbol=<some URL> the URL is most likely to an image of the route shield. The relation normally takes the place of any ref=* that exists on the ways that make up the relation, so no shield is currently rendered at all for these roads.

Example relation: http://www.openstreetmap.org/browse/relation/62155

The renderer would need to do the following:

  • Check if the symbol tag looks like a URL
  • Download the file at that URL
  • Check that the file is an image
  • Scale the image to the appropriate size (may depend on zoom level)
  • Render the image as a shield at a periodic distance along the ways that make up the relation, and try to avoid rendering one shield on top of another if possible.

Attachments (1)

osm.xml-patch (11.2 KB) - added by John 10 years ago.
patch to render custom map shields on a per country basis.

Download all attachments as: .zip

Change History (22)

comment:1 Changed 10 years ago by Tom Hughes

This not something mapnik is capable of doing. It's also completely and utterly bogus to be attaching a URL to every single road like that...

comment:2 Changed 10 years ago by elyk

I figured mapnik wasn't this capable yet. Is there any chance that such a route relation could use a normal shield with '<network tag> <separator> <ref tag>' as the shield text?

comment:3 in reply to:  1 Changed 10 years ago by elyk

Replying to tom@compton.nu:

It's also completely and utterly bogus to be attaching a URL to every single road like that...

The URL is on the relation, not on every way that makes up the relation. That way the URL only appears in one spot for the entire road.

I see adding the URL no differently than adding a wikipedia link to some object. It might be useful to some application or some other renderer, but not necessarily useful to mapnik.

comment:4 Changed 10 years ago by John

You shouldn't tag for software, there is ways of doing this without needing to explicitly tag it.

I'll attach an example patch, it may need improving some what and the highway shield images need someone better at this than me to touch them up.

Changed 10 years ago by John

Attachment: osm.xml-patch added

patch to render custom map shields on a per country basis.

comment:5 Changed 10 years ago by John

Cc: deltafoxtrot256@… added

comment:6 Changed 10 years ago by Ldp

This aussie patch is /an/ approach, but not necessarily the best. It makes relatively expensive calls to postgis to get the Aussie boundary and compare each route to that. While that may look innocent enough, try extrapolating doing this for 50+ countries. That's even discounting the explosion in the size of osm.xml.

As a way to handle the expensive postgis calls: I think a much better approach would be to determine locality of features during import, and not during rendering. The import will take longer, sure, but tile rendering should be much faster than using your run-time filtering method.

On the matter of stylesheet maintainability, XML entities definately come in very handy here, but it will still be a humongous stylesheet. Other approaches like cascadenik should not be discounted for this.

comment:7 Changed 10 years ago by John

I didn't think it would be the best option, for most of the reasons you point out, however we have to start some where, so I thought I'd get the ball rolling.

comment:8 Changed 9 years ago by steve8@…

Owner: changed from steve8@… to mapnik-team@…

comment:9 Changed 9 years ago by John

I'm currently working on a new approach, instead of trying to work out polygons on the fly and render the shields that way, do some pre-processing and insert the information into a new column in the database combined with a lookup table on the wiki:

http://wiki.openstreetmap.org/wiki/Custom_Highway_Shields

However I'm still working out the best way to store the lookup table in memory and then can go on to work out what polygons a way runs through and then applying an icon to the way.

comment:10 Changed 8 years ago by JoshD

Cc: JoshD added

comment:11 Changed 8 years ago by Minh Nguyễn

Cc: mxn@… added

comment:12 Changed 5 years ago by math1985

@gravitystorm has decided not to implement coloured route shields, and by extension custom route shields, on Github: https://github.com/gravitystorm/openstreetmap-carto/issues/421

Therefore, I will close this issue now.

comment:13 Changed 5 years ago by math1985

Resolution: wontfix
Status: newclosed

comment:14 Changed 5 years ago by Minh Nguyễn

Milestone: Wishlist
Resolution: wontfix
Status: closedreopened

Custom shields are a very different beast than custom colors on the existing generic shields. I don’t think gravitystorm’s comment should preclude integrating some form of the shield renderer (source) in the future.

Last edited 5 years ago by Minh Nguyễn (previous) (diff)

comment:15 Changed 5 years ago by math1985

Ok, we can keep the issue open.

comment:16 Changed 5 years ago by pnorman

Resolution: wontfix
Status: reopenedclosed

The place to report issues with openstreetmap-carto, the "standard" style on openstreetmap.org is on its issue tracker. The old Mapnik XML based stylesheets have been retired.

If this ticket is about adding shields to the "standard" layer, this isn't the appropriate place for it. If it's about setting up some other layer with custom shields, this is also not the appropriate place.

comment:17 Changed 5 years ago by math1985

Resolution: wontfix
Status: closedreopened

The ticket was opened 5 years ago, when this was still the appropriate place to report these issues. I propose we leave the old tickets here open, at least as long as we have not migrated them to Github.

comment:18 Changed 5 years ago by pnorman

My recollection from EWG meetings is that it's fine to close them out. After all, they're reported against a component that will never be updated, not against openstreetmap-carto. If there is interest, a new ticket can be opened, but as it stands, this ticket will never be fixed, even if shields are added to openstreetmap-carto.

comment:19 Changed 5 years ago by math1985

I would strongly prefer to either keep them open, or migrate them to Github. The open issues helped me a lot with re-factoring the road layers, and I think they will also help with seeing what are the problems with the other layers.

In any case, we are already down from over 400 to 319 issues.

comment:20 Changed 5 years ago by math1985

Summary: Render custom route shields[roads] Render custom route shields

comment:21 Changed 5 years ago by math1985

Resolution: duplicate
Status: reopenedclosed

This issue is now being discussed on Github: https://github.com/gravitystorm/openstreetmap-carto/issues/495 I will therefore close the issue here.

Note: See TracTickets for help on using tickets.