TOOL Import OpenStreetMap Blender

Discussion in 'Modding' started by Luchian, May 16, 2016.

  1. Luchian

    Luchian Administrator Staff Member Concurent RLR

    Joined:
    Jun 3, 2014
    Messages:
    1,107
    Likes Received:
    279
    [justify]The addon imports building outlines, roads and paths from a file in the OpenStreetMap format (.osm). OSM objects can be imported as flat Blender objects or as extruded ones with the specified thickness. Either new custom properties latitude and longitude are set for the active Blender scene or previous values of the custom properties latitude and longitude are kept. In either case the Blender scene is said to be georeferenced.

    [​IMG]

    Installation
    Download the latest version of the addon io_import_scene_osm.py and install it via the usual Blender way:

    • File → User Preferences... → Addons → Install from File...
    • Find the file in your file system and press Install from File... button
    • Enable the addon by checking the Enable an addon
    Donations
    If you find the addon useful, please consider making a donation:

    [​IMG]

    DISCLAIMER: This tool and all the information is available on Github. If you like it and wish to thank the author, you can do so by making a donation. Donation link above goes to the author, there's no affiliation with our site. We are just sharing it because it's relevant "in our line of business".

    Preparation
    Prepare a file in the OpenStreetMap format (.osm) limiting its extent to a small area of interest. You can use the JOSM editor to download OSM data, edit and save it to the .osm file.

    It's recommended to import OSM data to a Blender layer different from the layer where the model itself is located. Make the layer for the OSM data the only visible layer, by pressing the key with the layer number.

    Usage
    • File → Import → OpenStreetMap (.osm)
    • Find the file in your file system
    • If Ignore existing georeferencing checkbox is checked, existing georeferencing is ignored and a new one is maked
    • If Import as a single mesh checkbox is checked, OSM objects are imported as a single mesh instead of separate Blender objects. This option makes sense if you are going to import a file with thousands of OSM buildings
    • Check the Import buildings checkbox to import building outlines
    • Check the Import roads and paths checkbox to import roads and paths as edges
    • Optionally set a non-zero thickness to get extruded objects instead of flat ones
    • Press Import OpenStreetMap button
    [​IMG]

    Details
    The transverse Mercator projection with the central meridian coming through the center of the imported area is used for the import. The projection choice is explained by the negligible size distortion in the vicinity of the central meridian.

    All imported OSM objects will be parented to an empty Blender object with the same name as the imported OSM file (map.osm on the image below):

    [​IMG]

    The name of each imported OSM building is composed in the following way:
    • tag name if provided (The Church of Our Lady on the image above), otherwise
    • tags addr:housenumber and addr:housenumber if provided (South street, 5 on the image above)
    Objects from a subsequent OSM file import will be parented to a separate empty Blender object with the corresponding OSM file name.

    All OSM tags of each imported OSM object are set as Blender custom properties for the object in question:

    [​IMG]

    If the active scene does not have custom properties latitude and longitude or if Ignore existing georeferencing checkbox is checked, custom properties latitude and longitude are set for the active scene. They correspond to the center of the imported OSM objects. OSM objects skipped from the import are also skipped from the calculation of that center.

    If the active scene does have custom properties latitude and longitude and Ignore existing georeferencing checkbox is unchecked, the custom properties latitude and longitude are used as the center for the import. In other words, the newly imported OSM objects will be placed correctly with respect to previously imported OSM objects.[/justify]

    To delete all OSM objects from a specific import:
    • find and select their parent object in the Outliner,
    • from the context menu choose Select Hierarchy,
    • delete the selected objects via usual Blender way by pressing X key
     

Share This Page