Osmarender/Tips

From OpenStreetMap Wiki
Jump to navigation Jump to search

By default, Osmarender will give an attractive but imperfect output. This page contains tips and tricks that you might like to try. Feel free to add your own!

Adjusting the whole map

  • See Osmarender/Options for lots of things you can change to alter the appearance of the output.


Adjusting the appearance of ways

  • If ways appear too narrow or chunky, as they might on a small or large area map, adjust the scale property of the <rules> element. (A smaller scale will give bigger features, a larger scale will give smaller features)
    • Use a smaller scale for large area maps, eg 0.3
    • Use a larger scale for small area maps, eg 1.5
    • If your map is looking too sparse (roads too small compared to the gaps between them), decrease the scale factor
    • If your features are overlapping each other too much, increase the scale factor
  • If way names aren't centred in the way (i.e. the overlap with the way casing), adding dy="0.33px" to each rule for road names should fix it. For example:
    • <text k="name" dy='0.33px' text-anchor='middle' startOffset='50%' class="highway-unclassified-name" />
  • If way names don't fit into the ways (e.g. the ways are too short), or if you adjust the font properties (font-size, font-weight, etc.) of the way-type-name CSS definition.
  • If your way names are upside down, you can try to use the tag osmarender:nameDirection=-1 on a way to get the name to render the other way up. Generally Osmarender renders names properly, but with roads going in a circle this might help.
  • [obsolete] If your road names are garbled, ensure that your way has all the segments in the correct, sequential order, and that all the segments point in the same direction
    • In JOSM, you can turn on the display of segment direction in the preferences, there is also a menu command to turn segments around and to order segments in a way.
  • You can adjust particular ways by adding tags to them in your map editor, e.g. add svg:font-size=0.5 to make a way's name appear smaller than others, or svg:fill=red to highlight the road by filling it with red rather than the default. Only do this in your local copy, do not upload these tags!
  • [obsolete] If you find triangular gaps where two segments inside a way join at an angle then you probably have ways with unordered segments. Go into JOSM and use the "order segments" menu option to fix this.
  • [obsolete -- ancient Osmarender no longer works at all] If you find triangular gaps where two ways join at an angle then you should make sure you have version 3.0 or later of Osmarender. A number of bugs relating to cracks in roads were fixed in this version. If you still have the problem change the appropriate line styles in your osm-map-features.xml to use rounded rather than butted ends - see this mailing list posting for details. This does have the side effect of making cul-de-sacs have rounded ends however.
  • To disable the bezier curves on a way (e.g. power lines) add the pseudo class "no-bezier".

Misc

  • Open the SVG up in an editor like Inkscape once it's created to manually fix any small bugs, such as amenity names overlapping with ways.
  • Firefox 2.0 and above, Internet Explorer/Adobe SVG viewer and Inkscape do render street names, Firefox 1.5 did not.
  • If you create a thematic map (e.g. a railroad map) it's very likely that your SVG file contains garbage (unused paths). Open the file with Inkscape, choose "File" -> "Vacuum defs" from the menu and save. This sometimes saves a lot of space. (Note: This is because current version of Osmarender creates a path definition for every way before it knows what needs rendering - I'll try to improve this in the next versions 80n 11:28, 26 Aug 2006 (BST))
  • Ever wondered, why SVG stroke-linecap don't work with other than 'round'? This is the smart-linecap feature of osmarender/orp: you have to set the attribute smart-linecap="no" on the line drawing tag. --Andy 17:34, 29 March 2008 (UTC)