OSMOnlineLoader
srai.loaders.OSMOnlineLoader ¶
Bases: OSMLoader
OSMOnlineLoader.
OSM(OpenStreetMap)[1] online loader is a loader capable of downloading objects from a given area from OSM. It filters features based on OSM tags[2] in form of key:value pairs, that are used by OSM users to give meaning to geometries.
This loader is a wrapper around the osmnx
library. It uses osmnx.geometries_from_polygon
to make individual queries.
Source code in srai/loaders/osm_loaders/osm_online_loader.py
load ¶
load(
area: Union[
BaseGeometry, Iterable[BaseGeometry], gpd.GeoSeries, gpd.GeoDataFrame
],
tags: Union[OsmTagsFilter, GroupedOsmTagsFilter],
) -> gpd.GeoDataFrame
Download OSM features with specified tags for a given area.
The loader first downloads all objects with tags
. It returns a GeoDataFrame containing
the geometry
column and columns for tag keys.
Some key/value pairs might be missing from the resulting GeoDataFrame,
simply because there are no such objects in the given area.
PARAMETER | DESCRIPTION |
---|---|
area
|
Area for which to download objects.
TYPE:
|
tags
|
A dictionary
specifying which tags to download.
The keys should be OSM tags (e.g.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GeoDataFrame
|
gpd.GeoDataFrame: Downloaded features as a GeoDataFrame. |