maps4fs 1.7.0__tar.gz → 1.7.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 (33) hide show
  1. {maps4fs-1.7.0 → maps4fs-1.7.2}/PKG-INFO +60 -27
  2. {maps4fs-1.7.0 → maps4fs-1.7.2}/README.md +59 -26
  3. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/__init__.py +3 -2
  4. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/texture.py +5 -1
  5. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs.egg-info/PKG-INFO +60 -27
  6. {maps4fs-1.7.0 → maps4fs-1.7.2}/pyproject.toml +1 -1
  7. {maps4fs-1.7.0 → maps4fs-1.7.2}/LICENSE.md +0 -0
  8. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/__init__.py +0 -0
  9. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/background.py +0 -0
  10. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/component.py +0 -0
  11. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/config.py +0 -0
  12. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/dem.py +0 -0
  13. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/dtm/__init__.py +0 -0
  14. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/dtm/dtm.py +0 -0
  15. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/dtm/srtm.py +0 -0
  16. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/dtm/usgs.py +0 -0
  17. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/game.py +0 -0
  18. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/grle.py +0 -0
  19. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/i3d.py +0 -0
  20. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/map.py +0 -0
  21. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/qgis.py +0 -0
  22. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/satellite.py +0 -0
  23. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/generator/settings.py +0 -0
  24. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/logger.py +0 -0
  25. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/toolbox/__init__.py +0 -0
  26. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/toolbox/background.py +0 -0
  27. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs/toolbox/dem.py +0 -0
  28. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs.egg-info/SOURCES.txt +0 -0
  29. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs.egg-info/dependency_links.txt +0 -0
  30. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs.egg-info/requires.txt +0 -0
  31. {maps4fs-1.7.0 → maps4fs-1.7.2}/maps4fs.egg-info/top_level.txt +0 -0
  32. {maps4fs-1.7.0 → maps4fs-1.7.2}/setup.cfg +0 -0
  33. {maps4fs-1.7.0 → maps4fs-1.7.2}/tests/test_generator.py +0 -0
@@ -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
 
@@ -43,16 +43,15 @@
43
43
  </div>
44
44
 
45
45
  🗺️ Supports 2x2, 4x4, 8x8, 16x16 and any custom size maps<br>
