maps4fs 2.0.1__tar.gz → 2.0.2__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 (64) hide show
  1. {maps4fs-2.0.1 → maps4fs-2.0.2}/PKG-INFO +2 -1
  2. {maps4fs-2.0.1 → maps4fs-2.0.2}/README.md +1 -0
  3. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/dem.py +2 -2
  4. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/__init__.py +1 -0
  5. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/dtm.py +1 -1
  6. maps4fs-2.0.2/maps4fs/generator/dtm/wales.py +123 -0
  7. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs.egg-info/PKG-INFO +2 -1
  8. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs.egg-info/SOURCES.txt +1 -0
  9. {maps4fs-2.0.1 → maps4fs-2.0.2}/pyproject.toml +1 -1
  10. {maps4fs-2.0.1 → maps4fs-2.0.2}/LICENSE.md +0 -0
  11. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/__init__.py +0 -0
  12. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/__init__.py +0 -0
  13. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/__init__.py +0 -0
  14. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/background.py +0 -0
  15. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/base/__init__.py +0 -0
  16. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/base/component.py +0 -0
  17. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/base/component_image.py +0 -0
  18. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/base/component_mesh.py +0 -0
  19. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/base/component_xml.py +0 -0
  20. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/config.py +0 -0
  21. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/grle.py +0 -0
  22. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/i3d.py +0 -0
  23. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/layer.py +0 -0
  24. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/satellite.py +0 -0
  25. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/component/texture.py +0 -0
  26. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/arctic.py +0 -0
  27. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/baden.py +0 -0
  28. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/base/wcs.py +0 -0
  29. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/base/wms.py +0 -0
  30. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/bavaria.py +0 -0
  31. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/canada.py +0 -0
  32. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/czech.py +0 -0
  33. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/denmark.py +0 -0
  34. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/england.py +0 -0
  35. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/finland.py +0 -0
  36. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/flanders.py +0 -0
  37. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/france.py +0 -0
  38. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/hessen.py +0 -0
  39. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/italy.py +0 -0
  40. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/lithuania.py +0 -0
  41. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/mv.py +0 -0
  42. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/niedersachsen.py +0 -0
  43. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/norway.py +0 -0
  44. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/nrw.py +0 -0
  45. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/rema.py +0 -0
  46. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/sachsenanhalt.py +0 -0
  47. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/scotland.py +0 -0
  48. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/spain.py +0 -0
  49. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/srtm.py +0 -0
  50. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/switzerland.py +0 -0
  51. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/thuringia.py +0 -0
  52. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/usgs_wcs.py +0 -0
  53. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/dtm/utils.py +0 -0
  54. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/game.py +0 -0
  55. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/map.py +0 -0
  56. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/qgis.py +0 -0
  57. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/settings.py +0 -0
  58. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/generator/statistics.py +0 -0
  59. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs/logger.py +0 -0
  60. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs.egg-info/dependency_links.txt +0 -0
  61. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs.egg-info/requires.txt +0 -0
  62. {maps4fs-2.0.1 → maps4fs-2.0.2}/maps4fs.egg-info/top_level.txt +0 -0
  63. {maps4fs-2.0.1 → maps4fs-2.0.2}/setup.cfg +0 -0
  64. {maps4fs-2.0.1 → maps4fs-2.0.2}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: Apache License 2.0
