maps4fs 1.7.0__py3-none-any.whl → 1.7.2__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.

Potentially problematic release.


This version of maps4fs might be problematic. Click here for more details.

maps4fs/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  # pylint: disable=missing-module-docstring
2
2
  from maps4fs.generator.dtm.dtm import DTMProvider
3
- from maps4fs.generator.dtm.srtm import SRTM30Provider
4
- from maps4fs.generator.dtm.usgs import USGSProvider
3
+ from maps4fs.generator.dtm.srtm import SRTM30Provider, SRTM30ProviderSettings
4
+ from maps4fs.generator.dtm.usgs import USGSProvider, USGSProviderSettings
5
5
  from maps4fs.generator.game import Game
6
6
  from maps4fs.generator.map import Map
7
7
  from maps4fs.generator.settings import (
@@ -9,6 +9,7 @@ from maps4fs.generator.settings import (
9
9
  DEMSettings,
10
10
  GRLESettings,
11
11
  I3DSettings,
12
+ SatelliteSettings,
12
13
  SettingsModel,
13
14
  SplineSettings,
14
15
  TextureSettings,
@@ -466,7 +466,11 @@ class Texture(Component):
466
466
  self.np_to_polygon_points(polygon) # type: ignore
467
467
  )
468
468
  if not layer.invisible:
469
- cv2.fillPoly(layer_image, [polygon], color=255) # type: ignore
469
+ try:
470
+ cv2.fillPoly(layer_image, [polygon], color=255) # type: ignore
471
+ except Exception as e: # pylint: disable=W0718
472
+ self.logger.warning("Error drawing polygon: %s.", repr(e))
473
+ continue
470
474
 
471
475
  if layer.info_layer == "roads":
472
476
  for linestring in self.objects_generator(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.7.0
3
+ Version: 1.7.2
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
@@ -69,16 +69,15 @@ Requires-Dist: pydantic
69
69
  </div>
70
70
 
71
71
  🗺️ Supports 2x2, 4x4, 8x8, 16x16 and any custom size maps<br>
72
- 🔄 Support map rotation 🆕<br>
72
+ 🔄 Support map rotation<br>
73
73
  🌐 Supports custom [DTM Providers](#DTM-Providers) 🆕<br>
74
- 🌾 Automatically generates fields 🆕<br>
75
- 🌽 Automatically generates farmlands 🆕<br>
76
- 🌿 Automatically generates decorative foliage 🆕<br>
77
- 🌲 Automatically generates forests 🆕<br>
78
- 🌊 Automatically generates water planes 🆕<br>
74
+ 🌾 Automatically generates fields<br>
75
+ 🌽 Automatically generates farmlands<br>
76
+ 🌿 Automatically generates decorative foliage<br>
77
+ 🌲 Automatically generates forests<br>
78
+ 🌊 Automatically generates water planes<br>
79
79
  📈 Automatically generates splines 🆕<br>
80
80
  🛰️ Automatically downloads high resolution satellite images 🆕<br>
81
- 🏔️ Allows to use multiple DTM providers for elevation models 🆕<br>
82
81
  🌍 Based on real-world data from OpenStreetMap<br>
83
82
  🗺️ Supports [custom OSM maps](/docs/custom_osm.md)<br>
84
83
  🏞️ Generates height map using SRTM dataset<br>
@@ -99,10 +98,14 @@ Requires-Dist: pydantic
99
98
  🌿 Automatically generates decorative foliage.<br><br>
100
99
  <img src="https://github.com/user-attachments/assets/27a5e541-a9f5-4504-b8d2-64aae9fb3e52"><br>
101
100
  🌲 Automatically generates forests.<br><br>
101
+ <img src="https://github.com/user-attachments/assets/891911d7-081d-431e-a677-b4ae96870286"><br>
102
+ 🌲 Allows to select trees for generation.<br><br>
102
103
  <img src="https://github.com/user-attachments/assets/cce7d4e0-cba2-4dd2-b22d-03137fb2e860"><br>
103
104
  🌊 Automatically generates water planes.<br><br>
104
105
  <img src="https://github.com/user-attachments/assets/0b05b511-a595-48e7-a353-8298081314a4"><br>
105
106
  📈 Automatically generates splines.<br><br>
107
+ <img src="https://github.com/user-attachments/assets/0957db9e-7b95-4951-969c-9d1edd9f073b"><br>
108
+ 🖌️ Allows customization of the texture schema.<br><br>
106
109
  <img src="https://github.com/user-attachments/assets/80e5923c-22c7-4dc0-8906-680902511f3a"><br>
107
110
  🗒️ True-to-life blueprints for fast and precise modding.<br><br>
108
111
  <img width="480" src="https://github.com/user-attachments/assets/1a8802d2-6a3b-4bfa-af2b-7c09478e199b"><br>
@@ -138,7 +141,7 @@ Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
138
141
  ```bash
139
142
  pip install maps4fs
140
143
  ```
141
- And refer to the [Python package](#option-3-python-package) section to learn how to use it.<br>
144
+ And refer to the [Python package or run from the source](#option-3-python-package-or-source-code) section to learn how to use it.<br>
142
145
 
143
146
  ## Overview
144
147
  The core idea is coming from the awesome [maps4cim](https://github.com/klamann/maps4cim) project.<br>
@@ -198,7 +201,7 @@ docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
198
201
  4. Fill in the required fields and click on the `Generate` button.
199
202
  5. When the map is generated click on the `Download` button to get the map.
200
203
 
201
- ### Option 3: Python package
204
+ ### Option 3: Python package or source code
202
205
  🔴 Recommended for developers.
203
206
  🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
204
207
  ⚙️ Advanced settings: enabled.
@@ -209,11 +212,50 @@ You can use the Python package to generate maps. Follow these steps:
209
212
  ```bash
210
213
  pip install maps4fs
211
214
  ```
215
+
216
+ Or clone the repository and install the package from the source code:
217
+ ```bash
218
+ git clone https://github.com/iwatkot/maps4fs.git
219
+ cd maps4fs
220
+ dev/create_venv.ps1 # for Windows
221
+ sh dev/create_venv.sh # for Linux
222
+
223
+ # Activate the virtual environment.
224
+ ./venv/scripts/activate # for Windows
225
+ source venv/bin/activate # for Linux
226
+
227
+ # Edit the demo.py file to set the parameters.
228
+ python demo.py
229
+ ```
230
+
231
+
212
232
  2. Import the Game class and create an instance of it:
213
233
  ```python
214
234
  import maps4fs as mfs
215
235
 
216
- game = mfs.Game.from_code("FS25")
236
+ game_code = "fs25"
237
+ game = mfs.Game.from_code(game_code)
238
+
239
+ dtm_provider = mfs.SRTM30Provider
240
+ dtm_provider_settings = mfs.SRTM30ProviderSettings(easy_mode=True, power_factor=0)
241
+
242
+ lat, lon = 45.28, 20.23
243
+ coordinates = (lat, lon)
244
+ size = 2048
245
+ rotation = 25
246
+
247
+ map_directory = "map_directory"
248
+ os.makedirs(map_directory, exist_ok=True)
249
+
250
+ mp = mfs.Map(
251
+ game,
252
+ dtm_provider,
253
+ dtm_provider_settings,
254
+ coordinates,
255
+ size,
256
+ rotation,
257
+ map_directory,
258
+ )
217
259
  ```
218
260
  In this case, the library will use the default templates, which should be present in the `data` directory, which should be placed in the current working directory.<br>
219
261
  Structure example:<br>
@@ -226,28 +268,17 @@ Structure example:<br>
226
268
 
227
269
  So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
228
270
 
229
- 3. Create an instance of the Map class:
230
- ```python
231
- import maps4fs as mfs
232
-
233
- map = mfs.Map(
234
- game,
235
- (52.5200, 13.4050), # Latitude and longitude of the map center.
236
- height=1024, # The height of the map in meters.
237
- width=1024, # The width of the map in meters.
238
- map_directory="path/to/your/map/directory", # The directory where the map will be saved.
239
- )
240
- ```
241
-
242
- 4. Generate the map:
271
+ 3. Launch the generation process.
243
272
  The `generate` method returns a generator, which yields the active component of the map. You can use it to track the progress of the generation process.
244
273
  ```python
245
- for active_component in map.generate():
246
- print(active_component)
274
+ for component_name in mp.generate():
275
+ print(f"Generating {component_name}...")
247
276
  ```
248
277
 
249
278
  The map will be saved in the `map_directory` directory.
250
279
 
280
+ ➡️ Check out the [demo.py](demo.py) file for a complete example.
281
+
251
282
  ## Modder Toolbox
252
283
  The tool now has a Modder Toolbox, which is a set of tools to help you with various tasks. You can open the toolbox by switching to the `🧰 Modder Toolbox` tab in the StreamLit app.<br>
253
284
 
@@ -259,6 +290,8 @@ Tools are divided into categories, which are listed below.
259
290
  #### For custom schemas
260
291
  - **Tree Schema Editor** - allows you to view all the supported trees models and select the ones you need on your map. After it, you should click the Show updated schema button and copy the JSON schema to the clipboard. Then you can use it in the Expert settings to generate the map with the selected trees.
261
292
 
293
+ - **Texture Schema Editor** - allows you to view all the supported textures and edit their parameters, such as priority, OSM tags and so on. After editing, you should click the Show updated schema button and copy the JSON schema to the clipboard. Then you can use it in the Expert settings to generate the map with the updated textures.
294
+
262
295
  #### For Textures and DEM
263
296
  - **GeoTIFF windowing** - allows you to upload your GeoTIFF file and select the region of interest to extract it from the image. It's useful when you have high-resolution DEM data and want to create a height map using it.
264
297
 
@@ -1,4 +1,4 @@
1
- maps4fs/__init__.py,sha256=LrWSsyWaU28Dzcs7sRycywO_LvM-j34UvtafyBhvdx4,490
1
+ maps4fs/__init__.py,sha256=rUpfzsaHxFEf4wS1f1TtmIIcTs8Ub-X_KE9zdiQVt5A,559
2
2
  maps4fs/logger.py,sha256=B-NEYpMjPAAqlV4VpfTi6nbBFnEABVtQOaYe6nMpidg,1489
3
3
  maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
4
  maps4fs/generator/background.py,sha256=tV4UXvtkNN-OSvv6ujp4jFWRU1xGBgEvSakVGZ1H4nc,24877
@@ -12,7 +12,7 @@ maps4fs/generator/map.py,sha256=a50KQEr1XZKjS_WKXywGwh4OC3gyjY6M8FTc0eNcxpg,1018
12
12
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
13
13
  maps4fs/generator/satellite.py,sha256=_7RcuNmR1mjxEJWMDsjnzKUIqWxnGUn50XtjB7HmSPg,3661
14
14
  maps4fs/generator/settings.py,sha256=9vbXISQrE-aDY7ATpvZ7LVJMqjfwa3-gNl-huI8XLO0,5666
15
- maps4fs/generator/texture.py,sha256=tDC9lIx2qn8d09Gu6PW_Lbq7EK7s1N4l25p50v92xl8,33548
15
+ maps4fs/generator/texture.py,sha256=P4AJjedG98SFxrw4hBenw7_OgtkcI0TpE63fEffJ2eE,33761
16
16
  maps4fs/generator/dtm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  maps4fs/generator/dtm/dtm.py,sha256=nCQKQygARLxaz4HkREQQd0Yb03oKOf1Iav5_VoZsFWI,9819
18
18
  maps4fs/generator/dtm/srtm.py,sha256=2-pX6bWrJX6gr8IM7ueX6mm_PW7_UQ58MtdzDHae2OQ,9030
@@ -20,8 +20,8 @@ maps4fs/generator/dtm/usgs.py,sha256=hwVjoSNTNRU6hwnfwJ2d3rOdtOjadCmx2QESA2REn6s
20
20
  maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
21
21
  maps4fs/toolbox/background.py,sha256=9BXWNqs_n3HgqDiPztWylgYk_QM4YgBpe6_ZNQAWtSc,2154
22
22
  maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
23
- maps4fs-1.7.0.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
24
- maps4fs-1.7.0.dist-info/METADATA,sha256=MNEtaRLPbGmFgR7jJ_4ViotLPEmDEQ4MydSlOZVJdyg,39160
25
- maps4fs-1.7.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
26
- maps4fs-1.7.0.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
27
- maps4fs-1.7.0.dist-info/RECORD,,
23
+ maps4fs-1.7.2.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
24
+ maps4fs-1.7.2.dist-info/METADATA,sha256=t_t_Ybmh8QDgytrnMqmUBTtWGVhnyn6_rPNpTDYq2k4,40298
25
+ maps4fs-1.7.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
26
+ maps4fs-1.7.2.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
27
+ maps4fs-1.7.2.dist-info/RECORD,,