From OpenStreetMap Wiki
Jump to navigation Jump to search

grouped SVG symbols and relative co-ordinates

I'm trying to work out how to tweak it to be able to construct compound symbols for nodes, (for example. a church might look like a circle with a cross on top of it), a car park might be a white P on a blue rounded rectangle background, but can't work out how to do relative co-ordinates.

I don't know either, yet. I've been working on a method for marking one-way streets, etc. Using a <marker> element to define an arrow but need to figure out how to size it relative to the width of the line it is on. If I get it worked out I'll let you know. 80n 18:38, 5 Apr 2006 (UTC)
The current version of Osmarender has an implementation of a symbol for a church. You should be able to use that as an example. Also Sodipodi has a collection of public domain SVG map symbols that may be useful. 80n 12:41, 13 Apr 2006 (UTC)

segments and ways with no keys

I'm sure that it used to have a default method of dealing with segments and ways without any key/value defined that matches something in osm-map-features.xml. This doesn't seem to work at present. It doesn't draw any casings or fill (though ways defined with a valid "abutters" key get the surrounding shading applied)

A rule that has k="~" v="~" will match any segment or way that has no tags at all. In osm-map-features.xml there is a commented out debug rule that will render all untagged elements as a thin red lines:
  <rule k="~" v="~">  
    <line class='debug'/>
You can also use k="something" v="~" to match any element that has a key of something whatever it's value. This is useful for making a default rendering of user-defined values. 80n 13:21, 3 May 2006 (UTC)

logo on small maps

