Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Location Summary

Kelvin edited this page May 20, 2021 · 19 revisions

Location Summary Method

location.get_summary(
    search_items, 
    location_type, 
    csv=False, 
    output_dir='/output'
)

Includes general summary information for the location including the Flood Factor from 1 (minimal) to 10 (extreme) (property queries only) for other location types it includes the total count of properties as well as the count of properties at risk (with a Flood Factor of 2 or higher). It also includes future risk projection direction, count of historic events, count of adaptation projects that serve the location, and environmental risks for the location.

This method returns an array of LocationSummary product for the given IDs and location_type. Optionally creates a csv file

(More information on the Location Summary product can be found on the Location Summary Page on the First Street Foundation API Data Dictionary)

Arguments:

  • search_items: list/file of SearchItems, parcels to retrieve location summary for.
  • location_type: string, one of {property, neighborhood, city, zcta, tract, county, cd, state}, for the search item type.
  • csv: bool, whether to create a CSV for the retrieved data.
  • output_dir: string, location to output the created CSV (if csv is True).

Example (Command Line):

Call location.get_summary on a list of FSIDs

python -m firststreet -p location.get_summary -s 511447411;511447412;511447413 -l property
python -m firststreet -p location.get_summary -s 7924;631054 -l neighborhood
python -m firststreet -p location.get_summary -s 1935265;3958002 -l city
python -m firststreet -p location.get_summary -s 50158;43935 -l zcta
python -m firststreet -p location.get_summary -s 39061007100;39153531702 -l tract
python -m firststreet -p location.get_summary -s 19047;39027 -l county
python -m firststreet -p location.get_summary -s 3903;3915 -l cd
python -m firststreet -p location.get_summary -s 19;39 -l state

Call location.get_summary on a lat/lng or address

python -m firststreet -p location.get_summary -s 37.16314,-76.55782;38.50303,-106.72863 -l property
python -m firststreet -p location.get_summary -s "247 Water Street, New York, New York";"135 East 46th Street New York, New York" -l property

Call location.get_summary on a file of SearchItems

python -m firststreet -p location.get_summary -s sample_property.txt -l property
python -m firststreet -p location.get_summary -s sample_neighborhood.txt -l neighborhood
python -m firststreet -p location.get_summary -s sample_city.txt -l city
python -m firststreet -p location.get_summary -s sample_zcta.txt -l zcta
python -m firststreet -p location.get_summary -s sample_tract.txt -l tract
python -m firststreet -p location.get_summary -s sample_county.txt -l county
python -m firststreet -p location.get_summary -s sample_cd.txt -l cd
python -m firststreet -p location.get_summary -s sample_state.txt -l state

Example (Python File):

# Contents of sample.py
# Create a `FirstStreet` object.  
import firststreet
fs = firststreet.FirstStreet("api-key")

# Call location.get_summary on a list of FSIDs
location_summary = fs.location.get_summary(search_items=[511447411, 511447412, 511447413], location_type="property", csv=True)
location_summary = fs.location.get_summary(search_items=[7924, 631054], location_type="neighborhood", csv=True)
location_summary = fs.location.get_summary(search_items=[1935265, 3958002], location_type="city", csv=True)
location_summary = fs.location.get_summary(search_items=[50158, 43935], location_type="zcta", csv=True)
location_summary = fs.location.get_summary(search_items=[39061007100, 39153531702], location_type="tract", csv=True)
location_summary = fs.location.get_summary(search_items=[19047, 39027], location_type="county", csv=True)
location_summary = fs.location.get_summary(search_items=[3903, 3915], location_type="cd", csv=True)
location_summary = fs.location.get_summary(search_items=[19, 39], location_type="state", csv=True)

# Call location.get_summary on a lat/lng or address
location_summary = fs.location.get_summary(search_items=[(37.16314,-76.55782)], location_type="county", csv=True)
location_summary = fs.location.get_summary(search_items=["New York, New York"], location_type="state", csv=True)

# Call location.get_summary on a file of SearchItems
location_summary = fs.location.get_summary(search_items="sample_property.txt", location_type="property", csv=True)
location_summary = fs.location.get_summary(search_items="sample_neighborhood.txt", location_type="neighborhood", csv=True)
location_summary = fs.location.get_summary(search_items="sample_city.txt", location_type="city", csv=True)
location_summary = fs.location.get_summary(search_items="sample_zcta.txt", location_type="zcta", csv=True)
location_summary = fs.location.get_summary(search_items="sample_tract.txt", location_type="tract", csv=True)
location_summary = fs.location.get_summary(search_items="sample_county.txt", location_type="county", csv=True)
location_summary = fs.location.get_summary(search_items="sample_cd.txt", location_type="cd", csv=True)
location_summary = fs.location.get_summary(search_items="sample_state.txt", location_type="state", csv=True)

Location Summary Objects

Location Summary (Property Location Type)

Key Type Description Example
fsid str First Street ID (FSID) is a unique identifier assigned to each location. 392804911
valid_id bool Whether the input FSID returned valid data from the server. True
floodFactor int The property's Flood Factor, a numeric integer from 1-10 (where 1 = minimal and 10 = extreme) based on flooding risk to the building footprint. Flood risk is defined as a combination of cumulative risk over 30 years and flood depth. Flood depth is calculated at the lowest elevation of the building footprint (largest if more than 1 exists, or property centroid where footprint does not exist). 5
riskDirection int The location's risk direction represented in a numeric value based on the change in risk for the location from 2020 to 2050 for the climate model realization of the RCP 4.5 mid emissions scenario. -1 = decreasing 0 = stationary 1 = increasing 1
historic int The total count of modeled historic events that inundated the location. Inundation is defined as having flood depth >0 for property queries or >1 property with >0 flood depth for higher-level locations. Flood depth is calculated at the lowest elevation of the building footprint (largest if more than 1 exists, or property centroid where footprint does not exist). 1
environmentalRisk int Denotes what environmental risks impact the location represented in a numeric value. 1 = precipitation 2 = precipitation and sea level rise 3 = precipitation, sea level rise and hurricane storm surge Coastal areas on the East Coast and Hawaii will return 3, other coastal areas will return 2 and all other locations will return 1. 1
adaptation int The total count of mapped adaptation projects where the area served for the project overlaps any area of the location. 2

Location Summary (Excluding Property Location Type)

Key Type Description Example
fsid str First Street ID (FSID) is a unique identifier assigned to each location. 19
valid_id bool Whether the input FSID returned valid data from the server. True
riskDirection int The location's risk direction represented in a numeric value based on the change in risk for the location from 2020 to 2050 for the climate model realization of the RCP 4.5 mid emissions scenario. -1 = decreasing 0 = stationary 1 = increasing 1
historic int The total count of modeled historic events that inundated the location. Inundation is defined as having flood depth >0 for property queries or >1 property with >0 flood depth for higher-level locations. Flood depth is calculated at the lowest elevation of the building footprint (largest if more than 1 exists, or property centroid where footprint does not exist). 5
environmentalRisk int Denotes what environmental risks impact the location represented in a numeric value. 1 = precipitation 2 = precipitation and sea level rise 3 = precipitation, sea level rise and hurricane storm surge Coastal areas on the East Coast and Hawaii will return 3, other coastal areas will return 2 and all other locations will return 1. 1
adaptation int The total count of mapped adaptation projects where the area served for the project overlaps any area of the location. 184
properties dict Total count of properties as a [PropertyCount] including the total count of properties within the location boundary and the properties at risk where risk is having a Flood Factor of 2 or higher. (Location Query Type: all excluding Property) {'total': 2423036, 'atRisk': 391150}
Clone this wiki locally