File talk:Greater London Osmarender.png

From OpenStreetMap Wiki
Jump to: navigation, search

Nice render Etienne. You will need a new set of tyres to fill in the gaps :-) There is a lot of data there. Can you confirm the process you used to: 1. Obtain the xml 2. Convert to SVG (ie is it the full Osmarender or did you reduce the scope?) 3. What software you used to create the png from the svg

Useful to know in general but my real reason for the questions is simply that I run into problems when trying to render realy large SVG's (large amount of original xml data) Blackadder 23:29, 2 Sep 2006 (BST)

How this image was made

This image was made on a laptop running Windows XP with a 2Ghz processor and 512Mb memory.

  1. Download
    1. First I downloaded the data into JOSM, but I did it in chunks. Smaller chunks where I knew that there were a lot of segments, bigger chunks where I knew the data was sparse. With the latest server performance improvements this is not such as challenge as it used to be.
    2. Next I saved the file locally as GreaterLondon.osm
  2. Processing
    1. Then I pre-processed the file using normaliseNumbers.xsl. There are a few nodes near the Greenwich meridian that are served up in an exponential format that Osmarender does not recognise, so I do this to convert them to canonical numbers.
    2. I then ran Osmarender using the following command line:
      • java -cp xalan.jar -Xmx200000000 org.apache.xalan.xslt.Process -in data.osm -out osm.svg -xml
      • Because of the size of the file -Xmx200000000 is needed to increase the java maximum heap size to 200Mbytes
    3. I used a standard osm-map-features.xml file with scale=0.3
  3. Rendering
    1. The resulting osm.svg file was initially rendered in Internet Explorer with the Adobe SVG viewer plug-in. I switched to full screen mode (F11) so that the map filled the screen.
    2. I then manually adjusted the view (using ctrl+click and ctrl+shift+click to zoom-in and zoom-out) until I was happy that it was framed nicely on the screen.
  4. Convert to png
    1. Press Alt+PrtSc to grab the screen contents into the paste buffer
    2. Start Gimp and create a new file with a size of 1280 x 800 pixels (which are the dimensions of my screen).
    3. Ctrl+V to past the image into Gimp
    4. And finally Save As... GreaterLondon.png


Are you sure it was a standard osm-map-features.xml file ? Because at me it doesn't render the Thames river... FredB 00:53, 3 Sep 2006 (BST)

You are right, I have a slightly modified version of Osmarender.xsl which fixes a bug to do with areas (ways) that are made from non-contiguous segments. I also have a rule for riverbanks:
 <rule e="way|area" k="waterway" v="riverbank">
   <area class='waterway-riverbank'/>
 </rule>


 .waterway-riverbank {
   fill: #89bac6;
   stroke: #aaaaaa;
   stroke-width: 0.0;
 }

The bug fix to Osmarender.xsl is to replace <xsl:template name='generateAreaPath'>...</xsl:template> with:

 <xsl:template name='generateAreaPath'>
   
   <xsl:variable name='pathData'>
     <xsl:for-each select='seg[key("segmentById",@id)]'>
       <xsl:variable name='segmentId' select='@id'/>
       <xsl:variable name='linkedSegment'
         select='key("segmentById",@id)/@from=key("segmentById",preceding-sibling::seg[1]/@id)/@to'/>
       <xsl:variable name='segmentSequence' select='position()'/>
       <xsl:for-each select='key("segmentById",$segmentId)'>
         <xsl:if test='$segmentSequence=1'>
           <xsl:call-template name='segmentMoveToStart'/>
          </xsl:if>
          <xsl:if test='not($linkedSegment)'>
            <xsl:call-template name='segmentLineToStart'/>				
          </xsl:if>
          <xsl:call-template name='segmentLineToEnd'/>
        </xsl:for-each>
     </xsl:for-each>
     <xsl:text>Z</xsl:text>
   </xsl:variable>
   
   <path id="area_{@id}" d="{$pathData}"/>
 </xsl:template>
80n 01:38, 3 Sep 2006 (BST)
Great feedback 80n, thanks. Blackadder 10:45, 3 Sep 2006 (BST)