On small maps, the logo and attribution info take up a very large amount of space (and sometimes don't even all fit on). Might it be possible to compute a scaling factor for their size, based on the size of the map data downloaded? Gagravarr 16:38, 4 Jun 2006 (UTC)

The next version will include a dynamically positioned logo top left that stays the same size and location (relative to the screen) whatever zooming or panning that is done. It uses javascript to do this but don't know what will happen if javascript is not enabled or not supported by the SVG viewer. 80n 19:11, 4 Jun 2006 (UTC)
There should be an option to disable the logo and attribution info at all. -- Eckhart 16:51, 29 September 2006 (BST)
There is an option to disable the copyright and/or attribution info. 80n 20:01, 29 September 2006 (BST)

How do Iget Osmarender to work (Also Problems)

I could not reproduce this on Linux:

  • First Try Firefox:

(Could not load the Url,51.3,-0.4,51.4). Waiting for long time. Also a wget dont work:

Actually it no longer works (for the area given above), and there is hardly any downloading going on. Bruce89 19:33, 16 Jun 2006 (UTC)
I enter the account details, and then the Firefox waiting symbol rotating all the times. Sven Anders 19:03, 16 Jun 2006 (UTC)
I realise it could just be the fact the server is very slow, it might take 30 minutes for an area that size to download. Bruce89 19:33, 16 Jun 2006 (UTC)
  • Second Try Xalan:

(used a osm File from JOSM)

sven@machine:~$ java -cp  xalan-j_2_7_0/xalan.jar org.apache.xalan.xslt.Process -in osm-map-features.xml -out data.svg
(Fehler befindet sich an unbekannter Stelle)XSLT-Fehler (javax.xml.transform.TransformerConfigurationException): getAssociatedStylesheets failed
The standard version expects a file named data.osm, if it is called josm2.osm then that might be the problem... 80n 18:22, 15 Jun 2006 (UTC)
No i renamed it before.This is not the Problem Sven Anders 19:03, 16 Jun 2006 (UTC)
when giving debug messages type "LANG=C; ava -cp xalan-j_2_7_0/xalan.jar org.apache.xalan.xslt.Process -in osm-map-features.xml -out data.svg" instead since the message will be in English then. Erik Johansson 13:02, 1 Jul 2006 (UTC)
  • Third try xsltproc.
xsltproc Osm-map-features.xml josm2.osm >map.svg
compilation error: file osmarender.xsl line 7 element rules
xsltParseStylesheetProcess : document is not a stylesheet
compilation error: file Osm-map-features.xml line 10 element rules
xsltParseStylesheetProcess : document is not a stylesheet

Need Help! Thank you Sven Anders 08:26, 15 Jun 2006 (UTC)


It would be good if we could suggest a formula for working out the best projection to use (probably based on the latitude, and some sort of trig function). Gagravarr 08:48, 29 Aug 2006 (BST)

The right way to do it would be to implement the Mercator projection algorithm ( but that involves trig functions. XSL does not implement any trig functions natively. There are some XSL trig libraries but they all rely on proprietary extensions so don't work with all XSL processors.
A simple hack (that has just occurred to me) would be to find a good projection value for each 5 degrees of latitute and then just include a small lookup table. It wouldn't be perfect but it would be an improvement. 80n 09:30, 29 Aug 2006 (BST)

Rendering several .osm files into one SVG

How hard would it be to make osmarender accept multiple .osm files, which'd go into a single svg?

(I'm thinking of taking the atom feed of pubs from an OpenGuide, passing it through a XSLT to turn it into a .osm file of nodes tagged as pubs, then having this + the normal osm data rendered together onto a single svg). --Gagravarr 20:15, 4 October 2006 (BST)

It should be totally easy. Osmarender makes no assumptions about the ordering of nodes, segments or ways within a source .osm file. Chop out the <osm> and </osm> tags from each file, concatenate them and wrap in a new <osm> tag. That's the non-XML method ;-)
I suspect that there could also be a relatively simple patch to osmarender.xsl that would process a .xml file containing a list of .osm files, but I haven't figured out what that would be yet. 80n 22:15, 4 October 2006 (BST)
Having data.osm say "pull in these 3 files" would seem the cleanest solution to me (with my user hat on) Gagravarr 00:05, 5 October 2006 (BST)

rendering bug: oneway arrows

Does osmarender render arrows at the end of oneway ways? I thought this worked previously but don't see it tonight. Has k=oneway v=yes changed? Rw 03:42, 26 October 2006 (BST)

It still works. Howver, the one-way arrows are tiny and you may not see them unless you zoom in a lot. Also its possible that they can be obscured at the end by the connecting road, especially if it is wider than the size of the arrow (a change to the render order in the rules file might fix that). A larger and clearer arrow is required and possibly some tweaking of the way it is positioned. 80n 07:15, 26 October 2006 (BST)
I noticed the same type of problem. Indeed, sometimes they get obscured but it seems that the arrow is rendered at the end of a way, not in the middle of the vector. You can see it in this map of Leuven (it's not very clear, see the motorway_link at the top left of the image, the arrow is close to the trunk and not in the middle) Cimm 3 November 2006
It doesn't work for me and the reason is a missing xml namespace for the marker elements. See . Jochen Topf 12 December 2006
Fixed in version 3.2. Joto 10:10, 29 December 2006 (UTC)


Can we have support for building = ~ (wildcard, any type of building) in the default osmarender, so new types of building show up immediately rather than waiting for map_features and osmarender to be updated? Ojw 13:01, 6 November 2006 (UTC)

rendering of links

Currently motorway|trunk|primary_links are rendered together with the motorway|trunk|primary ways. I propose rendering the links before the main ways. See these pictures for the problem:

Highway link problem.png Highway link fixed.png

I think the order of drawing should be: primary_link, trunk_link, motorway_link, primary, trunk, motorway

Jochen Topf 9 December 2006

Fixed in version 3.2. Joto 10:09, 29 December 2006 (UTC)

Problem with rendering of paths fixed

osmarender uses paths included with <use xlink...> and sometimes they don't render right. This is a problem for instance with rail lines which should get dotted lines. The reason for that is that the styles are attached to the surrounding <g> element and not the <use> element. explains how this work: The attributes from the <use> elements are copied to a newly created <g> element, NOT the parent <g> element.

The fix for this is pretty easy: Just copy the instructions attribute to the <use> element: <use xlink:href='#way_{$way/@id}'><xsl:apply-templates select='$instruction/@*' mode='copyAttributes' /></use>

Jochen Topf - 9 December 2006

Fixed in version 3.2. Joto 10:10, 29 December 2006 (UTC)

Ideas for rendering oneways

The current rendering of one ways is suboptimal. Using an arrow at the beginning or end auf a way is not enough, there should be several arrows spaced along the path.

I experimented a bit:

  • I have tried using several lines drawn over each other with different stroke-dashed styles to simulate an arrow appearing every so often. This works but looks rather pixelized.
  • An older working draft of the SVG specification allows for any kind of vector graphic to be drawn along a path, but the current spec only allows text to be drawn there. So that doesn't work.
  • I tried using unicode char U+25b6 (forward pointing triangle) several times in a text with spaces in between and drawn this text along a path. This works and doesn't look too bad. But it isn't clear to me how to best fit this into the osmarender xslt stuff.

This shows the unicode arrow stuff:


Creates with this svg: <text text-anchor="middle" class="highway-unclassified-name" style="letter-spacing: 8">

   <textPath xlink:href="#way_4048287" startOffset="0%">▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶ ▶</textPath>

Instead of having all those unicode chars they should be referenced with tref (see ), but I couldn't get that to work with inkscape.

Any other ideas?

-- Jochen Topf - 9 December 2006

How do I get svg tiny?

Hello everybody

I would really like to use the maps on my mobile phone, so I was thinking of tweeking osmarender.xsl in order to make it produce an SVG-TINY file instead of SVG-FULL.

I know I can use Adobe Illustrator to make the conversion from svg-full to svg-tiny. However I would really like to get rid of this extra conversion step.

Since tweeking osmarender.xsl seems a bit overwhelming, I would appreciate any advice (or any existent xsl code) which could help me automatically do the osm->svg-tiny conversion.

Many thanks in advance

Minor problem with rendering of residential roads

When a residential road ends in nothing the grey area around it is just cut straight off, but when it ends on another road it ends with a half-circle that stretches across the connected road. I think this should really be the other way around. The following image shows an example of how it looks.

Karlskoging1 renderprb1.png

In this particular case there are actually no houses in the road ends but that is another story. Karlskoging1 22:34, 19 February 2007 (UTC)

An other problem with this gray areas is, that not always there are residents at both sides:
In this example the residents of course do not live inside the river, but as the river has tag layer=-1 (which makes sense, because it flows below all those bridges) it vanishes next to residential roads. --Kumakyoo 15:50, 31 May 2007 (BST)

Problems with osmarender4

The current (SVN) version of osmarender4 seems to have some problems: The SVG created does not render correctly in Firefox (only a few features like railway stations and tunnels seem to be rendered, streets are not). In Inkscape it renders, but the colours of primary and trunk roads have been exchanged. (Trunk roads should be green, shouldn't they?) Håkon 11:42, 24 February 2007 (UTC)

I believe I have a similar issue. When viewing [[1]] in Firefox, the view is set to osmarender, nothing is displayed at this zoom level of 17. Maplint seems to be switched on by default. When I manually deselect Maplint the map is displayed. A quick solution for me would be if I could force Maplint off. Anyone know how to do this? --Eoin 06:17, 30 January 2008 (UTC)

U-formed street name rendering

U-formed streets sometimes get the name rendered around the bow. The general behaviour is to render the street name at the center of the street. Not that bad, but I wonder if osmarender can learn a more "intelligent" behaviour. A good example can be seen at the Windeckstraße in Karlsruhe Oberreut.

--SlowRider 15:22, 28 February 2007 (UTC)

Issues with clipping and duplicates

Clipping problems with Helsinki

So I've been playing around with Osmarender today, and while I'm generally very impressed, I've run into two significant problems.

  1. Clipping doesn't seen to work very well. Having objects extend outside the selected area is still OK, but eg. in the case of Helsinki (a city on a peninsula, with ocean on west, south and east sides), the clipping of the ocean is terrible: the ocean objects are weirdly merged together, so the southern half of the city is submerged in blue, while the seas are white. See the attached picture (exported from Inkscape).
  2. Many objects, eg. the sea and descriptions of local buildings etc, have identical clones on top. Is there a reason for this?

For reference, I'm using an Osmarender version fresh from SVN, and here's how I generated my map:

mv map\?bbox\=24.907\,60.1519\,24.9795\,60.183 data.osm 
java -cp ../xalan-j_2_7_0/xalan.jar org.apache.xalan.xslt.Process -in osm-map-features-z17.xml -out map.svg

Any help would be appreciated. Jpatokal 14:09, 5 November 2007 (UTC)

For coastlines, you need to run (part of t@h), to get it to make closed sea areas. Morwen 14:16, 5 November 2007 (UTC)
Thanks for the tip! So I downloaded Tiles@home from SVN, ran perl 24.907 60.1519 24.9795 60.183 <../osmarender6/data.osm >../osmarender6/data2.osm (=same bounding box as in the original fetch) and then regenerated the SVG... but the end result is blank and absurdly huge (100x135 *meters* wide!) according to Inkscape, and painfully slow to render and absurdly huge according to Firefox. What am I doing wrong? How do the alternative "tilex/tiley" coordinates work? Jpatokal 16:09, 5 November 2007 (UTC)

Borders of water areas

It seems like all water areas, coast lines etc have a border in the same color at the water body. This makes thin land features that extends into the water appear even thinner example.

There are two solutions to this:

  • Reduce width of border or remove it completely or
  • Change colour of border. That makes users see that there actually is a border. I suggest a darker blue shade.

--Bengibollen 20:43, 16 December 2007 (UTC)

Zoomlevel 18 for Osmarender (20 m/100 ft)

Hi folks, if I'm looking at places like: I'm wondering if there is a plan to introduce an additional zoom level to osmarender? Cheers --Morray 15:25, 27 June 2009 (UTC)

I would also like such a thing. Cyclemap,mapnik and noname has 20 m/100 ft zoom level even if cyclemap replaces (in most places) such zoom level tiles with blank white tiles. Then anyone who wants to render such tiles could enable any extra options in osmarender.
I guess anyone who really wants this to be done(me, you, anyone) needs to devote lots of time for that, or ask someone else to devote lots of time for it. (hopefully someone who thinks it's a neat idea) Logictheo 08:51, 8 August 2009 (UTC)
The source code is free to get I think. If I, you or anyone else is interested we just change it so it includes zoom level 18, right? logictheo 15:02, 4 September 2010 (BST)
I added a ticket here: . If you want, you may comment. logictheo 16:30, 4 September 2010 (BST)
I couldn't right now find where it was said, but the admins think the amount of additional data to be uploaded, stored and served would seriously slow down the currently available zoom levels. When disk/memory/network i/o is the worst bottleneck, multiplying the data would be unfeasible. Alv 22:12, 4 September 2010 (BST)
Reading at Slippy_map_tilenames#Zoom_levels I see that Z18 "68.719.476.736" tiles is much more(~x4) compared to Z17 "17.179.869.184" tiles. Hmm, so I guess the only way would be to make a separate decentralised project for zoom level 18 that uses osmarender(data stored on clients computers). Phantasy name "TileZ18@home". I just noted down a project that even I might not be able to handle. Those interested in Z18 could get involved maybe(that inlcudes me, duh). That would be ideal. :) logictheo 13:51,13:57, 12 September 2010 (BST)

RDF description of maps created with Osmarender

While developing my label placement optimization tool OSMLabelOptimizer I noticed that it's not trivial to reconstruct the mapping information (such as which label belongs to which feature, which streets are connected or even which svg element draws the street) from the svg file. Finally I managed to do this, but it would be much easier if some more information about the map is included in the svg file. My idea is to do this with RDF ( Using this in combination with we could describe the whole svg map with all available OSM data and additional information. For example we could declare "the svg element with id 'test' draws the way with id '123'" where the last part could link to the linkedgeodata db. Additionally we could add something like "the svg text element with id 'test1' is label of the svg element with id 'test2'". I haven't yet thought about the details, but I think it would be possible to describe the svg map so that other programs could easily do cool things with it (displaying a list of all POI in the svg file, searching for a street name, displaying routes, etc.). What do you think about this? If you think this makes sense for Osmarender, I'd like to help you implement this. I just need a clue where I can put the code so that it is able to create the RDF in parallel to the svg map. -- Esscue 20:58, 23 August 2009 (UTC)

I'm not sure if anybody is interested, but for completeness I would like to link to my user page where I'm going to develop a OWL ontology and OWL description of SVG maps generated with Osmarender: User:Esscue/OsmarenderOWL Have a look at it and send me an email with your opinion! -- Esscue 18:07, 20 September 2009 (UTC)

Osmarender and Great Salt Lake

Osmarender has had problems rendering the Great Salt Lake, Utah for several months. It doesn't draw too little water, but always too much. The excess water always fills the entire tile that is being rendered. If you would like to see it, it is at approximately at W 112.5 N 41. The lake is rather large and there are several tiles around the lake suffer from this problem. I have even made changes in the affected tiles to force rerendering an affected tile, but there is no effect on the apparent bug. The other renderers don't suffer from this problem.

Is this something that I've done to the data, or is this a bug in Osmarender? — Val42 04:55, 25 August 2009 (UTC)

SVG problem: Invalid CSS selection

Dear Osmarender experts,

I use Osmarender with XMLStarlet and get SVG files, which look nice at first glance. However, Adobe's SVG Viewer (3.0) messages "Invalid CSS selection" and Inkscape reports an internal error; both don't display the file. I already tried it using different SVG specifications from W3C but it did not work either. The operating system is Windows Vista. Have you already encountered this problem? Sorry that I can't give you further information up to now as I don't know where exactly the error occurred. --BlackEyedLion 11:43, 13 March 2010 (UTC)

W3C's validator identifies the SVG file as SVG 1.1+IRI, XHTML5+ARIA plus MathML 2.0 (experimental) but does not validate the file as it is interrupted by an internal error. --BlackEyedLion 14:29, 14 March 2010 (UTC)
I just started the conversion process anew - now with XMLSpy: I downloaded osm-map-features-z17.xml and osmarender.xsl, and I put a map file data.osm into the same folder. Then I opened osm-map-features-z17.xml in the XMLSpy and pressed F10. But in one of the first lines of osmarender.xsl two errors occurred:
<msxsl:script language="JScript" implements-prefix="exslt"> this['node-set'] = function (x) { return x; } </msxsl:script> raised Syntax error and Identifier expected.
Thank you for your help!
(OS is Windows Vista, the map data are downloaded via the current API.)

--BlackEyedLion 17:27, 9 April 2010 (UTC)

adding static svg-code via rules-file

Is it possible to add static svg-code to the osmarender-output file? As far as I can see I can only add the given "templates" as drawing instructions like line, area, marker and so on. I would like to add some additional stuff (like a constant border or background). I am able to add svg-code inside of <defs>-tags - but how to do it outside? Jongleur 22:29, 26 May 2010