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 May 20, 2021 · 25 revisions

Location Detail Method

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

The location detail API provides general metadata and relationships between a location.

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

(More information on the Location Detail 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).

Example (Command Line):

Call location.get_detail on a list of FSIDs

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

Call location.get_detail on a lat/lng or address

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

Call location.get_detail on a file of SearchItems

python -m firststreet -p location.get_detail -s sample_property.txt -l property
python -m firststreet -p location.get_detail -s sample_neighborhood.txt -l neighborhood
python -m firststreet -p location.get_detail -s sample_city.txt -l city
python -m firststreet -p location.get_detail -s sample_zcta.txt -l zcta
python -m firststreet -p location.get_detail -s sample_tract.txt -l tract
python -m firststreet -p location.get_detail -s sample_county.txt -l county
python -m firststreet -p location.get_detail -s sample_cd.txt -l cd
python -m firststreet -p location.get_detail -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_detail on a list of FSIDs
location_detail = fs.location.get_detail(search_items=[511447411, 511447412, 511447413], location_type="property", csv=True)
location_detail = fs.location.get_detail(search_items=[7924, 631054], location_type="neighborhood", csv=True)
location_detail = fs.location.get_detail(search_items=[1935265, 3958002], location_type="city", csv=True)
location_detail = fs.location.get_detail(search_items=[50158, 43935], location_type="zcta", csv=True)
location_detail = fs.location.get_detail(search_items=[39061007100, 39153531702], location_type="tract", csv=True)
location_detail = fs.location.get_detail(search_items=[19047, 39027], location_type="county", csv=True)
location_detail = fs.location.get_detail(search_items=[3903, 3915], location_type="cd", csv=True)
location_detail = fs.location.get_detail(search_items=[19, 39], location_type="state", csv=True)

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

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

Location Detail Objects

LocationDetailProperty Object

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
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 Array[dict] The neighborhood(s) the property is associated with as an array of dictionary object 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 dictionary object including the tract FSID and name. {'fsid': 51700032223, 'name': None}
county dict The property's county as a dictionary object including the county FSID and name. {'fsid': 51700, 'name': 'Newport News city'}
cd dict The property's congressional district as a dictionary object including the congressional district FSID and name. {'fsid': 5103, 'name': 'Virginia Congressional District 3'}
state dict The property's state as a dictionary object including the state FSID and name. {'fsid': 51, 'name': 'Virginia'}
footprintId int 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 int 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. 56
fema string The property's FEMA zone(s) as a [FemaSummary] including the zone ID and name. AE
geometry Geometry A collection of nodes as a Geometry that represents geographical information for the property. See Geometry
floorElevation int The height in centimeters associated with the floor elevation for the building. 23
basement boolean Whether or not the property has a basement true
units int Number of units the property has 2
stories int Number of stories the property has 1
floodType string The predominant form of flooding for the property: inland fluvial, inland pluvial, coastal, or none. For inland areas, flooding depths are provided as the maximum of pluvial and fluvial models. In coastal areas, a coupled model merges the three flooding sources into a single coastal data set. inland pluvial
residential boolean Indicates if the property is used for residential purposes. true

LocationDetailNeighborhood Object

Key Type Description Example
fsid str First Street ID (FSID) is a unique identifier assigned to each location. 93099
valid_id bool Whether the input FSID returned valid data from the server. True
city Array[dict] The neighborhood's city as a dictionary object including the city FSID and name. [{'fsid': 3907454, 'name': 'Boardman'}]
name string The neighborhood's name. This encompasses macro neighborhoods, neighborhood, sub-neighborhoods and residential districts (e.g. subdivisions and apartment complexes). 'Golf Land Estates'
subtype string The neighborhood's subtype code. N
county Array[dict] The neighborhood's county as a dictionary object including the county FSID and name. [{'fsid': 39099, 'name': 'Mahoning County'}]
state dict The neighborhood's state as a dictionary object including the state FSID and name. {'fsid': 39, 'name': 'Ohio'}
geometry Geometry A collection of nodes as a Geometry that represents geographical information for the neighborhood. See Geometry

LocationDetailCity Object

Key Type Description Example
fsid str First Street ID (FSID) is a unique identifier assigned to each location. 3923618
valid_id bool Whether the input FSID returned valid data from the server. True
name string The city name. Brooklyn
lsad int The legal/statistical area description (LSAD) as provided by the census which describes the particular typology for each geographic entity; that is, whether the entity is a borough, city, town, or township, among others. 25
zcta Array[dict] The city's ZIP code tabulation area (ZCTA) provided by the Census Bureau as an array of dictionary object including the zcta FSID and name. [{'fsid': 44092, 'name': '44092'}, {'fsid': 44094, 'name': '44094'}, {'fsid': 44095, 'name': '44095'}]
neighborhood Array[dict] The neighborhood(s) the city is associated with as an array of dictionary object 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'}]
county dict The city's county as a dictionary object including the county FSID and name. [{'fsid': 39085, 'name': 'Lake County'}]
state dict The city's state as a dictionary object including the state FSID and name. {'fsid': 39, 'name': 'Ohio'}
geometry Geometry A collection of nodes as a Geometry that represents geographical information for the city. See Geometry

