-
Notifications
You must be signed in to change notification settings - Fork 6
Tile Probability Depth
tile.get_probability_depth(
search_items,
year,
return_period,
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)).
In addition to a zoom level and x,y coordinates based on the Mercator projection, this API requires a return period (500, 100, 20, 5, or 2 years), year of annual risk (2020, 2035, or 2050). The map provided here can be used to find the coordinates at a specified zoom level.
This method returns an array of Probability Depth Tile product for the given coordinates, and optionally creates an image file.
(More information on the Tile Probability Depth product can be found on the Tile Probability Depth Page on the First Street Foundation API Data Dictionary)
-
search_items:
list of tuple of int [(z, x, y)], parcels to retrieve NFIP details for. The coordinates used in this product can be converted using Google Map's Coordinate Tile tool. -
year:
int, the year of annual risk (2020, 2035, or 2050) to retrieve the tile for. -
return_period:
int, the return period (500, 100, 20, 5, or 2 years) 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 (ifimageis True).
python -m firststreet -p tile.get_probability_depth -s (12,932,1715);(12,942,1715) -y 2020 -rp 5
python -m firststreet -p tile.get_probability_depth -s (12,932,1715);(12,942,1715) -y 2035 -rp 20
python -m firststreet -p tile.get_probability_depth -s (12,932,1715);(12,942,1715) -y 2050 -rp 500python -m firststreet -p tile.get_probability_depth -s sample_coordinate.txt -y 2020 -rp 5
python -m firststreet -p tile.get_probability_depth -s sample_coordinate.txt -y 2035 -rp 20
python -m firststreet -p tile.get_probability_depth -s sample_coordinate.txt -y 2050 -rp 500# Contents of sample.py
# Create a `FirstStreet` object.
import firststreet
fs = firststreet.FirstStreet("api-key")
# Call tile.get_probability_depth on a list with 2 coordinates
tile_probability_depth = fs.tile.get_probability_depth(search_items=[(12,932,1715), (12,942,1715)], year=2020, return_period=5)
tile_probability_depth = fs.tile.get_probability_depth(search_items=[(12,932,1715), (12,942,1715)], year=2035, return_period=20)
tile_probability_depth = fs.tile.get_probability_depth(search_items=[(12,932,1715), (12,942,1715)], year=2050, return_period=500)
# Call tile.get_probability_depth on a file of SearchItems
tile_probability_depth = fs.tile.get_probability_depth("sample_coordinate.txt", year=2020, return_period=5, image=True)
tile_probability_depth = fs.tile.get_probability_depth("sample_coordinate.txt", year=2035, return_period=20, image=True)
tile_probability_depth = fs.tile.get_probability_depth("sample_coordinate.txt", year=2050, return_period=500, image=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 |
| year | int | Year of annual risk - 2020, 2035, 2050 | 2050 |
| returnPeriod | int | Return period - 500, 100, 20, 5, or 2 | 100 |
| 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