Osmarender/TextFitting

From OpenStreetMap Wiki
Jump to navigation Jump to search

There is currently a Perl script called osm-svg-beautifier.pl(link broken=osmarender4 directory missing. Closest working link) in the Osmarender subversion directory which will post-process the SVG generated by Osmarender to change street names to better fit on the ways. It also incorporates bezier curves creation. This is still an experimental approach, but feel free to check it out.

Here is an example:

Before (some names don't fit) After (some names abbreviated, some eliminated)
Textfitting-before.png Textfitting-after.png

the (known) issues...

  • needs code to read osmarender styles - currently hard coded to default style
  • needs calibration - I assume each character is equal to the fontsize in width
  • needs non-anglo centric abbreviations, and probably separate conf file for abbreviations
  • can't deal with XML-escaped text. May not be UTF-8 safe either.
  • ugly perl.