maps4fs 1.8.247__tar.gz → 1.8.249__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 (67) hide show
  1. {maps4fs-1.8.247 → maps4fs-1.8.249}/PKG-INFO +4 -2
  2. {maps4fs-1.8.247 → maps4fs-1.8.249}/README.md +1 -0
  3. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/__init__.py +1 -0
  4. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/dtm.py +20 -6
  5. maps4fs-1.8.249/maps4fs/generator/dtm/thuringia.py +60 -0
  6. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs.egg-info/PKG-INFO +4 -2
  7. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs.egg-info/SOURCES.txt +1 -0
  8. {maps4fs-1.8.247 → maps4fs-1.8.249}/pyproject.toml +1 -1
  9. {maps4fs-1.8.247 → maps4fs-1.8.249}/LICENSE.md +0 -0
  10. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/__init__.py +0 -0
  11. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/__init__.py +0 -0
  12. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/__init__.py +0 -0
  13. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/background.py +0 -0
  14. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/base/__init__.py +0 -0
  15. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/base/component.py +0 -0
  16. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/base/component_image.py +0 -0
  17. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/base/component_mesh.py +0 -0
  18. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/base/component_xml.py +0 -0
  19. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/config.py +0 -0
  20. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/grle.py +0 -0
  21. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/i3d.py +0 -0
  22. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/layer.py +0 -0
  23. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/satellite.py +0 -0
  24. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/component/texture.py +0 -0
  25. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dem.py +0 -0
  26. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/arctic.py +0 -0
  27. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/baden.py +0 -0
  28. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/base/wcs.py +0 -0
  29. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/base/wms.py +0 -0
  30. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/bavaria.py +0 -0
  31. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/canada.py +0 -0
  32. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/czech.py +0 -0
  33. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/denmark.py +0 -0
  34. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/england.py +0 -0
  35. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/finland.py +0 -0
  36. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/flanders.py +0 -0
  37. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/france.py +0 -0
  38. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/hessen.py +0 -0
  39. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/italy.py +0 -0
  40. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/lithuania.py +0 -0
  41. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/mv.py +0 -0
  42. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/niedersachsen.py +0 -0
  43. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/norway.py +0 -0
  44. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/nrw.py +0 -0
  45. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/rema.py +0 -0
  46. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/sachsenanhalt.py +0 -0
  47. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/scotland.py +0 -0
  48. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/spain.py +0 -0
  49. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/srtm.py +0 -0
  50. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/switzerland.py +0 -0
  51. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/usgs_wcs.py +0 -0
  52. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/dtm/utils.py +0 -0
  53. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/game.py +0 -0
  54. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/map.py +0 -0
  55. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/qgis.py +0 -0
  56. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/settings.py +0 -0
  57. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/generator/statistics.py +0 -0
  58. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/logger.py +0 -0
  59. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/toolbox/__init__.py +0 -0
  60. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/toolbox/background.py +0 -0
  61. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/toolbox/custom_osm.py +0 -0
  62. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs/toolbox/dem.py +0 -0
  63. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs.egg-info/dependency_links.txt +0 -0
  64. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs.egg-info/requires.txt +0 -0
  65. {maps4fs-1.8.247 → maps4fs-1.8.249}/maps4fs.egg-info/top_level.txt +0 -0
  66. {maps4fs-1.8.247 → maps4fs-1.8.249}/setup.cfg +0 -0
  67. {maps4fs-1.8.247 → maps4fs-1.8.249}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 1.8.247
3
+ Version: 1.8.249
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
@@ -27,6 +27,7 @@ Requires-Dist: pygmdl
27
27
  Requires-Dist: owslib
28
28
  Requires-Dist: tqdm
29
29
  Requires-Dist: scipy
30
+ Dynamic: license-file
30
31
 
31
32
  <div align="center" markdown>
32
33
  <a href="https://discord.gg/Sj5QKKyE42">
