Skip to content

openavmkit.utilities.openstreetmap

OpenStreetMap data fetching service.

Wraps osmnx to download tagged OSM features (parks, water bodies, schools, streets, transportation networks, etc.) for a given bounding box, with caching to avoid re-downloading on subsequent runs. Used by the distance enrichment (data.process.enrich.distances) and the streets enrichment (data.process.enrich.streets) when osm: true is configured for a feature.

OpenStreetMapService

OpenStreetMapService(settings=None)

Service for retrieving and processing data from OpenStreetMap.

Attributes:

Name Type Description
settings dict

Settings dictionary

features dict

Dictionary containing internal features that have been loaded

Initialize the OpenStreetMap service.

Parameters:

Name Type Description Default
settings dict

Configuration settings for the service

None
Source code in openavmkit/utilities/openstreetmap.py
33
34
35
36
37
38
39
40
41
42
def __init__(self, settings: dict = None):
    """Initialize the OpenStreetMap service.

    Parameters
    ----------
    settings : dict
        Configuration settings for the service
    """
    self.settings = settings or {}
    self.features = {}

init_service_openstreetmap

init_service_openstreetmap(settings=None)

Initialize an OpenStreetMap service with the provided settings.

Parameters:

Name Type Description Default
settings dict

Configuration settings for the service

None

Returns:

Type Description
OpenStreetMapService

Initialized OpenStreetMap service

Source code in openavmkit/utilities/openstreetmap.py
234
235
236
237
238
239
240
241
242
243
244
245
246
247
def init_service_openstreetmap(settings: Dict = None) -> OpenStreetMapService:
    """Initialize an OpenStreetMap service with the provided settings.

    Parameters
    ----------
    settings : dict
        Configuration settings for the service

    Returns
    -------
    OpenStreetMapService
        Initialized OpenStreetMap service
    """
    return OpenStreetMapService(settings)