[OSM-dev] osm pre-processing API. Was: Re: Intelligent fitting street names in OSMarender

Barry Crabtree barry.crabtree at gmail.com
Sat Mar 10 12:58:19 GMT 2007


On 3/10/07, Robert Hart <Robert.Hart at burohappold.com> wrote:
> Barry/tiles at home crowd,
> Inspired by your lines2curves, I have hacked together a proof-of-concept
> script to fix up names to fit in the ways they are on.
> Basically for each text path, it tries to abbreviate the text so that it
> will fit into the way, or if it can't it hides the text.


 As it works in basically the same way as lines2curves, and needs much of
> the same info, I created a single unified script.
> See http://wiki.openstreetmap.org/index.php/Osmarender/TextFitting
> 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

I thought you could ask for the lengh of a piece of text somewhare

 * 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.

Yep, guess there are a few things to do yet :-)

> p.s. there's a bug in your regex when run on non-uploaded OSM (hint way
> ids can be negative).

This is what happens when you (I) make post-process assumptions.....

Which leads to the bigger question about pre/post processing.

I've been discussing offline with 80n & Jochen about making lines2curves a
preprocessor option to osmarender to add 'hints' to the osm file - so far
it's likely to look something like this:

<osm xmlns:bez=" http://wiki.openstreetmap.org/index.php/User:Dotbaz/bezier"
   <way id='4059458' timestamp='2006-12-07 19:28:11' bezier="yes">
     <seg id='17559084' bez:cp1="node1" bez:cp2="node2" />
     <seg id='17559085' bez:cp1="node3" bez:cp2="node4" />
     <tag k='highway' v='unclassified' />
     <tag k='created_by' v='JOSM' />

Anyway, the advantage of having this as a preprocessing step as has been
pointed out by Frederick, Jochen is that it removes any dependancy on the
format of the osmarender svg. As a pre-process step, it also removes the
dependancy of osmarender as a renderer as well, so other renderers might
make use of it.

I guess what I'm getting at is that lines2curves is likely to appear as a
preprocessing step fairly soon, so what I would like to see happen is a more
general purpose pre-processing plugin setup so that osm data can be passed
through a number of selectable pre-processing 'hinting' steps so that it
gets to osmarender (or whatever application) with a useful set of addtional
attributes/hints added. For example I can see that renderers might want
bezier hints or text size hints, but they would be of no help to a routing

Would it make sense to update the api so that it could do this kind of thing
(or is it in place already!).

Cheers. Baz

Live as if you were to die tomorrow. Learn as if you were to live
forever.  - Gandhi.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20070310/0dcc9c76/attachment.html>

More information about the dev mailing list