JOSM/Plugins/ImportVec

From OpenStreetMap Wiki
< JOSM‎ | Plugins
Jump to navigation Jump to search
JOSM with Ubuntu logo imported from SVG

ImportVec allows you to import SVG files into JOSM.

Example for a circle:

  • Use a suitable graphics program (e.g. Inkscape) to create a picture of a circle 100 pixels in diameter and save it as SVG. Alternatively download 'Circle100.svg' sample file
  • In JOSM select "File->New Layer"
If you're getting data from SVG to put into OpenStreetMap then you would download the relevant area of the map at this stage, but for now let's just start a blank data layer.
  • Select the file with "File-> Open..."
  • Set the size ratio
For this example the circle is 100 pixels wide. With 1:1 scale selected, you will get in a circle 100 meters in diameter in JOSM, with 2:1 selected you would get a 50 meter wide circle, with 1:2 selected you would get a 200 meter wide circle, etc.
  • Set "Curve steps"
This lets you control the number of nodes generated to represent curved lines (i.e. arcs of circles, and quadratic or bicubic splines) of the SVG.
For our circle SVG, choosing "1" would give you a square, "2" an octagon, "3" starts to look more circular (in other words the angles in corners of the polygon generated from a circle will be set to a minimum of 90/2curve steps degrees, i.e. 90° for 1 curve step, or 45° for 2 curve steps, or 22.5° for 3 curve steps, or 11.25° for 4 curve steps, or 5.625° for 5 curve steps; the default number of curve setps is set to 4, so a circle would be converted to a closed polygon with 16 straight vertices connecting 16 nodes).
Generally you would want to adjust this to a higher number if your SVG has larger diameter curves. Try to follow OpenStreetMap norms for the number of nodes you use.
Note that existing straight segments of polygonal paths in the SVG are not affected by this setting.
  • Click OK to run the import
  • Move and resize
The SVG data is initially placed centrally on the visible map area. Select the data and drag to move it to the right place. You can also make scale adjustments by holding down Ctrl and Alt keys while dragging.
  • Upload or export
JOSM treats the new data as if you had drawn new nodes and ways in the editor, so you can click 'upload' to send the data to the OpenStreetMap database and have it appear on the map (you'll need to add tags first too) Don't do this if you were just messing around! Don't do it if you just wanted to convert the data. You can save the data layer from JOSM to a .osm file for processing elsewhere.