I'm getting cut labels on my maps. Same thing is happening on the main map here: http://www.openstreetmap.org/#map=11/52.3303/-1.3774 (look between Coventry and Rugby) Anyone know how to fix them? I made a dynamic tileserver with Mapnik, renderd and Apache mod-tile. Also made a static one with Mapnik and generate_tiles.py to make the tiles. Same thing is happening in both cases. Did some research and discovered that the problem is caused by not having a buffer around the rendered tiles. So I stated a buffer size in my main xml style file (osm.xml): <Map background-color="#b5d0d0" buffer-size="128" srs="&srs900913;" minimum-version="2.0.0"> Did so for the dynamic and the static servers. Made no difference. Tried different sizes for the buffer: 256, 1024, made no difference. I know osm.xml is being loaded because every time I edit it I change the background colour and I can see the new colour in newly rendered tiles. So Mapnik is reading osm.xml but apparently ignoring the buffer size. Why so? Thank you. asked 26 May '14, 18:12 Charles Sweeney |
Fixed it myself. Not sure if it's the "correct" solution but it works very well for me and gets rid of all the cut labels. Used "avoid-edges" in the xml. On the dynamic server (Mapnik, renderd, mod_tile): Edited the main xml file /etc/mapnik-osm-data/osm.xml Added the "avoid-edges" parameter with a value of "true" to every instance of the <ShieldSymbolizer> tag (13 of them). So for example, this line: <ShieldSymbolizer size="10" fill="#fff" placement="line" file="&symbols;/mot_shield[length].png" spacing="750" minimum-distance="30" fontset-name="bold-fonts">[ref]</ShieldSymbolizer> ...became: <ShieldSymbolizer size="10" fill="#fff" avoid-edges="true" placement="line" file="&symbols;/mot_shield[length].png" spacing="750" minimum-distance="30" fontset-name="bold-fonts">[ref]</ShieldSymbolizer> After editing, stop and start renderd: /etc/init.d/renderd stop /etc/init.d/renderd start You can go to a new area of the map to see newly generated tiles to see the effect of the changes. In my case on a test server I deleted ALL existing tiles, then went onto the map again, getting every tile fresh. The tiles are here (on my setup): /var/lib/mod_tile/default To delete all the tiles, delete the "default" directory: cd /var/lib/mod_tile/ rm -fr default The "default" directory is automatically created again the next time a tile is rendered. I was delighted with the result. My worry was that there would be more labels and pairs of labels where there was previously cut labels, but to my pleasant surprise there was the same number of labels as before but those that were previously cut had been moved slightly (within the edge of the tile) and displayed perfectly! Still had buffer-size="128" in the <Map> attribute, though not sure if that is necessary as it didn't appear to make any difference there. answered 27 May '14, 15:58 Charles Sweeney similar solutions for the label cutting problem are discussed in this video http://stateofthemap.us/session/advanced-cartocss-tricks/, but for CartoCss
(27 May '14, 17:17)
escada
|
Hi. I applied the solution above, but I am still having road labels being a little cut off. Why is this and can I fix it ? answered 06 Apr '17, 23:51 Koles500 The answer at https://help.openstreetmap.org/questions/54196/how-to-make-symbols-visible-on-a-lesser-zoom-level/54202 suggests that you might have been using the old pre-carto style. If you are, then there are two things that you're doing differently to "most people" (the other is running this on Windows). My guess is that your problem here is related to something that you're doing differently - perhaps try a more recent map style, or the same style on differently-built version of Mapnik (for example https://switch2osm.org/manually-building-a-tile-server-16-04-2-lts/ just fetches from a repository so there's less to go wrong).
(07 Apr '17, 00:09)
SomeoneElse ♦
We have newest mapnik tools that I downloaded from SVN repository. I can try different style. Which one exactly do you suggest? Maybe this one : ? https://github.com/gravitystorm/openstreetmap-carto
(07 Apr '17, 14:04)
Koles500
I downloaded style from https://github.com/gravitystorm/openstreetmap-carto and compared it with my usual default.style file and they are exactly the same. I re-imported data and re-rendered tiles and the problem is still the same as shown above. Any ideas ?
(12 Apr '17, 15:53)
Koles500
As mentioned elsewhere, the "default.style" file just determines what columns are imported, not what map style you get. That file is usually called "mapnik.xml". To take one example of how that is created see https://switch2osm.org/manually-building-a-tile-server-16-04-2-lts/ up to where it says "carto project.mml > mapnik.xml". In that example the "source" for the style is in the files referred to by "project.mml" and "carto" converts that into "mapnik.xml" which is something that Mapnik can understand (but most humans can't). To compare non-carto map styles you'd need to compare the mapnik.xml files, but that will be difficult because the file format is very difficult to understand.
(12 Apr '17, 16:36)
SomeoneElse ♦
|
Finally, I fixed it! <Map buffer-size="512" AND <ShieldSymbolizer clip="false" instead of <ShieldSymbolizer avoid-edges="true" (all occurences) in osm.xml worked. answered 12 Apr '17, 16:54 Koles500 |