Hello everyone. I'm writing a small android application with osmdroid that shows the map and uses the landcover information of the current position for some features. Since the tiles are being stored on the filesystem of the device either way by osmdroid, i had the idea to analyse them instead of using another service like overpass api, to reduce the traffic caused by my application and to allow usage in areas with bad or no internet. On http://wiki.openstreetmap.org/wiki/Mapnik it says that https://github.com/gravitystorm/openstreetmap-carto is the official style of openstreetmap. Distributed over the relevant .mss files i can find a lot of color hex codes. But for example the green #c8f9cc which is used in the park at http://a.tile.openstreetmap.org/16/34126/21791.png can't be found anywhere, neither by manual search (going into the files and strg+f) nor with the github search function. looking into the mss file it should be #c8facc Another example would be the yellow #fef0ba which is used in this tile: http://c.tile.openstreetmap.org/19/274603/166642.png where the beach is marked with natural=beach, so it should be #fff1ba. Should be values are based on https://github.com/gravitystorm/openstreetmap-carto/blob/master/landcover.mss I suspect that the gamma adjustments for zoom level and number of nodes are the cause of this, for example:
So i tried playing around with the original colors and the gamma adjustment tool of paint.net, but i was unable to reproduce the used colorcodes. Is this really the right github project, or am i looking at the wrong one? If it is the wrong one, could you please point me into the right direction? If it is the right one, what operation gets executed that produces the final colorcodes? Is there maybe somewhere a full list of them? asked 31 Oct '15, 22:40 EinFreierNick aseerel4c26 ♦ |
You are looking at the correct code for where the colours are defined. The piece you are missing is how the stylesheet is converted into rendered tiles. The OSMF tileservers use You can read more details on the available mapnik image formats on the mapnik wiki. If you use other software to create the images, such as Tilemill, then you might find the colours are slightly different, either by using full 32bit non-paletted images, or paletted images created with different settings. answered 02 Nov '15, 11:07 Andy Allan 2
And see https://github.com/gravitystorm/openstreetmap-carto/issues/1940 for a related github discussion.
(03 Nov '15, 16:43)
gormo
uf, i think i'll have to drop this. there are too many unknowns and even phenomenons in the "creation of the colors". But still, thank you for your help.
(04 Nov '15, 16:12)
EinFreierNick
|
You are looking at the right code. Why the color code #c8facc defined in the style sheet ends up as #c8f9cc in the PNG I have no idea - I'd expect some alpha/antialiasing artifacts along the outline of the area but not in the centre. There's a couple steps from the style sheet to the ready-made image. Some stylesheet instructions that deal with colours (lighten, darken, saturate etc.) are processed by the "carto" compiler that creates a Mapnik XML style description from the CSS files. But the actual drawing (during which the alpha values come into play) is handled by the Mapnik renderer, and more precisely by the AGG library it uses to do the drawing. If you can boil this down to a small test case - Mapnik instructed to render color A but instead rendered color B - then you could perhaps open a ticket on the Mapnik Github repository. Having said that, trying to deduct geodata from tiles by color codes, and especially with a tolerance so small that a small change like c8facc->c8f9cc trips up the logic, sounds extremely brittle to me. Remember, the map style might change at any time. answered 01 Nov '15, 00:29 Frederik Ramm ♦ yes ofcause building in a tolerance probably wouldn't hurt. But when i have no clue why (and how) things are like they are, this is going to be rather wearsome. In this case the difference is 1-3 per color, but what if it is somewhere 15 and not 1-3?
(01 Nov '15, 08:33)
EinFreierNick
Like it is happening with #FFF1BA -> #FFF0A9 (see the edit of the start post). The difference in blue is 17.
(01 Nov '15, 12:50)
EinFreierNick
|
just a quick drop in (no time to think about your question in deep), maybe it is related: https://blog.openstreetmap.org/2015/10/30/openstreetmap-org-map-changing/
@aseerel4c26 that might be possible. At the green area ~1/4th directly below the the New York label the dark green changes from #AACAAE to #AACBAF
meta: Welcome to OSM, @EinFreierNick!