This repository was archived by the owner on Jan 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Historic Event By Location
Kelvin edited this page May 20, 2021
·
7 revisions
historic.get_events_by_location(
search_items,
location_type,
csv=False,
output_dir='/output'
)This method first runs the HistoricSummary product for the given IDs to get all relevant historic event ids in the given location IDs, then runs the HistoricEvent product on the extracted historic events.
This method returns an array of array of HistoricSummary and HistoricEvent products for the given IDs. Optionally creates a csv file.
-
search_items:
list/file of EventIds, events to retrieve historic event information 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 (ifcsvis True).
python -m firststreet -p historic.get_events_by_location -s 511447411;511447412;511447413 -l property
python -m firststreet -p historic.get_events_by_location -s 540225;7924;631054 -l neighborhood
python -m firststreet -p historic.get_events_by_location -s 1982200;1935265;3958002 -l city
python -m firststreet -p historic.get_events_by_location -s 50156;50158;43935 -l zcta
python -m firststreet -p historic.get_events_by_location -s 19153004900;39061007100;39153531702 -l tract
python -m firststreet -p historic.get_events_by_location -s 19163;19047;39027 -l county
python -m firststreet -p historic.get_events_by_location -s 1901;3903;3915 -l cd
python -m firststreet -p historic.get_events_by_location -s 19;39 -l statepython -m firststreet -p historic.get_events_by_location -s 37.16314,-76.55782;38.50303,-106.72863 -l state
python -m firststreet -p historic.get_events_by_location -s "New York";"Ohio" -l statepython -m firststreet -p historic.get_events_by_location -s sample_property.txt -l property
python -m firststreet -p historic.get_events_by_location -s sample_neighborhood.txt -l neighborhood
python -m firststreet -p historic.get_events_by_location -s sample_city.txt -l city
python -m firststreet -p historic.get_events_by_location -s sample_zcta.txt -l zcta
python -m firststreet -p historic.get_events_by_location -s sample_tract.txt -l tract
python -m firststreet -p historic.get_events_by_location -s sample_county.txt -l county
python -m firststreet -p historic.get_events_by_location -s sample_cd.txt -l cd
python -m firststreet -p historic.get_events_by_location -s sample_state.txt -l state# Contents of sample.py
# Create a `FirstStreet` object.
import firststreet
fs = firststreet.FirstStreet("api-key")
# Call historic.get_events_by_location on a list of FSIDs
historic_events_by_location = fs.historic.get_events_by_location(search_items=[511447411, 511447412, 511447413], location_type="property", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items=[540225, 7924, 631054], location_type="neighborhood", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items=[1982200, 1935265, 3958002], location_type="city", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items=[50156, 50158, 43935], location_type="zcta", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items=[19153004900, 39061007100, 39153531702], location_type="tract", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items=[19163, 19047, 39027], location_type="county", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items=[1901, 3903, 3915], location_type="cd", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items=[19, 39], location_type="state", csv=True)
# Call historic.get_events_by_location on a lat/lng or address
historic_events_by_location = fs.historic.get_events_by_location(search_items=[(37.16314,-76.55782)], location_type="county", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items=["New York, New York"], location_type="city", csv=True)
# Call historic.get_events_by_location on a file of SearchItems
historic_events_by_location = fs.historic.get_events_by_location(search_items="sample_property.txt", location_type="property", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items="sample_neighborhood.txt", location_type="neighborhood", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items="sample_city.txt", location_type="city", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items="sample_zcta.txt", location_type="zcta", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items="sample_tract.txt", location_type="tract", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items="sample_county.txt", location_type="county", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items="sample_cd.txt", location_type="cd", csv=True)
historic_events_by_location = fs.historic.get_events_by_location(search_items="sample_state.txt", location_type="state", csv=True)List with 2 items:
-
List of
HistoricSummaryproducts (See the Historic Summary page for more information) -
List of
HistoricEventproducts (See the Historic Event page for more information)
-
Installation
-
Usage
-
Products
-
Update