maps4fs 1.8.190__tar.gz → 1.8.192__tar.gz

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.
Files changed (65) hide show
  1. {maps4fs-1.8.190 → maps4fs-1.8.192}/PKG-INFO +1 -1
  2. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/__init__.py +1 -1
  3. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dem.py +1 -2
  4. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/arctic.py +1 -1
  5. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/baden.py +1 -1
  6. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/bavaria.py +1 -1
  7. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/canada.py +1 -1
  8. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/czech.py +3 -1
  9. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/denmark.py +4 -1
  10. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/dtm.py +7 -4
  11. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/england.py +1 -1
  12. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/finland.py +4 -1
  13. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/flanders.py +1 -1
  14. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/france.py +11 -1
  15. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/hessen.py +1 -1
  16. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/italy.py +1 -1
  17. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/mv.py +1 -1
  18. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/niedersachsen.py +1 -1
  19. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/norway.py +3 -1
  20. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/nrw.py +1 -1
  21. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/rema.py +1 -1
  22. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/sachsenanhalt.py +3 -1
  23. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/scotland.py +3 -1
  24. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/spain.py +3 -1
  25. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/switzerland.py +1 -1
  26. maps4fs-1.8.192/maps4fs/generator/dtm/usgs_wcs.py +35 -0
  27. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs.egg-info/PKG-INFO +1 -1
  28. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs.egg-info/SOURCES.txt +1 -1
  29. {maps4fs-1.8.190 → maps4fs-1.8.192}/pyproject.toml +1 -1
  30. maps4fs-1.8.190/maps4fs/generator/dtm/usgs.py +0 -90
  31. {maps4fs-1.8.190 → maps4fs-1.8.192}/LICENSE.md +0 -0
  32. {maps4fs-1.8.190 → maps4fs-1.8.192}/README.md +0 -0
  33. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/__init__.py +0 -0
  34. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/__init__.py +0 -0
  35. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/background.py +0 -0
  36. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/base/__init__.py +0 -0
  37. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/base/component.py +0 -0
  38. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/base/component_image.py +0 -0
  39. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/base/component_mesh.py +0 -0
  40. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/base/component_xml.py +0 -0
  41. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/config.py +0 -0
  42. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/grle.py +0 -0
  43. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/i3d.py +0 -0
  44. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/layer.py +0 -0
  45. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/satellite.py +0 -0
  46. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/component/texture.py +0 -0
  47. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/__init__.py +0 -0
  48. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/base/wcs.py +0 -0
  49. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/base/wms.py +0 -0
  50. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/srtm.py +0 -0
  51. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/dtm/utils.py +0 -0
  52. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/game.py +0 -0
  53. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/map.py +0 -0
  54. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/qgis.py +0 -0
  55. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/generator/settings.py +0 -0
  56. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/logger.py +0 -0
  57. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/toolbox/__init__.py +0 -0
  58. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/toolbox/background.py +0 -0
  59. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/toolbox/custom_osm.py +0 -0
  60. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs/toolbox/dem.py +0 -0
  61. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs.egg-info/dependency_links.txt +0 -0
  62. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs.egg-info/requires.txt +0 -0
  63. {maps4fs-1.8.190 → maps4fs-1.8.192}/maps4fs.egg-info/top_level.txt +0 -0
  64. {maps4fs-1.8.190 → maps4fs-1.8.192}/setup.cfg +0 -0
  65. {maps4fs-1.8.190 → maps4fs-1.8.192}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.190
3
+ Version: 1.8.192
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -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.usgs import USGSProvider, USGSProviderSettings
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
@@ -123,8 +123,7 @@ class DEM(Component):
123
123
  data = self.dtm_provider.get_numpy()
124
124
  except Exception as e: # pylint: disable=W0718
125
125
  self.logger.error("Failed to get DEM data from DTM provider: %s.", e)
126
- self._save_empty_dem(dem_output_resolution)
127
- return
126
+ raise e
128
127
 
129
128
  if len(data.shape) != 2:
