اوپن سٹریٹ میپ دا لوگو اوپن سٹریٹ میپ

Grouping Mapnik's labels

ایہہ ؜29؍؜April ؜2014ء‬ English وچ «Zverik» لیکھ چھپیا گیا سی۔

If you tried rendering quality maps with Mapnik, you know its label placement is awful. Just a bit better than throwing labels on map at random. So for printing, postprocessing in a vector editor is mandatory.

If you tried editing Mapnik-generated SVG, you know it is completely unstructured. Which means, if you need to move a label, first you have to select all of its letters one by one, and then its casing, also letter by letter. And there will be a lot of frustration when you select roads underneath the label, or lose selection.

Yesterday I’ve made a small script that takes Mapnik SVG, finds labels and wraps them in groups. So when you open that SVG in Inkscape, you will move labels not by letter, but as a whole.

https://github.com/Zverik/mapnik-group-text

The only parameter, -d, controls the maximum width of a letter, including spacing between letters. The default works for me, but if your labels are tightly packed, or are printed in a very large font, you may need to use that parameter.

Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Discussion

ایہہ ؜29؍؜April ؜2014ء ‪12:37‬ تے «Endres Pelka» ٹپݨی کیتی گئی سی۔

It would be better if Mapnik did it on its own when generating SVG.

ایہہ ؜29؍؜April ؜2014ء ‪13:33‬ تے «Zverik» ٹپݨی کیتی گئی سی۔

Of course, hard to argue with that. Sadly I don’t see even tickets in github tracker on that: closest thing is layered svg (which tilemill still does not produce). I’ve opened issue 2229.

ٹپݨی چھڈݨ واسطے لوگ‌این کرو