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(http://svn.openstreetmap.org/applications/rendering/osmarender), and store those files in the folder Osmarender.
3, New a foler named osm, put the osm.data, 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 http://xml.apache.org/xalan-j/downloads.html, 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:

Regards.

                                                                                                                                                                                                 tao

Hi,
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:

//xalan
        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
            e.printStackTrace();
        }
        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
            e.printStackTrace();
        }

The data.osm file is this one: http://yourfiles.to/?d=566EE7C215
And the SVG file is that one: http://yourfiles.to/?d=C0831E3224

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