Convert OSM data to SVG data

Hi, all,
I want to convert the OSM data to SVG data, I searched Wiki.Openstreetmap website, and used the Osmarender to convert the data. I follow those steps:
1, Download the OSM data specified by a region, named the osm data data.osm.
2, Download all the individual files from the the Subversion repository(, and store those files in the folder Osmarender.
3, New a foler named osm, put the, osm-map-features-z17.xml(copy from the folder Osmarender) and osmarender.xsl(also copy from the folder Osmarender) in this folder.
4, Download the application xalan from, and extract it under the folder xalan-j_2_7_1.
5, open the MS-DOS prompt, cd to the directory osm which contains the data.osm,osm-map-features-z17.xml,and the osmarender.xsl.
6, Run the following command: F:\osm>java -cp F:xalan-j_2_7_1\xalan.jar org.apache.xalan.xslt.Process -in osm-map-features-z17.xml -out map.svg

After all those steps, it will generate the SVG data named map.svg. But there exists several problems:

  1. when the size of the osm data is a little larger, say more than 5M, the conversion will get an warning:popContextNodelist when stack is empty! java.lang.ArrayIndexOutOfBoundaryException: -1. So I just wonder how to fix it? Thanks.
  2. when the size is appropriate, say less then 1M, the conversion is ok, But when I open the file map.svg directly in Firefox(the file version is 4.42), there is nothing to see. After a careful observation, there is a little rectangle bounding box with a certain background color in the upper left corner of the screen. Could anyone help me? Many thanks.

So I failed in this conversion, :frowning: Could anyone help me to fix it? Or is there any other tools that could Convert the OSM data to SVG data robustly? I need your help, However, Any suggestion is welcome! Thanks in advance!:slight_smile:



I just want to bring this topic up again, because I have exactly the same problem. However, I am writing a Java app myself, so I am not using the command line tool. The data.osm is about 528 KB, it is a part of an inner city. The resulting SVG is 293 KB, and contains a lot of tags. Still, nothing to see with Firefox, Irfanview, Batik Java library but a light blue/greyish rectangle.

Looking forward to your help.

Here goes my Java code:

        TransformerFactory factory = TransformerFactoryImpl.newInstance();
        Transformer transformer = null;
        try {
            transformer = factory.newTransformer(new StreamSource(new File("lib\\osmarender.xsl")));
            transformer.setParameter("verbose", true);
        } catch (TransformerConfigurationException e) {
            // TODO Auto-generated catch block
        try {
            transformer.transform(new StreamSource(new File("lib\\osm-map-features-z17.xml")), new StreamResult(new File("out.svg")));
        } catch (TransformerException e) {
            // TODO Auto-generated catch block

The data.osm file is this one:
And the SVG file is that one:

Does anyone have an idea, why I can’t see anything???