لوگوی OpenStreetMap اوپن‌استریت‌مپ

Grouping Mapnik's labels

ارسالی از Zverik در 29 آوریل 2014 به English.

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

نظر از Endres Pelka در 29 آوریل 2014 ساعت 12:37

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

نظر از Zverik در 29 آوریل 2014 ساعت 13:33

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.

برای نظردادن وارد شوید