@@ -729,6 +729,7 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
729
729
  | 🇺🇸 USGS | 1-90 meters | [ZenJakey](https://github.com/ZenJakey) |
730
730
  | 🏴󠁧󠁢󠁥󠁮󠁧󠁿 England | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
731
731
  | 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland | 0.25-1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
732
+ | 🏴󠁧󠁢󠁷󠁬󠁳󠁿󠁧󠁢󠁷󠁬󠁳󠁿 Wales | 1 meter | [garnwenshared](https://github.com/garnshared) |
732
733
  | 🇩🇪 Hessen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
733
734
  | 🇩🇪 Niedersachsen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
734
735
  | 🇩🇪 Bayern, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
@@ -699,6 +699,7 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
699
699
  | 🇺🇸 USGS | 1-90 meters | [ZenJakey](https://github.com/ZenJakey) |
700
700
  | 🏴󠁧󠁢󠁥󠁮󠁧󠁿 England | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
701
701
  | 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland | 0.25-1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
702
+ | 🏴󠁧󠁢󠁷󠁬󠁳󠁿󠁧󠁢󠁷󠁬󠁳󠁿 Wales | 1 meter | [garnwenshared](https://github.com/garnshared) |
702
703
  | 🇩🇪 Hessen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
703
704
  | 🇩🇪 Niedersachsen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
704
705
  | 🇩🇪 Bayern, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
@@ -159,7 +159,7 @@ class DEM(ImageComponent):
159
159
 
160
160
  self.update_info("original", data)
161
161
 
162
- # Check if the data contains any non zero values, otherwise raise an error.
162
+ # Check if the data contains any non-zero values, otherwise raise an error.
163
163
  if not np.any(data):
164
164
  self.logger.error("DTM provider returned empty data.")
165
165
  raise ValueError("DTM provider returned empty data. Try using different DTM provider.")
@@ -275,7 +275,7 @@ class DEM(ImageComponent):
275
275
  np.ndarray: Multiplied DEM data.
276
276
  """
277
277
  multiplier = self.map.dem_settings.multiplier
278
- if not multiplier != 1:
278
+ if multiplier == 1:
279
279
  return data
280
280
 
281
281
  multiplied_data = data * multiplier
@@ -24,3 +24,4 @@ from maps4fs.generator.dtm.srtm import SRTM30Provider
24
24
  from maps4fs.generator.dtm.switzerland import SwitzerlandProvider
25
25
  from maps4fs.generator.dtm.thuringia import ThuringiaProvider
26
26
  from maps4fs.generator.dtm.usgs_wcs import USGSWCSProvider
27
+ from maps4fs.generator.dtm.wales import WalesProvider
@@ -298,7 +298,7 @@ class DTMProvider(ABC):
298
298
 
299
299
  def get_numpy(self) -> np.ndarray:
300
300
  """Get numpy array of the tile.
301
- Resulting array must be 16 bit (signed or unsigned) integer and it should be already
301
+ Resulting array must be 16 bit (signed or unsigned) integer, and it should be already
302
302
  windowed to the bounding box of ROI. It also must have only one channel.
303
303
 
304
304
  Returns:
@@ -0,0 +1,123 @@
1
+ """This module contains provider of Wales data."""
2
+
3
+ import os
4
+ from math import floor, ceil
5
+
6
+ import requests
7
+ from pyproj import Transformer
8
+
9
+ from maps4fs.generator.dtm.dtm import DTMProvider
10
+
11
+
12
+ class WalesProvider(DTMProvider):
13
+ """Provider of Wales data."""
14
+
15
+ _code = "wales"
16
+ _name = "Wales 1M"
17
+ _region = "UK"
18
+ _icon = "🏴󠁧󠁢󠁷󠁬󠁳󠁿󠁧󠁢󠁷󠁬󠁳󠁿"
19
+ _resolution = 1
20
+ _author = "[garnshared](https://github.com/garnshared)"
21
+ _is_community = True
22
+ _instructions = None
23
+ _is_base = False
24
+ _extents = [(55.87708724246775, 49.85060473351981, 2.0842821419111135, -7.104775741839742)]
25
+
26
+ _url = "https://datamap.gov.wales/geoserver/ows" # pylint: disable=line-too-long
27
+ _wms_version = "1.1.1"
28
+ _source_crs = "EPSG:27700"
29
+ _size = 1000
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 tile catalogue.
43
+
44
+ Returns:
45
+ list: List of download URLs.
46
+ """
47
+ urls = []
48
+
49
+ transformer = Transformer.from_crs("EPSG:4326", "EPSG:27700", always_xy=True)
50
+
51
+
52
+ # Make the GET request
53
+ north, south, east, west = self.get_bbox()
54
+
55
+ # Transform the coordinates
56
+ west_transformed, south_transformed = transformer.transform(west, south)
57
+ east_transformed, north_transformed = transformer.transform(east, north)
58
+
59
+ # Helper function to snap coordinate to nearest 1000 grid
60
+ def snap_to_grid(value, func):
61
+ return int(func(value * 0.001) * 1000)
62
+
63
+ # Snap bounding box coordinates to a 1000-unit grid
64
+ x_min = snap_to_grid(west_transformed, floor)
65
+ y_min = snap_to_grid(south_transformed, floor)
66
+ x_max = snap_to_grid(east_transformed, ceil)
67
+ y_max = snap_to_grid(north_transformed, ceil)
68
+
69
+ # Calculate the number of tiles in x and y directions
70
+ x_tiles = abs(x_max - x_min) // 1000
71
+ y_tiles = abs(y_max - y_min) // 1000
72
+
73
+
74
+ for x_tile in range(x_tiles):
75
+ for y_tile in range(y_tiles):
76
+ b_west = x_min + 1000 * (x_tile + 1) - 855
77
+ b_south = y_min + 1000 * (y_tile + 1) - 855
78
+ b_east = b_west + 145
79
+ b_north = b_south + 145
80
+
81
+ try:
82
+ params = {
83
+ "service": "WMS",
84
+ "version": self._wms_version,
85
+ "request": "GetFeatureInfo",
86
+ "exceptions": "application/json",
87
+ "layers": "geonode:welsh_government_lidar_tile_catalogue_2020_2023",
88
+ "query_layers": "geonode:welsh_government_lidar_tile_catalogue_2020_2023",
89
+ "styles": "",
90
+ "x": 51,
91
+ "y": 51,
92
+ "height": 101,
93
+ "width": 101,
94
+ "srs": self._source_crs,
95
+ "bbox": f"{b_west},{b_south},{b_east},{b_north}",
96
+ "feature_count": 10,
97
+ "info_format": "application/json",
98
+ "ENV": "mapstore_language:en"
99
+ }
100
+
101
+ response = requests.get(# pylint: disable=W3101
102
+ self.url, # type: ignore
103
+ params=params, # type: ignore
104
+ timeout=60
105
+ )
106
+
107
+ self.logger.debug("Getting file locations from Welsh Government WMS GetFeatureInfo...")
108
+
109
+ # Check if the request was successful (HTTP status code 200)
110
+ if response.status_code == 200:
111
+ json_data = response.json()
112
+ features = json_data.get("features", [])
113
+ for feature in features:
114
+ dtm_link = feature.get("properties", {}).get("dtm_link")
115
+ if dtm_link:
116
+ urls.append("https://"+dtm_link)
117
+ else:
118
+ self.logger.error("Failed to get data. HTTP Status Code: %s", response.status_code)
119
+ except Exception as e:
120
+ self.logger.error("Failed to get data. Error: %s", e)
121
+
122
+ self.logger.debug("Received %s urls", len(urls))
123
+ return urls
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: Apache License 2.0
@@ -729,6 +729,7 @@ In addition to SRTM 30m, which provides global coverage, the map above highlight
729
729
  | 🇺🇸 USGS | 1-90 meters | [ZenJakey](https://github.com/ZenJakey) |
730
730
  | 🏴󠁧󠁢󠁥󠁮󠁧󠁿 England | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
731
731
  | 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Scotland | 0.25-1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
732
+ | 🏴󠁧󠁢󠁷󠁬󠁳󠁿󠁧󠁢󠁷󠁬󠁳󠁿 Wales | 1 meter | [garnwenshared](https://github.com/garnshared) |
732
733
  | 🇩🇪 Hessen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
733
734
  | 🇩🇪 Niedersachsen, Germany | 1 meter | [kbrandwijk](https://github.com/kbrandwijk) |
734
735
  | 🇩🇪 Bayern, Germany | 1 meter | [H4rdB4se](https://github.com/H4rdB4se) |
@@ -56,6 +56,7 @@ maps4fs/generator/dtm/switzerland.py
56
56
  maps4fs/generator/dtm/thuringia.py
57
57
  maps4fs/generator/dtm/usgs_wcs.py
58
58
  maps4fs/generator/dtm/utils.py
59
+ maps4fs/generator/dtm/wales.py
59
60
  maps4fs/generator/dtm/base/wcs.py
60
61
  maps4fs/generator/dtm/base/wms.py
61
62
  tests/test_generator.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "2.0.1"
7
+ version = "2.0.2"
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 = "Apache License 2.0"}
File without changes
File without changes
File without changes
File without changes
File without changes