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

Location Detail

Kelvin edited this page Oct 27, 2020 · 25 revisions

Location Detail Method

location.get_detail(
    search_items, 
    location_type, 
    csv=False`, 
    output_dir='cwd', 
    extra_param=None`
)

Returns an array of LocationDetail product for the given ID and location_type. Optionally creates a csv file. Arguments provided to extra_param will be appended to the end of the endpoint call.

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

Arguments:

  • search_items: list/file of SearchItems, parcels to retrieve location details 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).
  • extra_param: string, extra parameters to be sent with the request.

Example (Command Line):

# Call location.get_detail on a list with 3 property FSIDs
python -m firststreet -p location.get_detail -i 511447411;511447412;511447413 -l property

# Call location.get_detail on a list with 1 state FSID
python -m firststreet -p location.get_detail -i 19 -l state

# Call location.get_detail on a file of SearchItems
python -m firststreet -p location.get_detail -f sample.txt -l property

Example (Python File):

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

# Call location.get_detail on a list with 3 property FSIDs
location_detail = fs.location.get_detail([511447411, 511447412, 511447413], "property")

# Call location.get_detail on a list with 1 state FSID
location_detail = fs.location.get_detail([19], "state")

# Call location.get_detail on a file of SearchItems
location_detail = fs.location.get_detail("sample.txt", "property", csv=True)

LocationDetailProperty Object

Key Type Description Example
fsid integer First Street ID (FSID) is a unique identifier assigned to each location. 392804911
streetNumber string The property's street address number. 123
route string The property's route or complete street address name. Water St
city dict The property's city as a dictionary object including the city FSID and name. {'fsid': 5156000, 'name': 'Newport News'}
zipCode string The property's USPS zip code. 11201
zcta dict The property's ZIP code tabulation area (ZCTA) provided by the Census Bureau as a dictionary object including the zcta FSID and name. {'fsid': 23608, 'name': '23608'}
neighborhood list of dict The neighborhood(s) the property is associated with as an array of [LocationPreview] information including each associated neighborhood's name and FSID. This encompasses macro neighborhoods, neighborhood, sub-neighborhoods and residential districts (e.g. subdivisions and apartment complexes). [{'fsid': 24829, 'name': 'North Newport News'}, {'fsid': 192828, 'name': 'Lees Mill'}, {'fsid': 192880, 'name': 'Warwick Landing'}, {'fsid': 585151, 'name': 'Merrie Oaks'}]
tract dict The property's census tract provided by the Census Bureau as a [LocationPreview] including the tract FSID and name. {'fsid': 51700032223, 'name': None}
county dict The property's county as a [LocationPreview] including the county FSID and name. {'fsid': 51700, 'name': 'Newport News city'}
cd dict The property's congressional district as a [LocationPreview] including the congressional district FSID and name. {'fsid': 5103, 'name': 'Virginia Congressional District 3'}
state dict The property's state as a [LocationPreview] including the state FSID and name. {'fsid': 51, 'name': 'Virginia'}
footprintId integer The unique First Street identifier that links to the largest building footprint on the property from which the property's flood risk stats are calculated. 5
elevation integer The lowest elevation point of the building footprint (in centimeters using the NAVD88 datum) for the largest footprint on the property. If no footprint exists, the elevation at the centroid of the parcel is used. 0
fema dict The property's FEMA zone(s) as a [FemaSummary] including the zone ID and name.
distance integer The rounded distance in meters between the given lat/lng to the centroid of the property. Returns 0 if lookup was by FSID. 0
geometry Geometry A collection of nodes as a [Geometry] that represents geographical information for the property. See [Geometry]

Clone this wiki locally