maps4fs 1.8.177__tar.gz → 1.8.179__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 (57) hide show
  1. {maps4fs-1.8.177 → maps4fs-1.8.179}/PKG-INFO +4 -2
  2. {maps4fs-1.8.177 → maps4fs-1.8.179}/README.md +3 -1
  3. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/__init__.py +1 -0
  4. maps4fs-1.8.179/maps4fs/generator/dtm/switzerland.py +104 -0
  5. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs.egg-info/PKG-INFO +4 -2
  6. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs.egg-info/SOURCES.txt +1 -0
  7. {maps4fs-1.8.177 → maps4fs-1.8.179}/pyproject.toml +1 -1
  8. {maps4fs-1.8.177 → maps4fs-1.8.179}/LICENSE.md +0 -0
  9. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/__init__.py +0 -0
  10. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/__init__.py +0 -0
  11. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/background.py +0 -0
  12. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/base/__init__.py +0 -0
  13. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/base/component.py +0 -0
  14. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/base/component_image.py +0 -0
  15. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/base/component_mesh.py +0 -0
  16. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/base/component_xml.py +0 -0
  17. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/config.py +0 -0
  18. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/grle.py +0 -0
  19. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/i3d.py +0 -0
  20. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/component/satellite.py +0 -0
  21. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dem.py +0 -0
  22. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/__init__.py +0 -0
  23. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/base/wcs.py +0 -0
  24. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/base/wms.py +0 -0
  25. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/bavaria.py +0 -0
  26. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/canada.py +0 -0
  27. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/denmark.py +0 -0
  28. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/dtm.py +0 -0
  29. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/england.py +0 -0
  30. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/finland.py +0 -0
  31. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/flanders.py +0 -0
  32. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/france.py +0 -0
  33. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/hessen.py +0 -0
  34. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/italy.py +0 -0
  35. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/niedersachsen.py +0 -0
  36. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/norway.py +0 -0
  37. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/nrw.py +0 -0
  38. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/scotland.py +0 -0
  39. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/spain.py +0 -0
  40. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/srtm.py +0 -0
  41. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/usgs.py +0 -0
  42. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/dtm/utils.py +0 -0
  43. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/game.py +0 -0
  44. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/map.py +0 -0
  45. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/qgis.py +0 -0
  46. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/settings.py +0 -0
  47. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/generator/texture.py +0 -0
  48. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/logger.py +0 -0
  49. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/toolbox/__init__.py +0 -0
  50. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/toolbox/background.py +0 -0
  51. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/toolbox/custom_osm.py +0 -0
  52. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs/toolbox/dem.py +0 -0
  53. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs.egg-info/dependency_links.txt +0 -0
  54. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs.egg-info/requires.txt +0 -0
  55. {maps4fs-1.8.177 → maps4fs-1.8.179}/maps4fs.egg-info/top_level.txt +0 -0
  56. {maps4fs-1.8.177 → maps4fs-1.8.179}/setup.cfg +0 -0
  57. {maps4fs-1.8.177 → maps4fs-1.8.179}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.177