46
- 🔄 Support map rotation 🆕<br>
46
+ 🔄 Support map rotation<br>
47
47
  🌐 Supports custom [DTM Providers](#DTM-Providers) 🆕<br>
48
- 🌾 Automatically generates fields 🆕<br>
49
- 🌽 Automatically generates farmlands 🆕<br>
50
- 🌿 Automatically generates decorative foliage 🆕<br>
51
- 🌲 Automatically generates forests 🆕<br>
52
- 🌊 Automatically generates water planes 🆕<br>
48
+ 🌾 Automatically generates fields<br>
49
+ 🌽 Automatically generates farmlands<br>
50
+ 🌿 Automatically generates decorative foliage<br>
51
+ 🌲 Automatically generates forests<br>
52
+ 🌊 Automatically generates water planes<br>
53
53
  📈 Automatically generates splines 🆕<br>
54
54
  🛰️ Automatically downloads high resolution satellite images 🆕<br>
55
- 🏔️ Allows to use multiple DTM providers for elevation models 🆕<br>
56
55
  🌍 Based on real-world data from OpenStreetMap<br>
57
56
  🗺️ Supports [custom OSM maps](/docs/custom_osm.md)<br>
58
57
  🏞️ Generates height map using SRTM dataset<br>
@@ -73,10 +72,14 @@
73
72
  🌿 Automatically generates decorative foliage.<br><br>
74
73
  <img src="https://github.com/user-attachments/assets/27a5e541-a9f5-4504-b8d2-64aae9fb3e52"><br>
75
74
  🌲 Automatically generates forests.<br><br>
75
+ <img src="https://github.com/user-attachments/assets/891911d7-081d-431e-a677-b4ae96870286"><br>
76
+ 🌲 Allows to select trees for generation.<br><br>
76
77
  <img src="https://github.com/user-attachments/assets/cce7d4e0-cba2-4dd2-b22d-03137fb2e860"><br>
77
78
  🌊 Automatically generates water planes.<br><br>
78
79
  <img src="https://github.com/user-attachments/assets/0b05b511-a595-48e7-a353-8298081314a4"><br>
79
80
  📈 Automatically generates splines.<br><br>
81
+ <img src="https://github.com/user-attachments/assets/0957db9e-7b95-4951-969c-9d1edd9f073b"><br>
82
+ 🖌️ Allows customization of the texture schema.<br><br>
80
83
  <img src="https://github.com/user-attachments/assets/80e5923c-22c7-4dc0-8906-680902511f3a"><br>
81
84
  🗒️ True-to-life blueprints for fast and precise modding.<br><br>
82
85
  <img width="480" src="https://github.com/user-attachments/assets/1a8802d2-6a3b-4bfa-af2b-7c09478e199b"><br>
@@ -112,7 +115,7 @@ Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
112
115
  ```bash
113
116
  pip install maps4fs
114
117
  ```
115
- And refer to the [Python package](#option-3-python-package) section to learn how to use it.<br>
118
+ 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>
116
119
 
117
120
  ## Overview
118
121
  The core idea is coming from the awesome [maps4cim](https://github.com/klamann/maps4cim) project.<br>
@@ -172,7 +175,7 @@ docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
172
175
  4. Fill in the required fields and click on the `Generate` button.
173
176
  5. When the map is generated click on the `Download` button to get the map.
174
177
 
175
- ### Option 3: Python package
178
+ ### Option 3: Python package or source code
176
179
  🔴 Recommended for developers.
177
180
  🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
178
181
  ⚙️ Advanced settings: enabled.
@@ -183,11 +186,50 @@ You can use the Python package to generate maps. Follow these steps:
183
186
  ```bash
184
187
  pip install maps4fs
185
188
  ```
189
+
190
+ Or clone the repository and install the package from the source code:
191
+ ```bash
192
+ git clone https://github.com/iwatkot/maps4fs.git
193
+ cd maps4fs
194
+ dev/create_venv.ps1 # for Windows
195
+ sh dev/create_venv.sh # for Linux
196
+
197
+ # Activate the virtual environment.
198
+ ./venv/scripts/activate # for Windows
199
+ source venv/bin/activate # for Linux
200
+
201
+ # Edit the demo.py file to set the parameters.
202
+ python demo.py
203
+ ```
204
+
205
+
186
206
  2. Import the Game class and create an instance of it:
187
207
  ```python
188
208
  import maps4fs as mfs
189
209
 
190
- game = mfs.Game.from_code("FS25")
210
+ game_code = "fs25"
211
+ game = mfs.Game.from_code(game_code)
212
+
213
+ dtm_provider = mfs.SRTM30Provider
214
+ dtm_provider_settings = mfs.SRTM30ProviderSettings(easy_mode=True, power_factor=0)
215
+
216
+ lat, lon = 45.28, 20.23
217
+ coordinates = (lat, lon)
218
+ size = 2048
219
+ rotation = 25
220
+
221
+ map_directory = "map_directory"
222
+ os.makedirs(map_directory, exist_ok=True)
223
+
224
+ mp = mfs.Map(
225
+ game,
226
+ dtm_provider,
227
+ dtm_provider_settings,
228
+ coordinates,
229
+ size,
230
+ rotation,
231
+ map_directory,
232
+ )
191
233
  ```
192
234
  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>
193
235
  Structure example:<br>
@@ -200,28 +242,17 @@ Structure example:<br>
200
242
 
201
243
  So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
202
244
 
203
- 3. Create an instance of the Map class:
204
- ```python
205
- import maps4fs as mfs
206
-
207
- map = mfs.Map(
208
- game,
209
- (52.5200, 13.4050), # Latitude and longitude of the map center.
210
- height=1024, # The height of the map in meters.
211
- width=1024, # The width of the map in meters.
212
- map_directory="path/to/your/map/directory", # The directory where the map will be saved.
213
- )
214
- ```
215
-
216
- 4. Generate the map:
245
+ 3. Launch the generation process.
217
246
  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.
218
247
  ```python
219
- for active_component in map.generate():
220
- print(active_component)
248
+ for component_name in mp.generate():
249
+ print(f"Generating {component_name}...")
221
250
  ```
222
251
 
223
252
  The map will be saved in the `map_directory` directory.
224
253
 
254
+ ➡️ Check out the [demo.py](demo.py) file for a complete example.
255
+
225
256
  ## Modder Toolbox
226
257
  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>
227
258
 
@@ -233,6 +264,8 @@ Tools are divided into categories, which are listed below.
233
264
  #### For custom schemas
234
265
  - **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.
235
266
 
267
+ - **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.
268
+
236
269
  #### For Textures and DEM
237
270
  - **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.
238
271
 
@@ -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
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "1.7.0"
7
+ version = "1.7.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 = "MIT License"}
File without changes
File without changes
File without changes
File without changes
File without changes