maps4fs 1.8.190__py3-none-any.whl → 1.8.191__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maps4fs/__init__.py +1 -1
- maps4fs/generator/dtm/usgs_wcs.py +35 -0
- {maps4fs-1.8.190.dist-info → maps4fs-1.8.191.dist-info}/METADATA +1 -1
- {maps4fs-1.8.190.dist-info → maps4fs-1.8.191.dist-info}/RECORD +7 -7
- maps4fs/generator/dtm/usgs.py +0 -90
- {maps4fs-1.8.190.dist-info → maps4fs-1.8.191.dist-info}/LICENSE.md +0 -0
- {maps4fs-1.8.190.dist-info → maps4fs-1.8.191.dist-info}/WHEEL +0 -0
- {maps4fs-1.8.190.dist-info → maps4fs-1.8.191.dist-info}/top_level.txt +0 -0
maps4fs/__init__.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# pylint: disable=missing-module-docstring
|
2
2
|
from maps4fs.generator.dtm.dtm import DTMProvider
|
3
3
|
from maps4fs.generator.dtm.srtm import SRTM30Provider, SRTM30ProviderSettings
|
4
|
-
from maps4fs.generator.dtm.
|
4
|
+
from maps4fs.generator.dtm.usgs_wcs import USGSWCSProvider
|
5
5
|
from maps4fs.generator.dtm.nrw import NRWProvider
|
6
6
|
from maps4fs.generator.dtm.bavaria import BavariaProvider
|
7
7
|
from maps4fs.generator.dtm.niedersachsen import NiedersachsenProvider
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"""This module contains provider of USGS data."""
|
2
|
+
|
3
|
+
from maps4fs.generator.dtm.base.wcs import WCSProvider
|
4
|
+
from maps4fs.generator.dtm.dtm import DTMProvider
|
5
|
+
|
6
|
+
|
7
|
+
class USGSWCSProvider(WCSProvider, DTMProvider):
|
8
|
+
"""Provider of USGS data."""
|
9
|
+
|
10
|
+
_code = "usgs_wcs"
|
11
|
+
_name = "USGS"
|
12
|
+
_region = "USA"
|
13
|
+
_icon = "🇺🇸"
|
14
|
+
_resolution = "1-90"
|
15
|
+
_author = "[kbrandwijk](https://github.com/kbrandwijk)"
|
16
|
+
_is_community = True
|
17
|
+
_instructions = None
|
18
|
+
_is_base = False
|
19
|
+
_extents = (50.0, 17.0, -64.0, -162.0)
|
20
|
+
|
21
|
+
_url = "https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WCSServer"
|
22
|
+
_wcs_version = "1.0.0"
|
23
|
+
_source_crs = "EPSG:3857"
|
24
|
+
_tile_size = 1000
|
25
|
+
_is_multipart = False
|
26
|
+
|
27
|
+
def get_wcs_parameters(self, tile):
|
28
|
+
return {
|
29
|
+
"identifier": "DEP3Elevation",
|
30
|
+
"bbox": (tile[1], tile[0], tile[3], tile[2]),
|
31
|
+
"crs": "EPSG:3857",
|
32
|
+
"width": 1000,
|
33
|
+
"height": 1000,
|
34
|
+
"format": "GeoTIFF",
|
35
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
maps4fs/__init__.py,sha256=
|
1
|
+
maps4fs/__init__.py,sha256=9StBkLgyOqEwZ4tQ0AQJ9LaEMhR0_tr3FtZxZKKa8FQ,1780
|
2
2
|
maps4fs/logger.py,sha256=HQrDyj72mUjVYo25aR_-_SxVn2rfFjDCNbj-JKJdSnE,1488
|
3
3
|
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
4
|
maps4fs/generator/dem.py,sha256=dyzCFfDL6W_nCjwi9uF3-PCiL36rfOh3jGXlDuwiJYg,11795
|
@@ -43,7 +43,7 @@ maps4fs/generator/dtm/scotland.py,sha256=Od4dDMuCM_iteewjGBbmZXJ26S0bDwrhRhXeV4H
|
|
43
43
|
maps4fs/generator/dtm/spain.py,sha256=HxN0MvrtRqqeTmhl47q60-1DGaMDb2wq6neMcDlDCl8,1005
|
44
44
|
maps4fs/generator/dtm/srtm.py,sha256=hQJC8yf1WgC7PPoQ36AkXTPMEFp7l-cwHAEGA_2GAqQ,4522
|
45
45
|
maps4fs/generator/dtm/switzerland.py,sha256=GC5fbWL5kkiWksB-H4dWl4I7GSmOsUZ_ywPpfkxBTo8,3547
|
46
|
-
maps4fs/generator/dtm/
|
46
|
+
maps4fs/generator/dtm/usgs_wcs.py,sha256=Uu93aYeUxYyQJupswRlmxENzSBjHQOPiG20KrWhiAtg,1019
|
47
47
|
maps4fs/generator/dtm/utils.py,sha256=I-wUSA_J85Xbt8sZCZAVKHSIcrMj5Ng-0adtPVhVmk0,2315
|
48
48
|
maps4fs/generator/dtm/base/wcs.py,sha256=PRG3IIwj2RWZh2y3d3taCxEsulDcwSYmsaaseNcjW3M,2538
|
49
49
|
maps4fs/generator/dtm/base/wms.py,sha256=14ssC11SeitP9PYJwXx6669w4JZ5Z4KSobV9pWtYVQE,2292
|
@@ -51,8 +51,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
|
|
51
51
|
maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
|
52
52
|
maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
|
53
53
|
maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
|
54
|
-
maps4fs-1.8.
|
55
|
-
maps4fs-1.8.
|
56
|
-
maps4fs-1.8.
|
57
|
-
maps4fs-1.8.
|
58
|
-
maps4fs-1.8.
|
54
|
+
maps4fs-1.8.191.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
|
55
|
+
maps4fs-1.8.191.dist-info/METADATA,sha256=nSskpcjZm-GPqIC4ggfP-PN9WXpuWa9L8zneJqKzeXU,45000
|
56
|
+
maps4fs-1.8.191.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
57
|
+
maps4fs-1.8.191.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
58
|
+
maps4fs-1.8.191.dist-info/RECORD,,
|
maps4fs/generator/dtm/usgs.py
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
"""This module contains provider of USGS data."""
|
2
|
-
|
3
|
-
import os
|
4
|
-
from datetime import datetime
|
5
|
-
|
6
|
-
import numpy as np
|
7
|
-
import requests
|
8
|
-
|
9
|
-
from maps4fs.generator.dtm.dtm import DTMProvider, DTMProviderSettings
|
10
|
-
|
11
|
-
|
12
|
-
class USGSProviderSettings(DTMProviderSettings):
|
13
|
-
"""Settings for the USGS provider."""
|
14
|
-
|
15
|
-
dataset: tuple | str = (
|
16
|
-
"Digital Elevation Model (DEM) 1 meter",
|
17
|
-
"Alaska IFSAR 5 meter DEM",
|
18
|
-
"National Elevation Dataset (NED) 1/9 arc-second",
|
19
|
-
"National Elevation Dataset (NED) 1/3 arc-second",
|
20
|
-
"National Elevation Dataset (NED) 1 arc-second",
|
21
|
-
"National Elevation Dataset (NED) Alaska 2 arc-second",
|
22
|
-
"Original Product Resolution (OPR) Digital Elevation Model (DEM)",
|
23
|
-
)
|
24
|
-
|
25
|
-
|
26
|
-
class USGSProvider(DTMProvider):
|
27
|
-
"""Provider of USGS."""
|
28
|
-
|
29
|
-
_code = "USGS"
|
30
|
-
_name = "USGS"
|
31
|
-
_region = "USA"
|
32
|
-
_icon = "🇺🇸"
|
33
|
-
_resolution = "variable"
|
34
|
-
_data: np.ndarray | None = None
|
35
|
-
_settings = USGSProviderSettings
|
36
|
-
_author = "[ZenJakey](https://github.com/ZenJakey)"
|
37
|
-
_contributors = "[kbrandwijk](https://github.com/kbrandwijk)"
|
38
|
-
_is_community = True
|
39
|
-
_instructions = None
|
40
|
-
_extents = (50.0, 17.0, -64.0, -162.0)
|
41
|
-
|
42
|
-
_url = "https://tnmaccess.nationalmap.gov/api/v1/products?prodFormats=GeoTIFF,IMG"
|
43
|
-
|
44
|
-
def download_tiles(self):
|
45
|
-
download_urls = self.get_download_urls()
|
46
|
-
all_tif_files = self.download_tif_files(download_urls, self.shared_tiff_path)
|
47
|
-
return all_tif_files
|
48
|
-
|
49
|
-
def __init__(self, *args, **kwargs):
|
50
|
-
super().__init__(*args, **kwargs)
|
51
|
-
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
52
|
-
self.shared_tiff_path = os.path.join(self._tile_directory, "shared")
|
53
|
-
os.makedirs(self.shared_tiff_path, exist_ok=True)
|
54
|
-
self.output_path = os.path.join(self._tile_directory, f"timestamp_{timestamp}")
|
55
|
-
os.makedirs(self.output_path, exist_ok=True)
|
56
|
-
|
57
|
-
def get_download_urls(self) -> list[str]:
|
58
|
-
"""Get download URLs of the GeoTIFF files from the USGS API.
|
59
|
-
|
60
|
-
Returns:
|
61
|
-
list: List of download URLs.
|
62
|
-
"""
|
63
|
-
assert self.url is not None
|
64
|
-
|
65
|
-
urls = []
|
66
|
-
try:
|
67
|
-
# Make the GET request
|
68
|
-
(north, south, east, west) = self.get_bbox()
|
69
|
-
response = requests.get(
|
70
|
-
self.url
|
71
|
-
+ f"&datasets={self.user_settings.dataset}" # type: ignore
|
72
|
-
+ f"&bbox={west},{north},{east},{south}",
|
73
|
-
timeout=60,
|
74
|
-
)
|
75
|
-
self.logger.debug("Getting file locations from USGS...")
|
76
|
-
|
77
|
-
# Check if the request was successful (HTTP status code 200)
|
78
|
-
if response.status_code == 200:
|
79
|
-
# Parse the JSON response
|
80
|
-
json_data = response.json()
|
81
|
-
items = json_data["items"]
|
82
|
-
for item in items:
|
83
|
-
urls.append(item["downloadURL"])
|
84
|
-
# self.download_tif_files(urls)
|
85
|
-
else:
|
86
|
-
self.logger.error("Failed to get data. HTTP Status Code: %s", response.status_code)
|
87
|
-
except requests.exceptions.RequestException as e:
|
88
|
-
self.logger.error("Failed to get data. Error: %s", e)
|
89
|
-
self.logger.debug("Received %s urls", len(urls))
|
90
|
-
return urls
|
File without changes
|
File without changes
|
File without changes
|