brails.scrapers.nsi_parser.nsi_parser module
This module defines a class for scraping data from NSI.
- class brails.scrapers.nsi_parser.nsi_parser.NSI_Parser
Bases:
object
- GetNSIData(footprints: list, lengthUnit: str = 'ft', outfile: str = '')
Match NSI buildings points to a set of footprints.
Method that reads NSI buildings points and matches the data to a set of footprints and writes the data in a BRAILS-compatible format
- Args:
- footprints: List of footprint data defined as a list of lists of
coordinates in EPSG 4326, i.e., [[vert1],….[vertlast]]. Vertices are defined in [longitude,latitude] fashion.
lengthUnit: The units for the data to be returned in, ‘m’ or ‘ft’
- outfile: string containing the name of the output file
Currently, only GeoJSON format is supported
- Output:
- dict: Attribute dictionary for the footprints containing the
attributes: 1)latitude, 2)longitude, 3)building plan area, 4)number of floors, 5)year of construction, 6)replacement cost, 7)structure type, 8)occupancy class, 9)footprint polygon
- GetRawDataROI(roi, outfile: str) None
Get NSI data within an ROI/area of footprints and write to GeoJSON.
Method that reads NSI buildings data finds the points within a bounding polygon or matches a set of footprints, then writes the extracted data into a GeoJSON file.
- Args:
- roi: Either 1) a list of footprint data defined as a list of
lists of coordinates in EPSG 4326, i.e., [[vert1],…. [vertlast]]. Vertices are defined in [longitude,latitude] fashion, or 2) a shapely polygon or multipolygon for the boundary polygon of the region of interest.
outfile: string containing the name of the output file Currently, only GeoJSON format is supported
- get_filtered_data_given_inventory(inventory: AssetInventory, length_unit: str = 'ft', outfile: str = '')
Get NSI data corresponding to an AssetInventory.
- Input: RegionBoundary
The region boundary
- length unit
The units data to be returned in, ‘m’ or ‘ft’
- outfile
Optional string
- Output: dict
Attribute dictionary for the footprints containing the attributes: 1)latitude, 2)longitude, 3)building plan area, 4)number of floors, 5)year of construction, 6)replacement cost, 7)structure type, 8)occupancy class, 9)footprint polygon
- get_raw_data_given_boundary(region_boundary: RegionBoundary, length_unit: str = 'ft', outfile: str = '') AssetInventory
Method that gets nsi data given a region boundary
- Input: RegionBoundary
The region boundary
- length unit
The units data to be returned in, ‘m’ or ‘ft’
- outfile
Optional string
- Output: AssetInventory
an AssetInventory
- get_raw_data_given_inventory(inventory: AssetInventory, length_unit: str = 'ft', outfile: str = '') AssetInventory
Method that gets nsi data given a region boundary
- Input: AssetInventory
The Asset inventory whose footprints we use to obtain NSI data
- length unit
The units data to be returned in, ‘m’ or ‘ft’
- outfile
Optional string
- Output: AssetInventory
The inputed AssetInventory is updated and returned. returned for clarity of code