python-mapnik icon indicating copy to clipboard operation
python-mapnik copied to clipboard

Road labels issue

Open Koles500 opened this issue 8 years ago • 6 comments

Hi. We rendered tiles with generate_tiles_multiprocess.py and road labels look quite strange as per attached screenshot. Why do these labels look incomplete ? Have you seen anything like this before ? I can provide further details if needed.

tile-rendering-road-labels-issue-2

Koles500 avatar Apr 03 '17 21:04 Koles500

Those labels are cut on tile's border. There can be more reasons for that. It looks like clip="true" is set on the symbolizer in this case.

talaj avatar Apr 04 '17 20:04 talaj

Obviously we will have to re-render every zoom level to fix this, right ? Where is this clip="true" option so that I can change it ? Thanks.

Koles500 avatar Apr 05 '17 10:04 Koles500

Where is this clip="true" option so that I can change it ?

clip is a property of shield symbolizer, see the reference. But it was just an idea based on your screenshot. Important is to ensure that a geometry crossing more than one tile is exactly the same in all those tiles. Otherwise label's offset from the beginning of the geometry will differ between tiles.

Also order in which those labels are rendered is important. In Postgis, for example, if SORT BY is not used, order of rows is undefined. Sorting by primary key, for example, can ensure rendering order.

Obviously we will have to re-render every zoom level to fix this, right ?

Only zooms containing those problematic labels.

talaj avatar Apr 05 '17 10:04 talaj

I have not much experience with mapnik nor postgres. Instead of me groping in darkness, can anyone give me some concrete solution for this ? Or at least what should I try to configure before running another rendering ?

Koles500 avatar Apr 05 '17 12:04 Koles500

I found solution here: https://help.openstreetmap.org/questions/33485/cut-labels-with-mapnik?page=1&focusedAnswerId=55502#55502 and results are much better now, however (as I posted there in a comment) after applying that solution I am still having road labels being a little cut off. Why is this and can I fix it ?

screenshot

Koles500 avatar Apr 06 '17 22:04 Koles500

Finally, I fixed it! <Map buffer-size="512" AND <ShieldSymbolizer clip="false" instead of <ShieldSymbolizer avoid-edges="true" (all occurences) in osm.xml worked.

Koles500 avatar Apr 12 '17 15:04 Koles500