GRASS logo

NAME

v.osm.import.tag - Extracts all data selected by an OSM tag (through the Overpass API as inpuit source) within a specified area (geojson or vector in GRASS as input) and outputs a geojson and a vector file in GRASS.

KEYWORDS

vector, roads, OSM

SYNOPSIS

v.osm.import.tag
v.osm.import.tag --help
v.osm.import.tag [-pf] [aoi_map=name] [geojson=name] osm_tag=string[,string,...] [attributes=string[,string,...]] output=name [retries=integer] [tool=string] [--overwrite] [--help] [--verbose] [--quiet] [--ui]

Flags:

-p
Convert lines to polygons; Attention: This works only if the polygon contains only one LineString!
-f
Allow failing query or rather no matching feature found. If this flag is not set, the module will fail if no matching feature is found for the query. If the flag is set, the module will continue without output generation (Reasonable if sure that query is correct, but aoi_map might not contatin requested query).
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Parameters:

aoi_map=name
Name of input vector map
Existing vector AOI map in GRASS as input
geojson=name
Name of AOI geojson file as input
osm_tag=string[,string,...] [required]
OSM tag for querying a specific part of OSM data(form: 'way["highway"]')
attributes=string[,string,...]
Keys from OSM tags which shall be extracted for attribute table of output vector (e.g. surface,access,...)
output=name [required]
Output name of processing result vector map
retries=integer
Number of times to retry the Overpass API query. Default: 4
Default: 4
tool=string
Tool to download OSM data. Options: overpass, osmnx. Default: overpass
Default: overpass

Table of contents

DESCRIPTION

v.osm.import.tag extracts data from OpenStreetMap by using a specific OSM tag. This is possible by using the Overpass API as input source or by "incomplete polygon" in the data OSMnx. As input area of interest you can use a vector in GRASS GIS or an external geojson file. While using an OSM tag satisfy the necessary pattern. OSM-GPT can be used to find the corresponding OSM tag.

EXAMPLES

Download OSM "highways" and store as a GRASS vector map

Download OSM "highways" by their OSM tag('way["highway"]') in a specific area by using an existing vector map (area_of_interest) and defining an output name (highways).
v.osm.import.tag aoi_map=area_of_interest osm_tag='way["highway"]' output=highways

Download OSM "highways" in a specific area defined by a geojson file

Download OSM "highways" by their OSM tag('way["highway"]') in a specific area by using a geojson file (area_geojson) and defining an output name (highways).
v.osm.import.tag geojson=area_geojson osm_tag='way["highway"]' output=highways
The OSM tag has to follow the pattern 'way["highway"]' and can contain various keys and values.

Download all amenities in a given area

The following example would download all amenities in a given area.
v.osm.import.tag geojson=area_geojson osm_tag='node["amenity"]' output=amenities

Combination of a key and a value

For specifying your query you can use a combination of a key and a value. For example use 'way["amenity"="hospitals"]' for downloading all hospitals in your area of interest.
v.osm.import.tag geojson=area_geojson osm_tag='way["amenity"="hospitals"]' output=hospitals

Combination of multiple OSM tags

For specifying your query you can use multiple OSM tags. For example use 'way["amenity"="parking"],way["parking"="surface"]' for downloading all parking areas, which are either tagged with ["amenity"="parking"] or ["parking"="surface"] in your area of interest.
v.osm.import.tag geojson=area_geojson osm_tag='way["amenity"="parking"],way["parking"="surface"]' output=parking

Specify attributes for attribute table of output vector

In order to only keep attributes of interests in the table of the output vector, specify keys of OSM Tags in attributes=[...] (e.g. attributes=amenity,parking,access)
v.osm.import.tag geojson=area_geojson osm_tag='way["amenity"="parking"],way["parking"="surface"]' attributes=amenity,parking,access output=parking
Beware of using the right data type (node, way, relation) provided in OSM. Sometimes there is more than one datatype for the same OSM tag. For example, hospitals are mapped as polygons and points sometimes so you should use the respective data types to be sure that you get all mapped features related to your tag. Find your tag at the OSM Wiki!

Importing parking spaces as polygons

The parking spaces can be imported as polygons with the -p flag. ATTENTION: This works only if the polygon contains only one LineString!
v.osm.import.tag geojson=area_geojson osm_tag='nwr["amenity"="parking"],nwr["parking"="surface"]' output=parking_poly -p

REQUIREMENTS

The following python libraries are used: If not already done install the overpass package using:
    pip install overpass osmnx shapely
On Alpine for OSMnx proj-dev is required.

SEE ALSO

v.in.osm, v.out.geojson

AUTHORS

Johannes Halbauer, mundialis GmbH & Co. KG, Germany
Jonas Pischke, mundialis GmbH & Co. KG, Germany
Anika Weinmann, mundialis GmbH & Co. KG, Germany

SOURCE CODE

Available at: v.osm.import.tag source code (history)

Accessed: Sunday Nov 15 11:08:54 2026


Main index | Vector index | Topics index | Keywords index | Graphical index | Full index

© 2003-2026 GRASS Development Team, GRASS 8.5.1dev Reference Manual