3
+ Version: 1.8.179
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
@@ -682,7 +682,7 @@ The generator supports adding the own DTM providers, please refer to the [DTM Pr
682
682
 
683
683
  ### Supported DTM providers
684
684
 
685
- ![coverage map](https://github.com/user-attachments/assets/fc78e755-13e2-4187-b846-4de5cb407dbf)
685
+ ![coverage map](https://github.com/user-attachments/assets/138fa637-ce63-4dd9-bd11-bf92fe038a74)
686
686
 
687
687
  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.
688
688
 
@@ -703,6 +703,8 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
703
703
  | 🇳🇴 Norway | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
704
704
  | 🇪🇸 Spain | 5 meter | [kbrandwijk](https://github.com/kbrandwijk) |
705
705
  | 🇫🇮 Finland | 2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
706
+ | 🇩🇰 Denmark | 0.4 meter | [kbrandwijk](https://github.com/kbrandwijk) |
707
+ | 🇨🇭 Switzerland | 0.5-2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
706
708
 
707
709
  ## Special thanks
708
710
 
@@ -656,7 +656,7 @@ The generator supports adding the own DTM providers, please refer to the [DTM Pr
656
656
 
657
657
  ### Supported DTM providers
658
658
 
659
- ![coverage map](https://github.com/user-attachments/assets/fc78e755-13e2-4187-b846-4de5cb407dbf)
659
+ ![coverage map](https://github.com/user-attachments/assets/138fa637-ce63-4dd9-bd11-bf92fe038a74)
660
660
 
661
661
  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.
662
662
 
@@ -677,6 +677,8 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
677
677
  | 🇳🇴 Norway | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
678
678
  | 🇪🇸 Spain | 5 meter | [kbrandwijk](https://github.com/kbrandwijk) |
679
679
  | 🇫🇮 Finland | 2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
680
+ | 🇩🇰 Denmark | 0.4 meter | [kbrandwijk](https://github.com/kbrandwijk) |
681
+ | 🇨🇭 Switzerland | 0.5-2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
680
682
 
681
683
  ## Special thanks
682
684
 
@@ -16,6 +16,7 @@ from maps4fs.generator.dtm.spain import SpainProvider
16
16
  from maps4fs.generator.dtm.france import FranceProvider
17
17
  from maps4fs.generator.dtm.norway import NorwayProvider
18
18
  from maps4fs.generator.dtm.denmark import DenmarkProvider
19
+ from maps4fs.generator.dtm.switzerland import SwitzerlandProvider
19
20
  from maps4fs.generator.game import Game
20
21
  from maps4fs.generator.map import Map
21
22
  from maps4fs.generator.settings import (
@@ -0,0 +1,104 @@
1
+ """This module contains provider of Switzerland data."""
2
+
3
+ import json
4
+ import os
5
+
6
+ import requests
7
+
8
+ from maps4fs.generator.dtm import utils
9
+ from maps4fs.generator.dtm.dtm import DTMProvider, DTMProviderSettings
10
+
11
+
12
+ class SwitzerlandProviderSettings(DTMProviderSettings):
13
+ """Settings for the Switzerland provider."""
14
+
15
+ resolution: tuple | str = ("0.5", "2.0")
16
+
17
+
18
+ class SwitzerlandProvider(DTMProvider):
19
+ """Provider of Switzerland."""
20
+
21
+ _code = "switzerland"
22
+ _name = "Switzerland"
23
+ _region = "CH"
24
+ _icon = "🇨🇭"
25
+ _resolution = "0.5-2"
26
+ _settings = SwitzerlandProviderSettings
27
+ _author = "[kbrandwijk](https://github.com/kbrandwijk)"
28
+ _is_community = True
29
+
30
+ _extents = (47.8308275417, 45.7769477403, 10.4427014502, 6.02260949059)
31
+
32
+ _url = (
33
+ "https://ogd.swisstopo.admin.ch/services/swiseld/"
34
+ "services/assets/ch.swisstopo.swissalti3d/search"
35
+ )
36
+
37
+ def download_tiles(self):
38
+ download_urls = self.get_download_urls()
39
+ all_tif_files = self.download_tif_files(download_urls, self.shared_tiff_path)
40
+ return all_tif_files
41
+
42
+ def __init__(self, *args, **kwargs):
43
+ super().__init__(*args, **kwargs)
44
+ self.shared_tiff_path = os.path.join(self._tile_directory, "shared")
45
+ os.makedirs(self.shared_tiff_path, exist_ok=True)
46
+
47
+ def get_download_urls(self) -> list[str]:
48
+ """Get download URLs of the GeoTIFF files from the USGS API.
49
+
50
+ Returns:
51
+ list: List of download URLs.
52
+ """
53
+ urls = []
54
+ try:
55
+ bbox = self.get_bbox()
56
+ north, south, east, west = utils.transform_bbox(bbox, "EPSG:2056")
57
+
58
+ params = {
59
+ "format": "image/tiff; application=geotiff; profile=cloud-optimized",
60
+ "resolution": self.user_settings.resolution, # type: ignore
61
+ "srid": 2056,
62
+ "state": "current",
63
+ }
64
+
65
+ data = {
66
+ "geometry": json.dumps(
67
+ {
68
+ "type": "Polygon",
69
+ "crs": {"type": "name", "properties": {"name": "EPSG:2056"}},
70
+ "coordinates": [
71
+ [
72
+ [north, east],
73
+ [south, east],
74
+ [south, west],
75
+ [north, west],
76
+ [north, east],
77
+ ]
78
+ ],
79
+ }
80
+ )
81
+ }
82
+
83
+ response = requests.post( # pylint: disable=W3101
84
+ self.url, # type: ignore
85
+ params=params,
86
+ data=data,
87
+ headers={"Content-Type": "application/x-www-form-urlencoded"},
88
+ timeout=60,
89
+ )
90
+ self.logger.debug("Getting file locations...")
91
+
92
+ # Check if the request was successful (HTTP status code 200)
93
+ if response.status_code == 200:
94
+ # Parse the JSON response
95
+ json_data = response.json()
96
+ items = json_data["items"]
97
+ for item in items:
98
+ urls.append(item["ass_asset_href"])
99
+ else:
100
+ self.logger.error("Failed to get data. HTTP Status Code: %s", response.status_code)
101
+ except requests.exceptions.RequestException as e:
102
+ self.logger.error("Failed to get data. Error: %s", e)
103
+ self.logger.debug("Received %s urls", len(urls))
104
+ return urls
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.177
3
+ Version: 1.8.179
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
@@ -682,7 +682,7 @@ The generator supports adding the own DTM providers, please refer to the [DTM Pr
682
682
 
683
683
  ### Supported DTM providers
684
684
 
685
- ![coverage map](https://github.com/user-attachments/assets/fc78e755-13e2-4187-b846-4de5cb407dbf)
685
+ ![coverage map](https://github.com/user-attachments/assets/138fa637-ce63-4dd9-bd11-bf92fe038a74)
686
686
 
687
687
  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.
688
688
 
@@ -703,6 +703,8 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
703
703
  | 🇳🇴 Norway | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
704
704
  | 🇪🇸 Spain | 5 meter | [kbrandwijk](https://github.com/kbrandwijk) |
705
705
  | 🇫🇮 Finland | 2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
706
+ | 🇩🇰 Denmark | 0.4 meter | [kbrandwijk](https://github.com/kbrandwijk) |
707
+ | 🇨🇭 Switzerland | 0.5-2 meter | [kbrandwijk](https://github.com/kbrandwijk) |
706
708
 
707
709
  ## Special thanks
708
710
 
@@ -43,6 +43,7 @@ maps4fs/generator/dtm/nrw.py
43
43
  maps4fs/generator/dtm/scotland.py
44
44
  maps4fs/generator/dtm/spain.py
45
45
  maps4fs/generator/dtm/srtm.py
46
+ maps4fs/generator/dtm/switzerland.py
46
47
  maps4fs/generator/dtm/usgs.py
47
48
  maps4fs/generator/dtm/utils.py
48
49
  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.177"
7
+ version = "1.8.179"
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