maps4fs 1.8.187__py3-none-any.whl → 1.8.189__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 CHANGED
@@ -19,6 +19,10 @@ from maps4fs.generator.dtm.denmark import DenmarkProvider
19
19
  from maps4fs.generator.dtm.switzerland import SwitzerlandProvider
20
20
  from maps4fs.generator.dtm.mv import MecklenburgVorpommernProvider
21
21
  from maps4fs.generator.dtm.baden import BadenWurttembergProvider
22
+ from maps4fs.generator.dtm.arctic import ArcticProvider
23
+ from maps4fs.generator.dtm.rema import REMAProvider
24
+ from maps4fs.generator.dtm.czech import CzechProvider
25
+ from maps4fs.generator.dtm.sachsenanhalt import SachsenAnhaltProvider
22
26
  from maps4fs.generator.game import Game
23
27
  from maps4fs.generator.map import Map
24
28
  from maps4fs.generator.settings import (
@@ -0,0 +1,75 @@
1
+ """This module contains provider of Arctic data."""
2
+
3
+ import os
4
+
5
+ import requests
6
+
7
+ from maps4fs.generator.dtm.dtm import DTMProvider
8
+
9
+
10
+ class ArcticProvider(DTMProvider):
11
+ """Provider of Arctic data."""
12
+
13
+ _code = "arctic"
14
+ _name = "ArcticDEM"
15
+ _region = "Global"
16
+ _icon = "🌍"
17
+ _resolution = 2
18
+ _author = "[kbrandwijk](https://github.com/kbrandwijk)"
19
+ _is_community = True
20
+
21
+ _extents = (83.98823036056658, 50.7492704708152, 179.99698443265999, -180)
22
+
23
+ _instructions = (
24
+ "This provider source includes 2 meter DEM data for the entire Arctic region above 50 "
25
+ "degrees North. The tiles are very big, around 1 GB each, so downloading and processing "
26
+ "them can take a long time."
27
+ )
28
+
29
+ _url = "https://stac.pgc.umn.edu/api/v1/collections/arcticdem-mosaics-v4.1-2m/items"
30
+
31
+ def download_tiles(self):
32
+ download_urls = self.get_download_urls()
33
+ all_tif_files = self.download_tif_files(download_urls, self.shared_tiff_path)
34
+ return all_tif_files
35
+
36
+ def __init__(self, *args, **kwargs):
37
+ super().__init__(*args, **kwargs)
38
+ self.shared_tiff_path = os.path.join(self._tile_directory, "shared")
39
+ os.makedirs(self.shared_tiff_path, exist_ok=True)
40
+
41
+ def get_download_urls(self) -> list[str]:
42
+ """Get download URLs of the GeoTIFF files from the OGC API.
43
+
44
+ Returns:
45
+ list: List of download URLs.
46
+ """
47
+ urls = []
48
+
49
+ try:
50
+ # Make the GET request
51
+ north, south, east, west = self.get_bbox()
52
+ print(north, south, east, west)
53
+ response = requests.get( # pylint: disable=W3101
54
+ self.url, # type: ignore
55
+ params={
56
+ "bbox": f"{west},{south},{east},{north}",
57
+ "limit": "100",
58
+ },
59
+ timeout=60,
60
+ )
61
+ self.logger.debug("Getting file locations from ArcticDEM OGC API...")
62
+
63
+ # Check if the request was successful (HTTP status code 200)
64
+ if response.status_code == 200:
65
+ # Parse the JSON response
66
+ json_data = response.json()
67
+ items = json_data["features"]
68
+ for item in items:
69
+ urls.append(item["assets"]["dem"]["href"])
70
+ else:
71
+ self.logger.error("Failed to get data. HTTP Status Code: %s", response.status_code)
72
+ except requests.exceptions.RequestException as e:
73
+ self.logger.error("Failed to get data. Error: %s", e)
74
+ self.logger.debug("Received %s urls", len(urls))
75
+ return urls
@@ -0,0 +1,35 @@
1
+ """This module contains provider of Czech data."""
2
+
3
+ from maps4fs.generator.dtm.base.wcs import WCSProvider
4
+ from maps4fs.generator.dtm.dtm import DTMProvider
5
+
6
+
7
+ class CzechProvider(WCSProvider, DTMProvider):
8
+ """Provider of Czech data."""
9
+
10
+ _code = "czech"
11
+ _name = "Czech Republic"
12
+ _region = "CZ"
13
+ _icon = "🇨🇿"
14
+ _resolution = 5
15
+ _author = "[kbrandwijk](https://github.com/kbrandwijk)"
16
+ _is_community = True
17
+ _instructions = None
18
+ _is_base = False
19
+ _extents = (51.0576876059846754, 48.4917065572081754, 18.9775933665038821, 12.0428143585602161)
20
+
21
+ _url = "https://ags.cuzk.cz/arcgis2/services/INSPIRE_Nadmorska_vyska/ImageServer/WCSServer" # pylint: disable=line-too-long
22
+ _wcs_version = "1.0.0"
23
+ _source_crs = "EPSG:4326"
24
+ _tile_size = 0.05
25
+
26
+ def get_wcs_parameters(self, tile):
27
+ print("tile", tile)
28
+ return {
29
+ "identifier": "MD_LAS",
30
+ "crs": "EPSG:4326",
31
+ "bbox": tile,
32
+ "width": 1000,
33
+ "height": 1000,
34
+ "format": "GeoTIFF",
35
+ }
@@ -0,0 +1,75 @@
1
+ """This module contains provider of Antarctic data."""
2
+
3
+ import os
4
+
5
+ import requests
6
+
7
+ from maps4fs.generator.dtm.dtm import DTMProvider
8
+
9
+
10
+ class REMAProvider(DTMProvider):
11
+ """Provider of Antarctic data."""
12
+
13
+ _code = "rema"
14
+ _name = "REMA Antarctica"
15
+ _region = "Global"
16
+ _icon = "🌍"
17
+ _resolution = 2
18
+ _author = "[kbrandwijk](https://github.com/kbrandwijk)"
19
+ _is_community = True
20
+
21
+ _extents = (-53.5443873459092, -53.5443873459092, 179.99698443265999, -180)
22
+
23
+ _instructions = (
24
+ "This provider source includes 2 meter DEM data for the entire Antarctic region below 53 "
25
+ "degrees South. The tiles are very big, around 1 GB each, so downloading and processing "
26
+ "them can take a long time."
27
+ )
28
+
29
+ _url = "https://stac.pgc.umn.edu/api/v1/collections/rema-mosaics-v2.0-2m/items"
30
+
31
+ def download_tiles(self):
32
+ download_urls = self.get_download_urls()
33
+ all_tif_files = self.download_tif_files(download_urls, self.shared_tiff_path)
34
+ return all_tif_files
35
+
36
+ def __init__(self, *args, **kwargs):
37
+ super().__init__(*args, **kwargs)
38
+ self.shared_tiff_path = os.path.join(self._tile_directory, "shared")
39
+ os.makedirs(self.shared_tiff_path, exist_ok=True)
40
+
41
+ def get_download_urls(self) -> list[str]:
42
+ """Get download URLs of the GeoTIFF files from the OGC API.
43
+
44
+ Returns:
45
+ list: List of download URLs.
46
+ """
47
+ urls = []
48
+
49
+ try:
50
+ # Make the GET request
51
+ north, south, east, west = self.get_bbox()
52
+ print(north, south, east, west)
53
+ response = requests.get( # pylint: disable=W3101
54
+ self.url, # type: ignore
55
+ params={
56
+ "bbox": f"{west},{south},{east},{north}",
57
+ "limit": "100",
58
+ },
59
+ timeout=60,
60
+ )
61
+ self.logger.debug("Getting file locations from REMA OGC API...")
62
+
63
+ # Check if the request was successful (HTTP status code 200)
64
+ if response.status_code == 200:
65
+ # Parse the JSON response
66
+ json_data = response.json()
67
+ items = json_data["features"]
68
+ for item in items:
69
+ urls.append(item["assets"]["dem"]["href"])
70
+ else:
71
+ self.logger.error("Failed to get data. HTTP Status Code: %s", response.status_code)
72
+ except requests.exceptions.RequestException as e:
73
+ self.logger.error("Failed to get data. Error: %s", e)
74
+ self.logger.debug("Received %s urls", len(urls))
75
+ return urls
@@ -0,0 +1,34 @@
1
+ """This module contains provider of Sachsen-Anhalt data."""
2
+
3
+ from maps4fs.generator.dtm.base.wcs import WCSProvider
4
+ from maps4fs.generator.dtm.dtm import DTMProvider
5
+
6
+
7
+ class SachsenAnhaltProvider(WCSProvider, DTMProvider):
8
+ """Provider of Sachsen-Anhalt data."""
9
+
10
+ _code = "sachsen-anhalt"
11
+ _name = "Sachsen-Anhalt"
12
+ _region = "DE"
13
+ _icon = "🇩🇪"
14
+ _resolution = 1
15
+ _author = "[kbrandwijk](https://github.com/kbrandwijk)"
16
+ _is_community = True
17
+ _is_base = False
18
+ _extents = (53.0769416826493412, 50.8927195980075453, 13.3232545527125836, 10.5092298520646867)
19
+
20
+ _url = "https://www.geodatenportal.sachsen-anhalt.de/wss/service/ST_LVermGeo_DGM1_WCS_OpenData/guest" # pylint: disable=line-too-long
21
+ _wcs_version = "1.0.0"
22
+ _source_crs = "EPSG:4326"
23
+ _tile_size = 0.02
24
+
25
+ def get_wcs_parameters(self, tile: tuple[float, float, float, float]) -> dict:
26
+ return {
27
+ "identifier": "1",
28
+ "bbox": tile,
29
+ "format": "GeoTIFF",
30
+ "crs": "EPSG:4326",
31
+ "width": 1000,
32
+ "height": 1000,
33
+ "timeout": 600,
34
+ }
@@ -15,6 +15,8 @@ from maps4fs.generator.dtm.dtm import DTMProvider, DTMProviderSettings
15
15
  class SRTM30ProviderSettings(DTMProviderSettings):
16
16
  """Settings for SRTM 30m provider."""
17
17
 
18
+ test: int = 10
19
+
18
20
 
19
21
  class SRTM30Provider(DTMProvider):
20
22
  """Provider of Shuttle Radar Topography Mission (SRTM) 30m data."""
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import re
5
6
  from typing import Any
6
7
 
7
8
  from pydantic import BaseModel, ConfigDict
@@ -80,10 +81,25 @@ class SettingsModel(BaseModel):
80
81
  if isinstance(value, (list, tuple)):
81
82
  subclass_data[key] = value[0]
82
83
 
83
- settings[subclass.__name__] = subclass(**subclass_data)
84
+ settings[cls.camel_to_snake(subclass.__name__)] = subclass(**subclass_data)
84
85
 
85
86
  return settings
86
87
 
88
+ @staticmethod
89
+ def camel_to_snake(camel_string: str) -> str:
90
+ """Convert a camel case string to snake case.
91
+
92
+ Arguments:
93
+ camel_string (str): Camel case string.
94
+
95
+ Returns:
96
+ str: Snake case string.
97
+ """
98
+ splitted = re.split(r"(Settings)", camel_string)
99
+ print(splitted) # For debugging
100
+ joined = "_".join(part.lower() for part in splitted if part)
101
+ return joined
102
+
87
103
  @classmethod
88
104
  def all_settings(cls) -> list[SettingsModel]:
89
105
  """Get all settings of the current class and its subclasses.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.187
3
+ Version: 1.8.189
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
@@ -686,13 +686,15 @@ The generator supports adding the own DTM providers, please refer to the [DTM Pr
686
686
 
687
687
  ### Supported DTM providers
688
688
 
689
- ![coverage map](https://github.com/user-attachments/assets/e02a4b5e-c5a9-4e6f-826f-048081704ef9)
689
+ ![coverage map](https://github.com/user-attachments/assets/be5c5ce1-7318-4352-97eb-efba7ec587cd)
690
690
 
691
691
  In addition to SRTM 30m, which provides global coverage, the map above highlights all countries and/or regions where higher resolution coverage is provided by one of the DTM providers.
692
692
 
693
693
  | Provider Name | Resolution | Developer |
694
694
  | ---------------------------------- | ------------ | ------------------------------------------- |
695
695
  | 🌎 SRTM30 | 30 meters | [iwatkot](https://github.com/iwatkot) |
696
+ | 🌎 ArcticDEM | 2 meters | [kbrandwijk](https://github.com/kbrandwijk) |
697
+ | 🌎 REMA Antarctica | 2 meters | [kbrandwijk](https://github.com/kbrandwijk) |
696
698
  | 🇺🇸 USGS | 1-90 meters | [ZenJakey](https://github.com/ZenJakey) |
697
699
  | 🏴󠁧󠁢󠁥󠁮󠁧󠁿 England | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
698
700
  | 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland | 0.25-1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
@@ -702,6 +704,7 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
702
704
  | 🇩🇪 Nordrhein-Westfalen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
703
705
  | 🇩🇪 Mecklenburg-Vorpommern, Germany | 1-25 meter | [kbrandwijk](https://github.com/kbrandwijk) |
704
706
  | 🇩🇪 Baden-Württemberg, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
707
+ | 🇩🇪 Sachsen-Anhalt, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
705
708
  | 🇨🇦 Canada | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
706
709
  | 🇧🇪 Flanders, Belgium | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
707
710
  | 🇫🇷 France | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
@@ -711,6 +714,7 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
711
714
  | 🇫🇮 Finland | 2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
712
715
  | 🇩🇰 Denmark | 0.4 meter | [kbrandwijk](https://github.com/kbrandwijk) |
713
716
  | 🇨🇭 Switzerland | 0.5-2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
717
+ | 🇨🇿 Czech Republic | 5 meter | [kbrandwijk](https://github.com/kbrandwijk) |
714
718
 
715
719
  ## Special thanks
716
720
 
@@ -1,11 +1,11 @@
1
- maps4fs/__init__.py,sha256=nKKMY2PGVAluIcIdLp5sgspSDCBDriF3iE8Pd6xyKWI,1563
1
+ maps4fs/__init__.py,sha256=x7Ce7Puzh6hp7fKlE9AiVWzvijVOPnH3Up8_1TWdd6A,1795
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
5
5
  maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,11292
6
6
  maps4fs/generator/map.py,sha256=BV7OTrv3zHud6DbTGpm3TU5JNWJlKgRhZUGfs_wxntw,11513
7
7
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
8
- maps4fs/generator/settings.py,sha256=cFlN-gK8QcySqyPtcGm-2fLnxQnlmC3Y9kQufJxwI3Y,6270
8
+ maps4fs/generator/settings.py,sha256=g1RJBAHHr_nqUyq4GavG6wO26euBHTZgGrjaY52iUh8,6749
9
9
  maps4fs/generator/component/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
10
10
  maps4fs/generator/component/background.py,sha256=IF56eQ2eHM37kdK1kz2vEFt-s88Esn9XKex_TbWtUZY,18800
11
11
  maps4fs/generator/component/config.py,sha256=RitKgFDZPzjA1fi8GcEi1na75qqaueUvpcITHjBvCXc,3674
@@ -20,9 +20,11 @@ maps4fs/generator/component/base/component_image.py,sha256=2QnJ9xm0D54v4whg7bc1s
20
20
  maps4fs/generator/component/base/component_mesh.py,sha256=43JY8X0ugIWAJq5y11vTJM9UfbL7SSugj8LkdPmni10,8871
21
21
  maps4fs/generator/component/base/component_xml.py,sha256=6OO1dKoceO1ACk7-k1oGtnkfNud8ZN3u3ZNjdNMpTqw,3967
22
22
  maps4fs/generator/dtm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ maps4fs/generator/dtm/arctic.py,sha256=4_4O6rArtTJCSTknrBeP5IjLi2QN3v9xmbmm5qiiWL0,2629
23
24
  maps4fs/generator/dtm/baden.py,sha256=69nyaY-6lwrXyNcWlOGPzXQK726COiRJGE2UvADqaZQ,1039
24
25
  maps4fs/generator/dtm/bavaria.py,sha256=7njrEvSCYAC8ZVyvS-_84iXHhWA0oHKrEqSzxdnZuGs,4293
25
26
  maps4fs/generator/dtm/canada.py,sha256=lYONwm6aNX5cjVggR3AiZZF9dlCDAWg0M8RMaObog8s,1288
27
+ maps4fs/generator/dtm/czech.py,sha256=I0hK7jUfp10LM-18vFGcqe9-y3uVJDXLlrzB3l_fZ8A,1070
26
28
  maps4fs/generator/dtm/denmark.py,sha256=GMB9PPxXth6V1v3XuURVWVabJf4xlr158bKfeIIisek,1476
27
29
  maps4fs/generator/dtm/dtm.py,sha256=eTegemDvvbDekxPJA8SJFgtTAwVLi5jfDXa3FxJHsyE,16845
28
30
  maps4fs/generator/dtm/england.py,sha256=YyCYwnNUJuBeeMNUozfKIj_yNjHpGeuH1Mz0NiAJL-U,1122
@@ -35,9 +37,11 @@ maps4fs/generator/dtm/mv.py,sha256=6ropUQGY_cnkvzmZqiYg53MxzkP2tXXzslVaAbJPd1E,1
35
37
  maps4fs/generator/dtm/niedersachsen.py,sha256=8HS8suZU3lKe2mPR1FVCSNHSsW5AuebIu_De3mpCQe8,1273
36
38
  maps4fs/generator/dtm/norway.py,sha256=kSsNZGEqb3IQ3a82UCJ_Iw_0wqdCgEvuRJ4JpEK7QYU,1269
37
39
  maps4fs/generator/dtm/nrw.py,sha256=1zMa10O0NdQbiTwOa7XXGrx3NhdHUqRXI4yBn_Scb2M,958
40
+ maps4fs/generator/dtm/rema.py,sha256=oCjFFcycBaDp2sJ8VYSzcH5kgQ_lvbLxYwsBnT7C5bI,2631
41
+ maps4fs/generator/dtm/sachsenanhalt.py,sha256=-Vjw3f8k1JtSpTGI07vbpmyF5TU0wvGt2VCmJnPmL5M,1128
38
42
  maps4fs/generator/dtm/scotland.py,sha256=Od4dDMuCM_iteewjGBbmZXJ26S0bDwrhRhXeV4HyyOA,4803
39
43
  maps4fs/generator/dtm/spain.py,sha256=HxN0MvrtRqqeTmhl47q60-1DGaMDb2wq6neMcDlDCl8,1005
40
- maps4fs/generator/dtm/srtm.py,sha256=ob6AUuEn3G3G9kdqTA2VhT335N65RRBJsqAfHuw0gA8,4502
44
+ maps4fs/generator/dtm/srtm.py,sha256=hQJC8yf1WgC7PPoQ36AkXTPMEFp7l-cwHAEGA_2GAqQ,4522
41
45
  maps4fs/generator/dtm/switzerland.py,sha256=GC5fbWL5kkiWksB-H4dWl4I7GSmOsUZ_ywPpfkxBTo8,3547
42
46
  maps4fs/generator/dtm/usgs.py,sha256=1XzLP5GJbe6xcqzkOrEBUtR2SPw7gm6rl1nw5YXmBP8,3253
43
47
  maps4fs/generator/dtm/utils.py,sha256=I-wUSA_J85Xbt8sZCZAVKHSIcrMj5Ng-0adtPVhVmk0,2315
@@ -47,8 +51,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
47
51
  maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
48
52
  maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
49
53
  maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
50
- maps4fs-1.8.187.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
51
- maps4fs-1.8.187.dist-info/METADATA,sha256=qAJxxbv2n4e87XZeC61IXX6RgOnsYuys4dxFptebSPo,44584
52
- maps4fs-1.8.187.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
53
- maps4fs-1.8.187.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
54
- maps4fs-1.8.187.dist-info/RECORD,,
54
+ maps4fs-1.8.189.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
55
+ maps4fs-1.8.189.dist-info/METADATA,sha256=JpuNlKdUerJYHpVjuW8lAoaluyFRDr2U5HdFPUYTy6k,45000
56
+ maps4fs-1.8.189.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
57
+ maps4fs-1.8.189.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
58
+ maps4fs-1.8.189.dist-info/RECORD,,