130
129
  self.logger.error("DTM provider returned incorrect data: more than 1 channel.")
@@ -18,7 +18,7 @@ class ArcticProvider(DTMProvider):
18
18
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
19
19
  _is_community = True
20
20
 
21
- _extents = (83.98823036056658, 50.7492704708152, 179.99698443265999, -180)
21
+ _extents = [(83.98823036056658, 50.7492704708152, 179.99698443265999, -180)]
22
22
 
23
23
  _instructions = (
24
24
  "This provider source includes 2 meter DEM data for the entire Arctic region above 50 "
@@ -16,7 +16,7 @@ class BadenWurttembergProvider(WCSProvider, DTMProvider):
16
16
  _is_community = True
17
17
  _instructions = None
18
18
  _is_base = False
19
- _extents = (49.79645444804715, 47.52877040346605, 10.54203149250156, 7.444081717803481)
19
+ _extents = [(49.79645444804715, 47.52877040346605, 10.54203149250156, 7.444081717803481)]
20
20
 
21
21
  _url = "https://owsproxy.lgl-bw.de/owsproxy/wcs/WCS_INSP_BW_Hoehe_Coverage_DGM1"
22
22
  _wcs_version = "2.0.1"
@@ -23,7 +23,7 @@ class BavariaProvider(DTMProvider):
23
23
  _author = "[H4rdB4se](https://github.com/H4rdB4se)"
24
24
  _is_community = True
25
25
  _instructions = None
26
- _extents = (50.56, 47.25, 13.91, 8.95)
26
+ _extents = [(50.56, 47.25, 13.91, 8.95)]
27
27
 
28
28
  def __init__(self, *args, **kwargs):
29
29
  super().__init__(*args, **kwargs)
@@ -15,7 +15,7 @@ class CanadaProvider(WCSProvider, DTMProvider):
15
15
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
16
16
  _is_community = True
17
17
  _is_base = False
18
- _extents = (76.49491845750764, 33.66564101989275, -26.69697497450798, -157.7322455868316)
18
+ _extents = [(76.49491845750764, 33.66564101989275, -26.69697497450798, -157.7322455868316)]
19
19
  _instructions = (
20
20
  "HRDEM coverage for Canada is limited. Make sure to check the "
21
21
  "[coverage map](https://geo.ca/imagery/high-resolution-digital"
@@ -16,7 +16,9 @@ class CzechProvider(WCSProvider, DTMProvider):
16
16
  _is_community = True
17
17
  _instructions = None
18
18
  _is_base = False
19
- _extents = (51.0576876059846754, 48.4917065572081754, 18.9775933665038821, 12.0428143585602161)
19
+ _extents = [
20
+ (51.0576876059846754, 48.4917065572081754, 18.9775933665038821, 12.0428143585602161)
21
+ ]
20
22
 
21
23
  _url = "https://ags.cuzk.cz/arcgis2/services/INSPIRE_Nadmorska_vyska/ImageServer/WCSServer" # pylint: disable=line-too-long
22
24
  _wcs_version = "1.0.0"
@@ -22,7 +22,7 @@ class DenmarkProvider(WCSProvider, DTMProvider):
22
22
  _is_community = True
23
23
  _is_base = False
24
24
  _settings = DenmarkProviderSettings
25
- _extents = (57.7690657013977, 54.4354651516217, 15.5979112056959, 8.00830949937517)
25
+ _extents = [(57.7690657013977, 54.4354651516217, 15.5979112056959, 8.00830949937517)]
26
26
 
27
27
  _instructions = (
28
28
  "ℹ️ This provider requires an access token. See [here](https://confluence"
@@ -36,6 +36,9 @@ class DenmarkProvider(WCSProvider, DTMProvider):
36
36
  _tile_size = 1000
37
37
 
38
38
  def get_wcs_parameters(self, tile):
39
+ if not self.user_settings.token:
40
+ raise ValueError("A token is required for this provider.")
41
+
39
42
  return {
40
43
  "identifier": "dhm_terraen",
41
44
  "bbox": (tile[1], tile[0], tile[3], tile[2]),
@@ -47,7 +47,7 @@ class DTMProvider(ABC):
47
47
  _settings: Type[DTMProviderSettings] | None = DTMProviderSettings
48
48
 
49
49
  """Bounding box of the provider in the format (north, south, east, west)."""
50
- _extents: tuple[float, float, float, float] | None = None
50
+ _extents: list[tuple[float, float, float, float]] | None = None
51
51
 
52
52
  _instructions: str | None = None
53
53
 
@@ -248,9 +248,12 @@ class DTMProvider(ABC):
248
248
  """
249
249
  lat, lon = lat_lon
250
250
  extents = cls._extents
251
- return extents is None or (
252
- extents[0] >= lat >= extents[1] and extents[2] >= lon >= extents[3]
253
- )
251
+ if extents is None:
252
+ return True
253
+ for extent in extents:
254
+ if extent[0] >= lat >= extent[1] and extent[2] >= lon >= extent[3]:
255
+ return True
256
+ return False
254
257
 
255
258
  @abstractmethod
256
259
  def download_tiles(self) -> list[str]:
@@ -16,7 +16,7 @@ class England1MProvider(WCSProvider, DTMProvider):
16
16
  _is_community = True
17
17
  _instructions = None
18
18
  _is_base = False
19
- _extents = (55.87708724246775, 49.85060473351981, 2.0842821419111135, -7.104775741839742)
19
+ _extents = [(55.87708724246775, 49.85060473351981, 2.0842821419111135, -7.104775741839742)]
20
20
 
21
21
  _url = "https://environment.data.gov.uk/geoservices/datasets/13787b9a-26a4-4775-8523-806d13af58fc/wcs" # pylint: disable=line-too-long
22
22
  _wcs_version = "2.0.1"
@@ -24,7 +24,7 @@ class FinlandProvider(WCSProvider, DTMProvider):
24
24
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
25
25
  _is_community = True
26
26
  _is_base = False
27
- _extents = (70.09, 59.45, 31.59, 19.08)
27
+ _extents = [(70.09, 59.45, 31.59, 19.08)]
28
28
 
29
29
  _url = "https://avoin-karttakuva.maanmittauslaitos.fi/ortokuvat-ja-korkeusmallit/wcs/v2"
30
30
  _wcs_version = "2.0.1"
@@ -38,6 +38,9 @@ class FinlandProvider(WCSProvider, DTMProvider):
38
38
  )
39
39
 
40
40
  def get_wcs_instance_parameters(self):
41
+ if not self.user_settings.api_key:
42
+ raise ValueError("API Key is required for this provider.")
43
+
41
44
  settings = super().get_wcs_instance_parameters()
42
45
  settings["auth"] = Authentication(
43
46
  username=self.user_settings.api_key, password=self.user_settings.api_key
@@ -15,7 +15,7 @@ class FlandersProvider(WCSProvider, DTMProvider):
15
15
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
16
16
  _is_community = True
17
17
  _is_base = False
18
- _extents = (51.5150730375579684, 50.6694992827160817, 5.9444417082210812, 2.5170092434134252)
18
+ _extents = [(51.5150730375579684, 50.6694992827160817, 5.9444417082210812, 2.5170092434134252)]
19
19
 
20
20
  _url = "https://geo.api.vlaanderen.be/el-dtm/wcs"
21
21
  _wcs_version = "1.0.0"
@@ -20,7 +20,17 @@ class FranceProvider(DTMProvider):
20
20
  _url = "https://data.cquest.org/ign/rgealti/repack/cog/RGEALTI_2-0_1M_COG_LAMB93-IGN69_FXX.vrt"
21
21
  _is_base = False
22
22
  # no extents, because it also has a few colonies throughout the world
23
- # _extents = (54.148101, 51.153098, 11.754046, 6.505772)
23
+ _extents = [
24
+ (51.2, 41.333, 9.55, -5.225), # France
25
+ (8.6038842, 1.1710017, -61.414905, -56.4689543), # Guyana
26
+ (16.5144664, 15.8320085, -61.809764, -61.0003663), # Guadeloupe
27
+ (14.8787029, 14.3948596, -61.2290815, -60.8095833), # Martinique
28
+ (-12.6365902, -13.0210119, 45.0183298, 45.2999917), # Mayotte
29
+ (-20.8717136, -21.3897308, 55.2164268, 55.8366924), # Reunion
30
+ (18.1375569, 17.670931, -63.06639, -62.5844019), # Saint Barthelemy
31
+ (18.1902778, 17.8963535, -63.3605643, -62.7644063), # Saint Martin
32
+ (47.365, 46.5507173, -56.6972961, -55.9033333), # Saint Pierre and Miquelon
33
+ ]
24
34
 
25
35
  def download_tiles(self) -> list[str]:
26
36
  with rasterio.open(
@@ -15,7 +15,7 @@ class HessenProvider(WCSProvider, DTMProvider):
15
15
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
16
16
  _is_community = True
17
17
  _is_base = False
18
- _extents = (51.66698, 49.38533, 10.25780, 7.72773)
18
+ _extents = [(51.66698, 49.38533, 10.25780, 7.72773)]
19
19
 
20
20
  _url = "https://inspire-hessen.de/raster/dgm1/ows"
21
21
  _wcs_version = "2.0.1"
@@ -18,7 +18,7 @@ class ItalyProvider(WCSProvider, DTMProvider):
18
18
  _is_community = True
19
19
  _instructions = None
20
20
  _is_base = False
21
- _extents = (47.15570815704503, 35.177652867276855, 19.720144130809693, 6.527697471770745)
21
+ _extents = [(47.15570815704503, 35.177652867276855, 19.720144130809693, 6.527697471770745)]
22
22
 
23
23
  _url = "http://tinitaly.pi.ingv.it/TINItaly_1_1/wcs"
24
24
  _wcs_version = "2.0.1"
@@ -27,7 +27,7 @@ class MecklenburgVorpommernProvider(WCSProvider, DTMProvider):
27
27
  _instructions = None
28
28
  _is_base = False
29
29
  _settings = MecklenburgVorpommernProviderSettings
30
- _extents = (54.8, 53, 14.5, 10.5)
30
+ _extents = [(54.8, 53, 14.5, 10.5)]
31
31
 
32
32
  _url = "https://www.geodaten-mv.de/dienste/dgm_wcs"
33
33
  _wcs_version = "2.0.1"
@@ -20,7 +20,7 @@ class NiedersachsenProvider(WMSProvider, DTMProvider):
20
20
  "to smooth the data."
21
21
  )
22
22
  _is_base = False
23
- _extents = (54.148101, 51.153098, 11.754046, 6.505772)
23
+ _extents = [(54.148101, 51.153098, 11.754046, 6.505772)]
24
24
 
25
25
  _url = "https://opendata.lgln.niedersachsen.de/doorman/noauth/dgm_wms"
26
26
  _source_crs = "EPSG:25832"
@@ -16,7 +16,9 @@ class NorwayProvider(WCSProvider, DTMProvider):
16
16
  _is_community = True
17
17
  _instructions = None
18
18
  _is_base = False
19
- _extents = (72.1016879476356962, 57.2738836442695103, 33.3365910058243742, -2.0075617181675725)
19
+ _extents = [
20
+ (72.1016879476356962, 57.2738836442695103, 33.3365910058243742, -2.0075617181675725)
21
+ ]
20
22
 
21
23
  _instructions = (
22
24
  "This is a topobathy dataset which means it includes water depth information as well. "
@@ -15,7 +15,7 @@ class NRWProvider(WCSProvider, DTMProvider):
15
15
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
16
16
  _is_community = True
17
17
  _is_base = False
18
- _extents = (52.6008271, 50.1506045, 9.5315425, 5.8923538)
18
+ _extents = [(52.6008271, 50.1506045, 9.5315425, 5.8923538)]
19
19
 
20
20
  _url = "https://www.wcs.nrw.de/geobasis/wcs_nw_dgm"
21
21
  _wcs_version = "2.0.1"
@@ -18,7 +18,7 @@ class REMAProvider(DTMProvider):
18
18
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
19
19
  _is_community = True
20
20
 
21
- _extents = (-53.5443873459092, -53.5443873459092, 179.99698443265999, -180)
21
+ _extents = [(-53.5443873459092, -53.5443873459092, 179.99698443265999, -180)]
22
22
 
23
23
  _instructions = (
24
24
  "This provider source includes 2 meter DEM data for the entire Antarctic region below 53 "
@@ -15,7 +15,9 @@ class SachsenAnhaltProvider(WCSProvider, DTMProvider):
15
15
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
16
16
  _is_community = True
17
17
  _is_base = False
18
- _extents = (53.0769416826493412, 50.8927195980075453, 13.3232545527125836, 10.5092298520646867)
18
+ _extents = [
19
+ (53.0769416826493412, 50.8927195980075453, 13.3232545527125836, 10.5092298520646867)
20
+ ]
19
21
 
20
22
  _url = "https://www.geodatenportal.sachsen-anhalt.de/wss/service/ST_LVermGeo_DGM1_WCS_OpenData/guest" # pylint: disable=line-too-long
21
23
  _wcs_version = "1.0.0"
@@ -58,7 +58,9 @@ class ScotlandProvider(DTMProvider):
58
58
  "Coverage for Scotland is very limited. "
59
59
  "Make sure to check the [coverage map](https://remotesensingdata.gov.scot/data#/map)."
60
60
  )
61
- _extents = (60.2151105070992756, 54.5525982243521881, -1.1045617513147328, -6.7070796770431951)
61
+ _extents = [
62
+ (60.2151105070992756, 54.5525982243521881, -1.1045617513147328, -6.7070796770431951)
63
+ ]
62
64
 
63
65
  _url = "https://srsp-catalog.jncc.gov.uk/search/product"
64
66
 
@@ -15,7 +15,9 @@ class SpainProvider(WCSProvider, DTMProvider):
15
15
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
16
16
  _is_community = True
17
17
  _is_base = False
18
- _extents = (43.9299999999999997, 27.6299999999999990, 4.9400000000000004, -18.2100000000000009)
18
+ _extents = [
19
+ (43.9299999999999997, 27.6299999999999990, 4.9400000000000004, -18.2100000000000009)
20
+ ]
19
21
 
20
22
  _url = "https://servicios.idee.es/wcs-inspire/mdt"
21
23
  _wcs_version = "2.0.1"
@@ -27,7 +27,7 @@ class SwitzerlandProvider(DTMProvider):
27
27
  _author = "[kbrandwijk](https://github.com/kbrandwijk)"
28
28
  _is_community = True
29
29
 
30
- _extents = (47.8308275417, 45.7769477403, 10.4427014502, 6.02260949059)
30
+ _extents = [(47.8308275417, 45.7769477403, 10.4427014502, 6.02260949059)]
31
31
 
32
32
  _url = (
33
33
  "https://ogd.swisstopo.admin.ch/services/swiseld/"
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.190
3
+ Version: 1.8.192
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -51,7 +51,7 @@ maps4fs/generator/dtm/scotland.py
51
51
  maps4fs/generator/dtm/spain.py
52
52
  maps4fs/generator/dtm/srtm.py
53
53
  maps4fs/generator/dtm/switzerland.py
54
- maps4fs/generator/dtm/usgs.py
54
+ maps4fs/generator/dtm/usgs_wcs.py
55
55
  maps4fs/generator/dtm/utils.py
56
56
  maps4fs/generator/dtm/base/wcs.py
57
57
  maps4fs/generator/dtm/base/wms.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "1.8.190"
7
+ version = "1.8.192"
8
8
  description = "Generate map templates for Farming Simulator from real places."
9
9
  authors = [{name = "iwatkot", email = "iwatkot@gmail.com"}]
10
10
  license = {text = "MIT License"}
@@ -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
File without changes