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
Tile Historic Event
Kelvin edited this page Jan 21, 2021
·
9 revisions
tile.get_historic_event(
search_items,
event_id,
image=False,
output_dir='/output'
)
Provides a 256x256 map tile that represents flood inundation with 5 depth thresholds (1-15cm (0-6in), 16-30cm (6-12in), 31-61cm (12-24in), 62- 91cm (24-36in), 92+cm (36+in)) from the historic event.
In addition to a zoom level and x,y coordinates based on the Mercator projection, this function requires an event_id
. Max zoom is level 18. The map provided here can be used to find the coordinates at a specified zoom level.
This method returns an array of Historic Event Tile
product for the given coordinates, and optionally creates an image file.
(More information on the Tile Historic Event product can be found on the Historic Event Page on the First Street Foundation API Data Dictionary)
-
search_items:
list of tuple of int [(z, x, y)]
, coordinates to retrieve tile historic event. The coordinates used in this product can be converted using Google Map's Coordinate Tile tool. -
event_id:
int
, the event ID to retrieve the tile for. -
image:
bool
, whether to create an image for the retrieved data. -
output_dir:
string
, location to output the created image (ifimage
is True).
python -m firststreet -p tile.get_historic_event -s (12,932,1715);(12,942,1715) -eid 10
python -m firststreet -p tile.get_historic_event -s (12,932,1715);(12,942,1715) -eid 14
python -m firststreet -p tile.get_historic_event -s sample_coordinate.txt -eid 10
python -m firststreet -p tile.get_historic_event -s sample_coordinate.txt -eid 14
# Contents of sample.py
# Create a `FirstStreet` object.
import firststreet
fs = firststreet.FirstStreet("api-key")
# Call tile.get_historic_event on a list with 1 county FSID
tile_probability_depth = fs.tile.get_historic_event(search_items=[(12,932,1715), (12,942,1715)], event_id=10)
# Call tile.get_historic_event on a file of SearchItems
tile_probability_depth = fs.tile.get_historic_event(search_items="sample_coordinates.txt", csv=True)
Key | Type | Description | Example |
---|---|---|---|
coordinate | tuple | A zoom, X, Y coordinate, with the X and Y value based on the Mercator Projection | (10,942,1715) |
valid_id | bool | Whether the input FSID returned valid data from the server. | True |
event_id | int | The provided event ID | 10 |
image | bytes | The tile image in raw bytes | b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01\x00... |
-
Installation
-
Usage
-
Products
-
Update