OSM (.osm)

Background & Context

    • Vector map format.
    • Commonly used to store and distribute vector geo primitives for map rendering.
    • XML-based text format. A binary form is also available, based on PBF.
    • It saves data in the form of "nodes" (points), "ways" (connections) and "relations" (properties).
    • OSM is an acronym derived from OpenStreetMap.
    • Developed by the OpenStreeMap project.

Import

  • Import["file.osm"] imports the data associated to the vector geo primitives stored in the given file.
  • Import["file.osm",elem] imports the specified element from a OSM file.
  • Import["file.osm",{{elem1},{elem2},}}] imports multiple elements.
  • The import format can be specified with Import["file","OSM"] or Import["file",{"OSM",elem,}].
  • See the following reference pages for full general information:
  • Importimport from a file
    CloudImportimport from a cloud object
    ImportStringimport from a string
    ImportByteArrayimport from a byte array

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • Data representation elements:
  • "Data"graphics primitives for each layer
    "Graphics"all layers combined into a single graphics object
    "GraphicsList"list of graphics representing the layers of an OSM archive
  • Import by default uses the "Graphics" element for the OSM format.
  • Import["file","Data"] returns an expression of the form {layer1,layer2,} . Individual layers are given as a list of rules representing the geometry, as well as numerical and textual information associated with the features.
  • Metainformation elements:
  • "LayerNames"all layer names, given as a list of strings
    "LayerTypes"what graphics primitives comprise each layer
    "SpatialRange"range of geographic coordinates, typically given in decimal degrees
  • Elements representing the geodetic datum and reference ellipsoid used in the file:
  • "CoordinateSystem"name of the coordinate system used in the file
    "Datum"geodetic datum
    "SemimajorAxis"semimajor axis of the reference ellipsoid
    "SemiminorAxis"semiminor axis of the reference ellipsoid
    "InverseFlattening"inverse flattening of the ellipsoid
    "LinearUnits"coordinate system units
  • Elements specifying the cartographic projection and its parameters:
  • "Projection"projection name and parameters
    "Centering"latitude and longitude defining the origin of the projection
    "StandardParallels"standard parallels
    "CentralScaleFactor"scale factor at the central meridian or center of projection
    "GridOrigin"grid coordinates {n,e} of the central parallel and meridian
    "ProjectionName"Wolfram Language standard name of the projection used
    "ReferenceModel"what reference sphere or ellipsoid to use
  • Accessing low-level metainformation from the file:
  • "CoordinateSystemInformation"raw parameters of the coordinate system as stored in the file
  • See the reference page for GeoProjectionData for full information on cartographic projections.

Options

Examples

open allclose all

Basic Examples  (1)

Import all layers from an OSM file:

Scope  (1)

Import simultaneously the datum and the list of layer names:

Import Elements  (21)

Available Elements  (1)

List of available import elements:

Data Representation  (3)

"Data"  (1)

Import of the full dataset:

"Graphics"  (1)

Import the full set of graphics primitives and represent them using GeoGraphics. This is the default:

"Graphics" is the default element:

"GraphicsList"  (1)

Import a list of different geo primitives, in this case points, lines, multilines and polygons:

Metadata  (3)

"LayerNames"  (1)

Import the list of layers:

"LayerTypes"  (1)

Import the geometric type of each layer:

"SpatialRange"  (1)

Import the geodetic bounds in the form {{latmin,latmax},{lonmin,lonmax}}:

Datum and Reference Ellipsoid  (6)

"CoordinateSystem"  (1)

Name of the cartographic coordinate system, with None representing unprojected data:

"Datum"  (1)

Name of the datum:

"SemimajorAxis"  (1)

Length of the semimajor axis of the datum's reference ellipsoid:

"SemiminorAxis"  (1)

Length of the semiminor axis of the datum's reference ellipsoid:

"InverseFlattening"  (1)

Inverse flattening of the datum's reference ellipsoid:

"LinearUnits"  (1)

Units of the cartographic coordinates:

Cartographic Projection  (7)

"Projection"  (1)

Name and parameters of the cartographic projection, with None representing unprojected data:

"Centering"  (1)

Centering of the cartographic projection, with None representing unprojected data:

"StandardParallels"  (1)

Standard parallels of the cartographic projection, if any:

"CentralScaleFactor"  (1)

Central scale factor of the cartographic projection:

"GridOrigin"  (1)

Grid origin of the cartographic projection:

"ProjectionName"  (1)

Name of the cartographic projection:

"ReferenceModel"  (1)

Reference model of the cartographic projection:

Low-Level Metainformation  (1)

"CoordinateSystemInformation"  (1)

Information about the cartographic reference system using the WKT specification:

Applications  (1)

Extract geometric data from an OSM file:

Separate the different geometric primitives:

Represent these primitives in a map: