GeoDataGetter

This class is used to retrieve geospatial data from OpenStreetMap (OSM) based on given OSM ID and tags.

class soika.src.utils.data_getter.geo_data_getter.GeoDataGetter[исходный код]

This class is used to retrieve geospatial data from OpenStreetMap (OSM) based on given OSM ID and tags.

Methods: - get_features_from_id: Retrieves features from the given OSM ID using the provided tags and OSM type, and returns the results as a GeoDataFrame. - _get_place_from_id: Retrieves the place from the given OSM ID and OSM type. - _process_tags: Processes the provided tags and returns a list of GeoDataFrames. - _get_features_from_place: Retrieves features from a specific place based on category and tag. - _handle_error: Handles any errors that occur during the process and prints an error message.

static get_city_bounds(osm_id: int) GeoDataFrame[исходный код]

Method retrieves the boundary of a specified city from OSM using Overpass API and returns a GeoDataFrame representing the boundary as a polygon.

static get_drive_graph(city_bounds: GeoDataFrame) MultiDiGraph[исходный код]

Method uses the OSMnx library to retrieve the street network for a specified city and returns it as a NetworkX MultiDiGraph object, where each edge represents a street segment and each node represents an intersection.

static get_features_from_id(osm_id: int, tags: dict, osm_type='R', selected_columns=['tag', 'element_type', 'osmid', 'name', 'geometry', 'centroid']) GeoDataFrame[исходный код]

Get features from the given OSM ID using the provided tags and OSM type, and return the results as a GeoDataFrame.

Параметры:
  • osm_id (int) – The OpenStreetMap ID.

  • tags (dict) – The tags to filter by.

  • osm_type (str, optional) – The OpenStreetMap type. Defaults to «R».

  • selected_columns (list, optional) – The selected columns to include in the result GeoDataFrame.

  • ['tag' (Defaults to)

  • 'element_type'

  • 'osmid'

  • 'name'

  • 'geometry'

  • 'centroid'].

Результат:

The GeoDataFrame containing the features.

Тип результата:

gpd.GeoDataFrame

static get_osm_data(osm_id: int, tags: dict) DataFrame[исходный код]

Retrieves spatial data from OSM for given tags using OSM ID and returns a DataFrame.