Data#
Data Loading and Processing Module.
This module provides comprehensive functionality for loading and processing geospatial data from various sources, with specialized support for Overture Maps data. It handles data validation, coordinate reference system management, and geometric processing operations commonly needed for urban network analysis.
- load_overture_data(area, types=None, output_dir='.', prefix='', save_to_file=True, return_data=True)[source]#
Load data from Overture Maps using the CLI tool and optionally save to GeoJSON files.
This function downloads geospatial data from Overture Maps for a specified area and data types. It can save the data to GeoJSON files and/or return it as GeoDataFrames.
- Parameters:
area (list[float] or Polygon) – The area of interest. Can be either a bounding box as [min_lon, min_lat, max_lon, max_lat] or a Polygon geometry.
types (list[str], optional) – List of Overture data types to download. If None, downloads all available types. Valid types include: ‘address’, ‘building’, ‘segment’, ‘connector’, etc.
output_dir (str, default ".") – Directory where GeoJSON files will be saved.
prefix (str, default "") – Prefix to add to output filenames.
save_to_file (bool, default True) – Whether to save downloaded data to GeoJSON files.
return_data (bool, default True) – Whether to return the data as GeoDataFrames.
- Returns:
Dictionary mapping data type names to their corresponding GeoDataFrames.
- Return type:
- Raises:
ValueError – If invalid data types are specified.
subprocess.CalledProcessError – If the Overture Maps CLI command fails.
See also
process_overture_segments
Process segments from Overture Maps.
Examples
>>> # Download building and segment data for a bounding box >>> bbox = [-74.01, 40.70, -73.99, 40.72] # Manhattan area >>> data = load_overture_data(bbox, types=['building', 'segment']) >>> buildings = data['building'] >>> segments = data['segment']
- process_overture_segments(segments_gdf, get_barriers=True, connectors_gdf=None, threshold=1.0)[source]#
Process segments from Overture Maps to be split by connectors and extract barriers.
This function processes road segments by splitting them at connector points and optionally generates barrier geometries based on level rules. It also performs endpoint clustering to snap nearby endpoints together.
- Parameters:
segments_gdf (geopandas.GeoDataFrame) – GeoDataFrame containing road segments with LineString geometries. Expected to have ‘connectors’ and ‘level_rules’ columns.
get_barriers (bool, default True) – Whether to generate barrier geometries from level rules.
connectors_gdf (geopandas.GeoDataFrame, optional) – GeoDataFrame containing connector information. If provided, segments will be split at connector positions.
threshold (float, default 1.0) – Distance threshold for endpoint clustering in the same units as the CRS.
- Returns:
Processed segments with additional columns: - ‘split_from’, ‘split_to’: Split positions if segments were split - ‘length’: Length of each segment - ‘barrier_geometry’: Passable geometry if get_barriers=True
- Return type:
See also
load_overture_data
Load data from Overture Maps.
Examples
>>> # Process segments with connector splitting >>> processed = process_overture_segments( ... segments_gdf, ... connectors_gdf=connectors_gdf, ... threshold=1.0 ... ) >>> # Access barrier geometries for routing >>> barriers = processed['barrier_geometry']