[OSM-dev] Re: [OSM-talk] Osmarender 1.3 with support for symbols and nested rules
richard at systemeD.net
Tue Apr 11 09:15:33 BST 2006
(moved from talk to dev)
> On 4/11/06, Etienne Cherdlu <openstreetmap-L at gj0.net> wrote:
>> Funny you should ask that... I've just spent the last couple of hours
>> reading the SVG specs about text on a path, with this very much in
>> It looks feasible, so I'll be having a go at it in the next few days.
>> One problem is that not all SVG viewers have implemented textPaths,
>> so it will be necessary to use the Adobe SVG viewer or something else
>> to actually see the street names.
> First of all I don't think you really need textpath, just rotate the
> name to fit the direction of the street. That's doable without
> textpath, but might be harder to figure out.
I've had the same problem when playing with rendering road names in
(similarly) can rotate text but not run it along a path.
It's not an issue when you've got a nice, long, straight path (e.g. Oxford
Street in London), but is more complex when the road curves (e.g. Shaftesbury
Avenue) - in this case, just rotating the text will result in one end being on
the road and one end being off.
What you _can_ do is render the text letter-by-letter, each with a different
rotation. (Obviously you'll need a table of character widths for this to work.
Flash does provide a 'get character width' function, but I'm not sure how this
would be done in SVG, and efficiency would dictate that it was pre-calculated
> A harder problem is placing the names, so they don't overlap...
Yeah, automated label placement is a very old cartographic chestnut. ;)
One solution is to place names in priority order (i.e. write major
first, so Oxford Street before Shaftesbury Avenue). When you try to place a
street name that overlaps with a previously-placed one, try moving it
street (in either direction) until it doesn't overlap. If you run out
then omit the label. (Presumably you can do mouseover 'tooltips' in SVG for
occurences like these?)
For a frequently-viewed map (e.g. London or any other city centre) at a
frequently-viewed scale, there's a lot to be said for manual hinting - i.e.
storing our own suggested placements for each road label, rather than relying
on the server to do it all.
More information about the dev