brails.scrapers.overture_maps_scraper.overture_maps_footprint_scraper module

This module define the concrete class for scraping OvertureMaps footprint data.

OvertureMapsFootprintScraper([input_dict])

Scraper for extracting Overture Maps buildings and building-parts.

class brails.scrapers.overture_maps_scraper.overture_maps_footprint_scraper.OvertureMapsFootprintScraper(input_dict=None)

Bases: OvertureMapsScraper

Scraper for extracting Overture Maps buildings and building-parts.

This class extends OvertureMapsScraper and provides methods to load and filter Overture asset datasets based on a region boundary. Assets are stored in an AssetInventory and can be exported as GeoJSON.

Parameters:
  • units (str) – Length unit used for spatial calculations. Parsed from input_dict or defaults to ft.

  • inventory (AssetInventory) – Stores the assets retrieved by the scraper.

  • overture_release (str) – The specific Overture Maps release being used. Falls back to the latest release if not specified in input_dict.

get_footprints(region)

Retrieve Overture building assets within a specified region.

This method loads Overture dataset for assets of 'building' and 'building_part' types that are withing the boundary of the given region. Resulting assets are save as an AssetInventory.

Parameters:

region (RegionBoundary) – A BRAILS++ region boundary object defining the coordinate information for the region of interest.

Returns:

An inventory of assets within the specified region.

Return type:

AssetInventory

Notes

  • Only assets that intersect the provided region are included.

  • Columns named 'names' are dropped to avoid GeoJSON export issues.

  • Asset attributes with values None and NaN are excluded.

  • The inventory is stored in self.inventory and also returned.

Example

First import the BRAILS++ Importer class.

>>> from brails import Importer
>>> importer = Importer()

Create a region boundary object for Berkeley, CA.

>>> region_data = {"type": "locationName", "data": 'Berkeley, CA'}
>>> region_boundary_class = importer.get_class('RegionBoundary')
>>> region_boundary_object = region_boundary_class(region_data)

Get building inventory data using the ‘2024-07-22.0’ release of Overture Maps for Berkeley, CA.

>>> scraper_class = importer.get_class(
... 'OvertureMapsFootprintScraper'
... )
>>> scraper_object = scraper_class(
...     input_dict={'overtureRelease': '2024-07-22.0'}
... )
No length unit specified. Using default: 'ft'.
No weight unit specified. Using default: 'lb'.
>>> inventory = scraper_object.get_footprints(
...     region_boundary_object
... )
Searching for Berkeley, CA...
Found Berkeley, Alameda County, California, United States
Reading dataset batches: 339it [00:39,  8.49it/s]
Reading dataset batches: 12it [00:02,  4.99it/s]
Finding the assets within the specified area...
Found a total of 36181 assets within the specified area.

Write the obtained inventory in berkeley_buildings.geojson.

>>> _ = inventory.write_to_geojson('berkeley_buildings.geojson')
Wrote 36181 assets to /home/bacetiner/Documents/SoftwareTesting/
berkeley_buildings.geojson