maps4fs 0.7.2__py3-none-any.whl → 0.7.3__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/generator/component.py +5 -3
- maps4fs/generator/dem.py +23 -12
- maps4fs/generator/texture.py +19 -2
- {maps4fs-0.7.2.dist-info → maps4fs-0.7.3.dist-info}/METADATA +16 -17
- maps4fs-0.7.3.dist-info/RECORD +14 -0
- maps4fs-0.7.2.dist-info/RECORD +0 -14
- {maps4fs-0.7.2.dist-info → maps4fs-0.7.3.dist-info}/LICENSE.md +0 -0
- {maps4fs-0.7.2.dist-info → maps4fs-0.7.3.dist-info}/WHEEL +0 -0
- {maps4fs-0.7.2.dist-info → maps4fs-0.7.3.dist-info}/top_level.txt +0 -0
maps4fs/generator/component.py
CHANGED
@@ -86,8 +86,10 @@ class Component:
|
|
86
86
|
)
|
87
87
|
bbox = north, south, east, west
|
88
88
|
self.logger.debug(
|
89
|
-
|
90
|
-
|
89
|
+
"Calculated bounding box for component: %s: %s, project_utm: %s",
|
90
|
+
self.__class__.__name__,
|
91
|
+
bbox,
|
92
|
+
project_utm,
|
91
93
|
)
|
92
94
|
return bbox
|
93
95
|
|
@@ -96,4 +98,4 @@ class Component:
|
|
96
98
|
height and width of the map.
|
97
99
|
"""
|
98
100
|
self.bbox = self.get_bbox(project_utm=False)
|
99
|
-
self.logger.debug(
|
101
|
+
self.logger.debug("Saved bounding box: %s", self.bbox)
|
maps4fs/generator/dem.py
CHANGED
@@ -85,8 +85,11 @@ class DEM(Component):
|
|
85
85
|
return
|
86
86
|
|
87
87
|
self.logger.debug(
|
88
|
-
|
89
|
-
|
88
|
+
"DEM data was read from SRTM file. Shape: %s, dtype: %s. Min: %s, max: %s.",
|
89
|
+
data.shape,
|
90
|
+
data.dtype,
|
91
|
+
data.min(),
|
92
|
+
data.max(),
|
90
93
|
)
|
91
94
|
|
92
95
|
resampled_data = cv2.resize(
|
@@ -94,26 +97,33 @@ class DEM(Component):
|
|
94
97
|
).astype("uint16")
|
95
98
|
|
96
99
|
self.logger.debug(
|
97
|
-
|
98
|
-
|
100
|
+
"Maximum value in resampled data: %s, minimum value: %s.",
|
101
|
+
resampled_data.max(),
|
102
|
+
resampled_data.min(),
|
99
103
|
)
|
100
104
|
|
101
105
|
resampled_data = resampled_data * self.multiplier
|
102
106
|
self.logger.debug(
|
103
|
-
|
104
|
-
|
105
|
-
|
107
|
+
"DEM data multiplied by %s. Shape: %s, dtype: %s. Min: %s, max: %s.",
|
108
|
+
self.multiplier,
|
109
|
+
resampled_data.shape,
|
110
|
+
resampled_data.dtype,
|
111
|
+
resampled_data.min(),
|
112
|
+
resampled_data.max(),
|
106
113
|
)
|
107
114
|
|
108
115
|
self.logger.debug(
|
109
|
-
|
110
|
-
|
111
|
-
|
116
|
+
"DEM data was resampled. Shape: %s, dtype: %s. Min: %s, max: %s.",
|
117
|
+
resampled_data.shape,
|
118
|
+
resampled_data.dtype,
|
119
|
+
resampled_data.min(),
|
120
|
+
resampled_data.max(),
|
112
121
|
)
|
113
122
|
|
114
123
|
resampled_data = cv2.GaussianBlur(resampled_data, (self.blur_radius, self.blur_radius), 0)
|
115
124
|
self.logger.debug(
|
116
|
-
|
125
|
+
"Gaussion blur applied to DEM data with kernel size %s.",
|
126
|
+
self.blur_radius,
|
117
127
|
)
|
118
128
|
|
119
129
|
cv2.imwrite(self._dem_path, resampled_data)
|
@@ -179,7 +189,8 @@ class DEM(Component):
|
|
179
189
|
decompressed_file_path = os.path.join(self.hgt_dir, f"{tile_name}.hgt")
|
180
190
|
if os.path.isfile(decompressed_file_path):
|
181
191
|
self.logger.info(
|
182
|
-
|
192
|
+
"Decompressed tile already exists: %s, skipping download.",
|
193
|
+
decompressed_file_path,
|
183
194
|
)
|
184
195
|
return decompressed_file_path
|
185
196
|
|
maps4fs/generator/texture.py
CHANGED
@@ -16,6 +16,8 @@ from shapely.geometry.base import BaseGeometry # type: ignore
|
|
16
16
|
|
17
17
|
from maps4fs.generator.component import Component
|
18
18
|
|
19
|
+
PREVIEW_MAXIMUM_SIZE = 2048
|
20
|
+
|
19
21
|
|
20
22
|
# pylint: disable=R0902
|
21
23
|
class Texture(Component):
|
@@ -387,7 +389,20 @@ class Texture(Component):
|
|
387
389
|
Returns:
|
388
390
|
str: Path to the preview.
|
389
391
|
"""
|
390
|
-
|
392
|
+
scaling_factor = min(
|
393
|
+
PREVIEW_MAXIMUM_SIZE / self.map_width, PREVIEW_MAXIMUM_SIZE / self.map_height
|
394
|
+
)
|
395
|
+
|
396
|
+
preview_size = (
|
397
|
+
int(self.map_width * scaling_factor),
|
398
|
+
int(self.map_height * scaling_factor),
|
399
|
+
)
|
400
|
+
self.logger.debug(
|
401
|
+
"Scaling factor: %s. Preview size: %s.",
|
402
|
+
scaling_factor,
|
403
|
+
preview_size,
|
404
|
+
)
|
405
|
+
|
391
406
|
images = [
|
392
407
|
cv2.resize(
|
393
408
|
cv2.imread(layer.path(self._weights_dir), cv2.IMREAD_UNCHANGED), preview_size
|
@@ -402,7 +417,9 @@ class Texture(Component):
|
|
402
417
|
color_images.append(color_img)
|
403
418
|
merged = np.sum(color_images, axis=0, dtype=np.uint8)
|
404
419
|
self.logger.debug(
|
405
|
-
|
420
|
+
"Merged layers into one image. Shape: %s, dtype: %s.",
|
421
|
+
merged.shape,
|
422
|
+
merged.dtype,
|
406
423
|
)
|
407
424
|
preview_path = os.path.join(self.map_directory, "preview_osm.png")
|
408
425
|
cv2.imwrite(preview_path, merged) # pylint: disable=no-member
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: maps4fs
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.3
|
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
|
@@ -25,9 +25,8 @@ Requires-Dist: tqdm
|
|
25
25
|
<a href="#Quick-Start">Quick Start</a> •
|
26
26
|
<a href="#Overview">Overview</a> •
|
27
27
|
<a href="#How-To-Run">How-To-Run</a> •
|
28
|
-
<a href="#Features">Features</a> •
|
29
28
|
<a href="#Supported-objects">Supported objects</a> •
|
30
|
-
<a href="#
|
29
|
+
<a href="#For-advanced-users">For advanced users</a> •
|
31
30
|
<a href="#Bugs-and-feature-requests">Bugs and feature requests</a>
|
32
31
|
</p>
|
33
32
|
|
@@ -44,10 +43,13 @@ Requires-Dist: tqdm
|
|
44
43
|
|
45
44
|
</div>
|
46
45
|
|
47
|
-
|
46
|
+
🗺️ Supports 2x2, 4x4, 8x8, 16x16 and any custom size maps<br>
|
47
|
+
🌍 Based on real-world data from OpenStreetMap<br>
|
48
|
+
🏞️ Generates height using SRTM dataset<br>
|
49
|
+
📦 Provides a ready-to-use map template for the Giants Editor<br>
|
50
|
+
🚜 Supports Farming Simulator 22 and 25*<br>
|
48
51
|
|
49
|
-
|
50
|
-
🔃 Farming Simulator 25 (changes in the library are ready, waiting for the Giants to release the Giants Editor v10)<br>
|
52
|
+
\* changes in the library are ready, waiting for the Giants to release the Giants Editor v10. Meanwhile the option to generate a map for FS25 is disabled.
|
51
53
|
|
52
54
|
## Quick Start
|
53
55
|
There are several ways to use the tool. You obviously need the **first one**, but you can choose any of the others depending on your needs.<br>
|
@@ -100,7 +102,6 @@ You'll find detailed instructions on how to run the project below. But if you pr
|
|
100
102
|
<i>Video tutorial: How to generate a Farming Simulator 22 map from real-world data.</i>
|
101
103
|
|
102
104
|
### Option 1: StreamLit
|
103
|
-
**🗺️ Supported map sizes:** 2x2, 4x4, 8x8, 16x16 km.<br>
|
104
105
|
🟢 Recommended for all users, you don't need to install anything.<br>
|
105
106
|
Using the [StreamLit](https://maps4fs.streamlit.app) version of the tool is the easiest way to generate a map template. Just open the link and follow the instructions.
|
106
107
|
Note: due to CPU and RAM limitations of the hosting, the generation may take some time. If you need faster processing, use the [Docker version](#option-2-docker-version).<br>
|
@@ -108,7 +109,6 @@ Note: due to CPU and RAM limitations of the hosting, the generation may take som
|
|
108
109
|
Using it is easy and doesn't require any guides. Enjoy!
|
109
110
|
|
110
111
|
### Option 2: Docker version
|
111
|
-
**🗺️ Supported map sizes:** 2x2, 4x4, 8x8, 16x16 km.<br>
|
112
112
|
🟠 Recommended for users who want faster processing, very simple installation.<br>
|
113
113
|
You can launch the project with minimalistic UI in your browser using Docker. Follow these steps:
|
114
114
|
|
@@ -121,10 +121,9 @@ docker run -d -p 8501:8501 iwatkot/maps4fs
|
|
121
121
|
4. Fill in the required fields and click on the `Generate` button.
|
122
122
|
5. When the map is generated click on the `Download` button to get the map.
|
123
123
|
|
124
|
-

|
125
125
|
|
126
126
|
### Option 3: Python package
|
127
|
-
**🗺️ Supported map sizes:** 2x2, 4x4, 8x8, 16x16 km (and ANY other you may add).<br>
|
128
127
|
🔴 Recommended for developers.<br>
|
129
128
|
You can use the Python package to generate maps. Follow these steps:
|
130
129
|
|
@@ -169,12 +168,6 @@ map.generate()
|
|
169
168
|
|
170
169
|
The map will be saved in the `map_directory` directory.
|
171
170
|
|
172
|
-
## Features
|
173
|
-
- Allows to enter a location by lat and lon (e.g. from Google Maps).
|
174
|
-
- Allows to select a size of the map (2x2, 4x4, 8x8 km, 16x16 km).
|
175
|
-
- Generates a map template (check the list of supported objects in [this section](#supported-objects)).
|
176
|
-
- Generates a height map.
|
177
|
-
|
178
171
|
## Supported objects
|
179
172
|
The project is based on the [OpenStreetMap](https://www.openstreetmap.org/) data. So, refer to [this page](https://wiki.openstreetmap.org/wiki/Map_Features) to understand the list below.
|
180
173
|
- "building": True
|
@@ -207,7 +200,13 @@ The script will also generate the `generation_info.json` file in the `output` fo
|
|
207
200
|
|
208
201
|
You can use this information to adjust some other sources of data to the map, e.g. textures, height maps, etc.
|
209
202
|
|
210
|
-
##
|
203
|
+
## For advanced users
|
204
|
+
The tool supports the custom size of the map. To use this feature select `Custom` in the `Map size` dropdown and enter the desired size. The tool will generate a map with the size you entered.<br>
|
205
|
+
|
206
|
+
⛔️ Do not use this feature, if you don't know what you're doing. In most cases the Giants Editor will just crash on opening the file, because you need to enter a specific values for the map size.<br><br>
|
207
|
+
|
208
|
+

|
209
|
+
|
211
210
|
You can also apply some advanced settings to the map generation process. Note that they're ADVANCED, so you don't need to use them if you're not sure what they do.<br>
|
212
211
|
|
213
212
|
Here's the list of the advanced settings:
|
@@ -0,0 +1,14 @@
|
|
1
|
+
maps4fs/__init__.py,sha256=da4jmND2Ths9AffnkAKgzLHNkvKFOc_l21gJisPXqWY,155
|
2
|
+
maps4fs/logger.py,sha256=CneeHxQywjNUJXqQrUUSeiDxu95FfrfyK_Si1v0gMZ8,1477
|
3
|
+
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
|
+
maps4fs/generator/component.py,sha256=BU_HNNyKXuEBohQJRTlXmNdSNrjolwX-ZzqqSSuzTrE,3463
|
5
|
+
maps4fs/generator/config.py,sha256=luDYXkKjgOM4-Mft4mHDPP6v-DVIUyWZAMAsCKyvaoY,2108
|
6
|
+
maps4fs/generator/dem.py,sha256=EJBXHZ0_G9nXZ-b1PmR9mjIdXjbKlYEUv-4IDGJPmdc,9779
|
7
|
+
maps4fs/generator/game.py,sha256=IyXjNEC5epJmDdqjsrl4wKL85T1F23km73pUkBiuDWU,4468
|
8
|
+
maps4fs/generator/map.py,sha256=Oyu45ONmSluidaUErsU6n28pqI-XYx1eVfPT9FurCTE,3522
|
9
|
+
maps4fs/generator/texture.py,sha256=W2tMkCxyD7qesSuutPJ3N5InDza2Dzi5_yzewSl9e-E,15615
|
10
|
+
maps4fs-0.7.3.dist-info/LICENSE.md,sha256=-JY0v7p3dwXze61EbYiK7YEJ2aKrjaFZ8y2xYEOrmRY,1068
|
11
|
+
maps4fs-0.7.3.dist-info/METADATA,sha256=LimQqtHMDbvCq_hUNZg8ZmxHSIk-g8G6DRJ7Etu8F7E,11961
|
12
|
+
maps4fs-0.7.3.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
13
|
+
maps4fs-0.7.3.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
14
|
+
maps4fs-0.7.3.dist-info/RECORD,,
|
maps4fs-0.7.2.dist-info/RECORD
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
maps4fs/__init__.py,sha256=da4jmND2Ths9AffnkAKgzLHNkvKFOc_l21gJisPXqWY,155
|
2
|
-
maps4fs/logger.py,sha256=CneeHxQywjNUJXqQrUUSeiDxu95FfrfyK_Si1v0gMZ8,1477
|
3
|
-
maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
|
4
|
-
maps4fs/generator/component.py,sha256=k5SRlcXu3OHvm-5GUhHTdVgxGUAvtcftdCxFCWAYOZU,3436
|
5
|
-
maps4fs/generator/config.py,sha256=luDYXkKjgOM4-Mft4mHDPP6v-DVIUyWZAMAsCKyvaoY,2108
|
6
|
-
maps4fs/generator/dem.py,sha256=xq9F66-7otQNRAjAkM0tYNV2TTJSr10xSQlVpNtyL-0,9634
|
7
|
-
maps4fs/generator/game.py,sha256=IyXjNEC5epJmDdqjsrl4wKL85T1F23km73pUkBiuDWU,4468
|
8
|
-
maps4fs/generator/map.py,sha256=Oyu45ONmSluidaUErsU6n28pqI-XYx1eVfPT9FurCTE,3522
|
9
|
-
maps4fs/generator/texture.py,sha256=R45BFsdYHsTUW6iQVAZu9N_ifIEQMzuSheTEtpmf9nQ,15182
|
10
|
-
maps4fs-0.7.2.dist-info/LICENSE.md,sha256=-JY0v7p3dwXze61EbYiK7YEJ2aKrjaFZ8y2xYEOrmRY,1068
|
11
|
-
maps4fs-0.7.2.dist-info/METADATA,sha256=rv0QSEJVDk4FJi2rSo2ziKPK_bCUoctF-ftpQ37Y-4A,11698
|
12
|
-
maps4fs-0.7.2.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
|
13
|
-
maps4fs-0.7.2.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
|
14
|
-
maps4fs-0.7.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|