@@ -730,6 +731,7 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
730
731
  | 🇩🇪 Mecklenburg-Vorpommern, Germany | 1-25 meter | [kbrandwijk](https://github.com/kbrandwijk) |
731
732
  | 🇩🇪 Baden-Württemberg, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
732
733
  | 🇩🇪 Sachsen-Anhalt, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
734
+ | 🇩🇪 Thüringen, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
733
735
  | 🇨🇦 Canada | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
734
736
  | 🇧🇪 Flanders, Belgium | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
735
737
  | 🇫🇷 France | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
@@ -700,6 +700,7 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
700
700
  | 🇩🇪 Mecklenburg-Vorpommern, Germany | 1-25 meter | [kbrandwijk](https://github.com/kbrandwijk) |
701
701
  | 🇩🇪 Baden-Württemberg, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
702
702
  | 🇩🇪 Sachsen-Anhalt, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
703
+ | 🇩🇪 Thüringen, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
703
704
  | 🇨🇦 Canada | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
704
705
  | 🇧🇪 Flanders, Belgium | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
705
706
  | 🇫🇷 France | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
@@ -22,4 +22,5 @@ from maps4fs.generator.dtm.scotland import ScotlandProvider
22
22
  from maps4fs.generator.dtm.spain import SpainProvider
23
23
  from maps4fs.generator.dtm.srtm import SRTM30Provider
24
24
  from maps4fs.generator.dtm.switzerland import SwitzerlandProvider
25
+ from maps4fs.generator.dtm.thuringia import ThuringiaProvider
25
26
  from maps4fs.generator.dtm.usgs_wcs import USGSWCSProvider
@@ -404,17 +404,31 @@ class DTMProvider(ABC):
404
404
 
405
405
  Returns:
406
406
  str: Path to the unzipped file.
407
+
408
+ Raises:
409
+ FileNotFoundError: If no .img or .tif file is found in the zip file
407
410
  """
408
411
  file_path = os.path.join(output_path, file_name)
409
412
  img_file_name = file_name.replace(".zip", ".img")
413
+ tif_file_name = file_name.replace(".zip", ".tif")
410
414
  img_file_path = os.path.join(output_path, img_file_name)
411
- if not os.path.exists(img_file_path):
412
- with ZipFile(file_path, "r") as f_in:
413
- f_in.extract(img_file_name, output_path)
414
- self.logger.debug("Unzipped file %s to %s", file_name, img_file_name)
415
- else:
415
+ tif_file_path = os.path.join(output_path, tif_file_name)
416
+ if os.path.exists(img_file_path):
416
417
  self.logger.debug("File already exists: %s", img_file_name)
417
- return img_file_path
418
+ return img_file_path
419
+ if os.path.exists(tif_file_path):
420
+ self.logger.debug("File already exists: %s", tif_file_name)
421
+ return tif_file_path
422
+ with ZipFile(file_path, "r") as f_in:
423
+ if img_file_name in f_in.namelist():
424
+ f_in.extract(img_file_name, output_path)
425
+ self.logger.debug("Unzipped file %s to %s", file_name, img_file_name)
426
+ return img_file_path
427
+ if tif_file_name in f_in.namelist():
428
+ f_in.extract(tif_file_name, output_path)
429
+ self.logger.debug("Unzipped file %s to %s", file_name, tif_file_name)
430
+ return tif_file_path
431
+ raise FileNotFoundError("No .img or .tif file found in the zip file.")
418
432
 
419
433
  def reproject_geotiff(self, input_tiff: str) -> str:
420
434
  """Reproject a GeoTIFF file to a new coordinate reference system (CRS).
@@ -0,0 +1,60 @@
1
+ """This module contains provider of Thuringia data."""
2
+
3
+ import os
4
+ from maps4fs.generator.dtm import utils
5
+ from maps4fs.generator.dtm.dtm import DTMProvider
6
+
7
+ class ThuringiaProvider(DTMProvider):
8
+ """Provider of Thuringia data.
9
+ Data is provided by the Kompetenzzentrum Geodateninfrastruktur Thüringen (© GDI-Th) and available
10
+ at https://geoportal.thueringen.de/gdi-th/download-offene-geodaten/download-hoehendaten under BY 2.0 license.
11
+ """
12
+ _code = "thuringia"
13
+ _name = "Thüringen DGM1"
14
+ _region = "DE"
15
+ _icon = "🇩🇪󠁥󠁢󠁹󠁿"
16
+ _resolution = 1
17
+ _author = "[H4rdB4se](https://github.com/H4rdB4se)"
18
+ _is_community = True
19
+ _instructions = None
20
+ _extents = [(51.5997, 50.2070, 12.69674, 9.8548)]
21
+
22
+ def __init__(self, *args, **kwargs):
23
+ super().__init__(*args, **kwargs)
24
+ self.tiff_path = os.path.join(self._tile_directory, "tiffs")
25
+ os.makedirs(self.tiff_path, exist_ok=True)
26
+
27
+ def download_tiles(self) -> list[str]:
28
+ bbox = self.get_bbox()
29
+ west, east, north, south = utils.transform_bbox(bbox, "EPSG:25832")
30
+ download_urls = self.get_download_urls(north, south, east, west)
31
+ all_tif_files = self.download_tif_files(download_urls, self.tiff_path)
32
+ return all_tif_files
33
+
34
+ @staticmethod
35
+ def get_first_n_digits(value: float, digits: int) -> int:
36
+ """Get the first n digits of a number."""
37
+ return int(str(value)[:digits])
38
+
39
+ def get_download_urls(self, north: float, south: float, east: float, west: float) -> list[str]:
40
+ """Calculate all possible tiles within the bounding box.
41
+
42
+ Args:
43
+ north (float): Northern boundary.
44
+ south (float): Southern boundary.
45
+ east (float): Eastern boundary.
46
+ west (float): Western boundary.
47
+
48
+ Returns:
49
+ list: List of tile names.
50
+ """
51
+ urls = []
52
+ lat = self.get_first_n_digits(south, 4)
53
+ while lat <= self.get_first_n_digits(north, 4):
54
+ lon = self.get_first_n_digits(west, 3)
55
+ while lon <= self.get_first_n_digits(east, 3):
56
+ tile_url = f"https://geoportal.geoportal-th.de/hoehendaten/DGM/dgm_2020-2025/dgm1_32_{lon}_{lat}_1_th_2020-2025.zip"
57
+ urls.append(tile_url)
58
+ lon += 1
59
+ lat += 1
60
+ return urls
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 1.8.247
3
+ Version: 1.8.249
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
@@ -27,6 +27,7 @@ Requires-Dist: pygmdl
27
27
  Requires-Dist: owslib
28
28
  Requires-Dist: tqdm
29
29
  Requires-Dist: scipy
30
+ Dynamic: license-file
30
31
 
31
32
  <div align="center" markdown>
32
33
  <a href="https://discord.gg/Sj5QKKyE42">
@@ -730,6 +731,7 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
730
731
  | 🇩🇪 Mecklenburg-Vorpommern, Germany | 1-25 meter | [kbrandwijk](https://github.com/kbrandwijk) |
731
732
  | 🇩🇪 Baden-Württemberg, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
732
733
  | 🇩🇪 Sachsen-Anhalt, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
734
+ | 🇩🇪 Thüringen, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
733
735
  | 🇨🇦 Canada | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
734
736
  | 🇧🇪 Flanders, Belgium | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
735
737
  | 🇫🇷 France | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
@@ -53,6 +53,7 @@ maps4fs/generator/dtm/scotland.py
53
53
  maps4fs/generator/dtm/spain.py
54
54
  maps4fs/generator/dtm/srtm.py
55
55
  maps4fs/generator/dtm/switzerland.py
56
+ maps4fs/generator/dtm/thuringia.py
56
57
  maps4fs/generator/dtm/usgs_wcs.py
57
58
  maps4fs/generator/dtm/utils.py
58
59
  maps4fs/generator/dtm/base/wcs.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "1.8.247"
7
+ version = "1.8.249"
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"}
File without changes
File without changes
File without changes
File without changes