LocationDetailZcta Object

Key Type Description Example
fsid str First Street ID (FSID) is a unique identifier assigned to each location. 44095
valid_id bool Whether the input FSID returned valid data from the server. True
name string The zcta name. 44095
county Array[dict] The zcta's county as an array of dict including the county FSID and name. [{'fsid': 39085, 'name': 'Lake County'}]
city Array[dict] The city or cities the zcta is associated with as an array of dict information including each associated city's name and FSID. [{'fsid': 3923618, 'name': 'Eastlake'}, {'fsid': 3941398, 'name': 'Lakeline'}, {'fsid': 3976834, 'name': 'Timberlake'}, {'fsid': 3985036, 'name': 'Wickliffe'}, {'fsid': 3985484, 'name': 'Willoughby'}, {'fsid': 3985638, 'name': 'Willowick'}]
state dict The city's state as a dict including the state FSID and name. {'fsid': 39, 'name': 'Ohio'}
geometry Geometry A collection of nodes as a Geometry that represents geographical information for the zipcode. See Geometry

LocationDetailTract Object

Key Type Description Example
fsid string First Street ID (FSID) is a unique identifier assigned to each location. 39119912800
valid_id bool Whether the input FSID returned valid data from the server. True
fips int The Federal Information Processing Standards code which uniquely identified counties and county equivalents, and certain freely associated states. 39119912800
county dict The tract's county as a dictionary object including the county FSID and name. {'fsid': 39119, 'name': 'Muskingum County'}
state dict The city's state as a dictionary object including the state FSID and name. {'fsid': 39, 'name': 'Ohio'}
geometry Geometry A collection of nodes as a Geometry that represents geographical information for the tract. See Geometry

LocationDetailCounty Object

Key Type Description Example
fsid str First Street ID (FSID) is a unique identifier assigned to each location. 31003
valid_id bool Whether the input FSID returned valid data from the server. True
fips int The Federal Information Processing Standards code which uniquely identified counties and county equivalents, and certain freely associated states. 31003
name string The county name. Broome
isCoastal boolean A boolean field indicating if the county is in a coastal area. false
city Array[dict] The city or cities the county is associated with as an array of dictionary object information including each associated city's name and FSID. [{'fsid': 3106890, 'name': 'Brunswick'}, {'fsid': 3109445, 'name': 'Clearwater'}, ...]
zcta Array[dict] The county's ZIP code tabulation area(s) (ZCTA) provided by the Census Bureau as a dictionary object including the zcta(s) FSID and name. [{'fsid': 68636, 'name': '68636'}, {'fsid': 68720, 'name': '68720'}, ...]
cd Array[dict] The congressional district(s) the county is associated with as an array of dictionary object] information including each associated cd's name and FSID. [{'fsid': 3103, 'name': 'Nebraska Congressional District 3'}]
state dict The county's state as a dictionary object including the state FSID and name. {'fsid': 31, 'name': 'Nebraska'}
geometry Geometry A collection of nodes as a Geometry that represents geographical information for the city.A collection of nodes as a [Geometry] that represents geographical information for the city. See Geometry

LocationDetailCd Object

Key Type Description Example
fsid str First Street ID (FSID) is a unique identifier assigned to each location. 3904
valid_id bool Whether the input FSID returned valid data from the server. True
district string The name associated with the congressional district. Ohio Congressional District 4
congress int Denotes the session of congress from which the boundary was drawn. 116
county Array[dict] The county or counties the congressional district is associated with as an array of dictionary object information including each associated county's name and FSID. [{'fsid': 39003, 'name': 'Allen County'}, {'fsid': 39011, 'name': 'Auglaize County'}, ...]
state dict The congressional district's state as a dictionary object including the state FSID and name. {'fsid': 39, 'name': 'Ohio'}
geometry Geometry A collection of nodes as a Geometry that represents geographical information for the city.A collection of nodes as a [Geometry] that represents geographical information for the congressional district. See Geometry

LocationDetailState Object

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
name string The name of the state Iowa
fips int The Federal Information Processing Standards code for the state. 19
geometry Geometry A collection of nodes as a Geometry that represents geographical information for the city.A collection of nodes as a [Geometry] that represents geographical information for the state. See Geometry

Clone this wiki locally