The national map (TNM) is a catalog of topological datasources maintained by the USGS.
We've created a thin wrapper to expose this treasure trove.
# !pip install leafmap
import leafmap
A class groups the functionalities together.
TNM = leafmap.The_national_map_USGS()
TNM.datasets
Note that any format (f.e. 'All') is specific to one or more datasets.
TNM.prodFormats
TNM.find_details().keys(), TNM.find_details()["total"]
TNM.find_details()["items"][0]
params = {
"q": "National Elevation Dataset (NED) 1/3 arc-second",
"polyCode": "01010002",
"polyType": "huc8",
}
TNM.find_details(**params)["total"]
params = {
"prodFormats": "LAS,LAZ",
"datasets": "Lidar Point Cloud (LPC)",
"polygon": [
(-104.94262695312236, 41.52867510196275),
(-102.83325195312291, 40.45065268246805),
(-104.94262695312236, 40.45065268246805),
(-104.94262695312236, 41.52867510196275),
],
}
TNM.find_details(**params)["total"]
Available parameters
help(TNM.find_details)
Defaults to about 50. You only retrieve about 1000 items in one call.
len(TNM.find_details()["items"])
len(TNM.find_details(max=1000000)["items"])
Use offset to retrieve more batches.
params = {
"q": "National Elevation Dataset (NED) 1/3 arc-second",
"polyCode": "01010002",
"polyType": "huc8",
"max": 2,
}
TNM.find_details(**params, offset=0)["items"][0] == TNM.find_details(
**params, offset=1
)["items"][0]
m = leafmap.Map(center=[40, -100], zoom=4)
m
region = m.user_roi_bounds()
if region is None:
region = [-115.9689, 35.9758, -115.3619, 36.4721]
TNM.find_details(q="LAZ", bbox=region)["total"]
bool(TNM.find_details(start="01-01-2010", q="NED", bbox=region))
bool(TNM.find_details(start="2021-12-01", end="2020-01-01", q="NED", bbox=region))
bool(TNM.find_details(start="2021-12-01", end="2022-01-01", q="NED", bbox=region))
bool(
TNM.find_details(
start="2020-12-01",
end="2022-01-01",
q="NED",
dateType="dateCreated",
bbox=region,
)
)
help(TNM.download_tiles)
params = {
"q": "National Elevation Dataset (NED) 1/3 arc-second",
"polyCode": "01010002",
"polyType": "huc8",
"max": 0,
}
TNM.download_tiles(API=params)
It can also be accessed without invoking the class.
params = {
"q": "National Elevation Dataset (NED) 1/3 arc-second",
"polyCode": "01010002",
"polyType": "huc8",
"max": 0,
}
leafmap.download_tnm(API=params)
region = [-115.9689, 35.9758, -115.3619, 36.4721]
leafmap.download_ned(region=region, return_url=True) == leafmap.download_tnm(
region=region, return_url=True, API={"q": "NED"}
)
TNM.find_tiles(API=params)
TNM.datasets_full[0]
help(TNM)