maps4fs 1.7.1__tar.gz → 1.7.5__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 (38) hide show
  1. {maps4fs-1.7.1 → maps4fs-1.7.5}/PKG-INFO +51 -21
  2. {maps4fs-1.7.1 → maps4fs-1.7.5}/README.md +50 -20
  3. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/__init__.py +4 -2
  4. maps4fs-1.7.5/maps4fs/generator/dtm/dtm.py +549 -0
  5. maps4fs-1.7.5/maps4fs/generator/dtm/nrw.py +127 -0
  6. maps4fs-1.7.5/maps4fs/generator/dtm/srtm.py +124 -0
  7. maps4fs-1.7.5/maps4fs/generator/dtm/usgs.py +135 -0
  8. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/texture.py +9 -2
  9. maps4fs-1.7.5/maps4fs/toolbox/custom_osm.py +67 -0
  10. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs.egg-info/PKG-INFO +51 -21
  11. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs.egg-info/SOURCES.txt +2 -0
  12. {maps4fs-1.7.1 → maps4fs-1.7.5}/pyproject.toml +1 -1
  13. maps4fs-1.7.1/maps4fs/generator/dtm/dtm.py +0 -321
  14. maps4fs-1.7.1/maps4fs/generator/dtm/srtm.py +0 -226
  15. maps4fs-1.7.1/maps4fs/generator/dtm/usgs.py +0 -351
  16. {maps4fs-1.7.1 → maps4fs-1.7.5}/LICENSE.md +0 -0
  17. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/__init__.py +0 -0
  18. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/background.py +0 -0
  19. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/component.py +0 -0
  20. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/config.py +0 -0
  21. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/dem.py +0 -0
  22. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/dtm/__init__.py +0 -0
  23. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/game.py +0 -0
  24. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/grle.py +0 -0
  25. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/i3d.py +0 -0
  26. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/map.py +0 -0
  27. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/qgis.py +0 -0
  28. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/satellite.py +0 -0
  29. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/generator/settings.py +0 -0
  30. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/logger.py +0 -0
  31. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/toolbox/__init__.py +0 -0
  32. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/toolbox/background.py +0 -0
  33. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs/toolbox/dem.py +0 -0
  34. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs.egg-info/dependency_links.txt +0 -0
  35. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs.egg-info/requires.txt +0 -0
  36. {maps4fs-1.7.1 → maps4fs-1.7.5}/maps4fs.egg-info/top_level.txt +0 -0
  37. {maps4fs-1.7.1 → maps4fs-1.7.5}/setup.cfg +0 -0
  38. {maps4fs-1.7.1 → maps4fs-1.7.5}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.7.1
3
+ Version: 1.7.5
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
@@ -36,7 +36,6 @@ Requires-Dist: pydantic
36
36
  <a href="#How-To-Run">How-To-Run</a><br>
37
37
  <a href="docs/FAQ.md">FAQ</a> •
38
38
  <a href="docs/map_structure.md">Map Structure</a> •
39
- <a href="docs/tips_and_hints.md">Tips and Hints</a> •
40
39
  <a href="#Modder-Toolbox">Modder Toolbox</a><br>
41
40
  <a href="#Supported-objects">Supported objects</a> •
42
41
  <a href="#Generation-info">Generation info</a> •
@@ -141,7 +140,7 @@ Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
141
140
  ```bash
142
141
  pip install maps4fs
143
142
  ```
144
- And refer to the [Python package](#option-3-python-package) section to learn how to use it.<br>
143
+ 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>
145
144
 
146
145
  ## Overview
147
146
  The core idea is coming from the awesome [maps4cim](https://github.com/klamann/maps4cim) project.<br>
@@ -201,7 +200,7 @@ docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
201
200
  4. Fill in the required fields and click on the `Generate` button.
202
201
  5. When the map is generated click on the `Download` button to get the map.
203
202
 
204
- ### Option 3: Python package
203
+ ### Option 3: Python package or source code
205
204
  🔴 Recommended for developers.
206
205
  🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
207
206
  ⚙️ Advanced settings: enabled.
@@ -212,11 +211,50 @@ You can use the Python package to generate maps. Follow these steps:
212
211
  ```bash
213
212
  pip install maps4fs
214
213
  ```
214
+
215
+ Or clone the repository and install the package from the source code:
216
+ ```bash
217
+ git clone https://github.com/iwatkot/maps4fs.git
218
+ cd maps4fs
219
+ dev/create_venv.ps1 # for Windows
220
+ sh dev/create_venv.sh # for Linux
221
+
222
+ # Activate the virtual environment.
223
+ ./venv/scripts/activate # for Windows
224
+ source venv/bin/activate # for Linux
225
+
226
+ # Edit the demo.py file to set the parameters.
227
+ python demo.py
228
+ ```
229
+
230
+
215
231
  2. Import the Game class and create an instance of it:
216
232
  ```python
217
233
  import maps4fs as mfs
218
234
 
219
- game = mfs.Game.from_code("FS25")
235
+ game_code = "fs25"
236
+ game = mfs.Game.from_code(game_code)
237
+
238
+ dtm_provider = mfs.SRTM30Provider
239
+ dtm_provider_settings = mfs.SRTM30ProviderSettings(easy_mode=True, power_factor=0)
240
+
241
+ lat, lon = 45.28, 20.23
242
+ coordinates = (lat, lon)
243
+ size = 2048
244
+ rotation = 25
245
+
246
+ map_directory = "map_directory"
247
+ os.makedirs(map_directory, exist_ok=True)
248
+
249
+ mp = mfs.Map(
250
+ game,
251
+ dtm_provider,
252
+ dtm_provider_settings,
253
+ coordinates,
254
+ size,
255
+ rotation,
256
+ map_directory,
257
+ )
220
258
  ```
221
259
  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>
222
260
  Structure example:<br>
@@ -229,28 +267,17 @@ Structure example:<br>
229
267
 
230
268
  So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
231
269
 
232
- 3. Create an instance of the Map class:
233
- ```python
234
- import maps4fs as mfs
235
-
236
- map = mfs.Map(
237
- game,
238
- (52.5200, 13.4050), # Latitude and longitude of the map center.
239
- height=1024, # The height of the map in meters.
240
- width=1024, # The width of the map in meters.
241
- map_directory="path/to/your/map/directory", # The directory where the map will be saved.
242
- )
243
- ```
244
-
245
- 4. Generate the map:
270
+ 3. Launch the generation process.
246
271
  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.
247
272
  ```python
248
- for active_component in map.generate():
249
- print(active_component)
273
+ for component_name in mp.generate():
274
+ print(f"Generating {component_name}...")
250
275
  ```
251
276
 
252
277
  The map will be saved in the `map_directory` directory.
253
278
 
279
+ ➡️ Check out the [demo.py](demo.py) file for a complete example.
280
+
254
281
  ## Modder Toolbox
255
282
  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>
256
283
 
@@ -265,6 +292,9 @@ Tools are divided into categories, which are listed below.
265
292
  - **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.
266
293
 
267
294
  #### For Textures and DEM
295
+
296
+ - **Fix custom OSM file** - this tool fixes the most common errors in the custom OSM file, but it can not guarantee that the file will be fixed completely if some non-common errors are present.
297
+
268
298
  - **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.
269
299
 
270
300
  #### For Background terrain
@@ -10,7 +10,6 @@
10
10
  <a href="#How-To-Run">How-To-Run</a><br>
11
11
  <a href="docs/FAQ.md">FAQ</a> •
12
12
  <a href="docs/map_structure.md">Map Structure</a> •
13
- <a href="docs/tips_and_hints.md">Tips and Hints</a> •
14
13
  <a href="#Modder-Toolbox">Modder Toolbox</a><br>
15
14
  <a href="#Supported-objects">Supported objects</a> •
16
15
  <a href="#Generation-info">Generation info</a> •
@@ -115,7 +114,7 @@ Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
115
114
  ```bash
116
115
  pip install maps4fs
117
116
  ```
118
- And refer to the [Python package](#option-3-python-package) section to learn how to use it.<br>
117
+ 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>
119
118
 
120
119
  ## Overview
121
120
  The core idea is coming from the awesome [maps4cim](https://github.com/klamann/maps4cim) project.<br>
@@ -175,7 +174,7 @@ docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
175
174
  4. Fill in the required fields and click on the `Generate` button.
176
175
  5. When the map is generated click on the `Download` button to get the map.
177
176
 
178
- ### Option 3: Python package
177
+ ### Option 3: Python package or source code
179
178
  🔴 Recommended for developers.
180
179
  🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
181
180
  ⚙️ Advanced settings: enabled.
@@ -186,11 +185,50 @@ You can use the Python package to generate maps. Follow these steps:
186
185
  ```bash
187
186
  pip install maps4fs
188
187
  ```
188
+
189
+ Or clone the repository and install the package from the source code:
190
+ ```bash
191
+ git clone https://github.com/iwatkot/maps4fs.git
192
+ cd maps4fs
193
+ dev/create_venv.ps1 # for Windows
194
+ sh dev/create_venv.sh # for Linux
195
+
196
+ # Activate the virtual environment.
197
+ ./venv/scripts/activate # for Windows
198
+ source venv/bin/activate # for Linux
199
+
200
+ # Edit the demo.py file to set the parameters.
201
+ python demo.py
202
+ ```
203
+
204
+
189
205
  2. Import the Game class and create an instance of it:
190
206
  ```python
191
207
  import maps4fs as mfs
192
208
 
193
- game = mfs.Game.from_code("FS25")
209
+ game_code = "fs25"
210
+ game = mfs.Game.from_code(game_code)
211
+
212
+ dtm_provider = mfs.SRTM30Provider
213
+ dtm_provider_settings = mfs.SRTM30ProviderSettings(easy_mode=True, power_factor=0)
214
+
215
+ lat, lon = 45.28, 20.23
216
+ coordinates = (lat, lon)
217
+ size = 2048
218
+ rotation = 25
219
+
220
+ map_directory = "map_directory"
221
+ os.makedirs(map_directory, exist_ok=True)
222
+
223
+ mp = mfs.Map(
224
+ game,
225
+ dtm_provider,
226
+ dtm_provider_settings,
227
+ coordinates,
228
+ size,
229
+ rotation,
230
+ map_directory,
231
+ )
194
232
  ```
195
233
  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>
196
234
  Structure example:<br>
@@ -203,28 +241,17 @@ Structure example:<br>
203
241
 
204
242
  So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
205
243
 
206
- 3. Create an instance of the Map class:
207
- ```python
208
- import maps4fs as mfs
209
-
210
- map = mfs.Map(
211
- game,
212
- (52.5200, 13.4050), # Latitude and longitude of the map center.
213
- height=1024, # The height of the map in meters.
214
- width=1024, # The width of the map in meters.
215
- map_directory="path/to/your/map/directory", # The directory where the map will be saved.
216
- )
217
- ```
218
-
219
- 4. Generate the map:
244
+ 3. Launch the generation process.
220
245
  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.
221
246
  ```python
222
- for active_component in map.generate():
223
- print(active_component)
247
+ for component_name in mp.generate():
248
+ print(f"Generating {component_name}...")
224
249
  ```
225
250
 
226
251
  The map will be saved in the `map_directory` directory.
227
252
 
253
+ ➡️ Check out the [demo.py](demo.py) file for a complete example.
254
+
228
255
  ## Modder Toolbox
229
256
  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>
230
257
 
@@ -239,6 +266,9 @@ Tools are divided into categories, which are listed below.
239
266
  - **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.
240
267
 
241
268
  #### For Textures and DEM
269
+
270
+ - **Fix custom OSM file** - this tool fixes the most common errors in the custom OSM file, but it can not guarantee that the file will be fixed completely if some non-common errors are present.
271
+
242
272
  - **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.
243
273
 
244
274
  #### For Background terrain
@@ -1,7 +1,8 @@
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
+ from maps4fs.generator.dtm.nrw import NRWProvider, NRWProviderSettings
5
6
  from maps4fs.generator.game import Game
6
7
  from maps4fs.generator.map import Map
7
8
  from maps4fs.generator.settings import (
@@ -9,6 +10,7 @@ from maps4fs.generator.settings import (
9
10
  DEMSettings,
10
11
  GRLESettings,
11
12
  I3DSettings,
13
+ SatelliteSettings,
12
14
  SettingsModel,
13
15
  SplineSettings,
14
16
  TextureSettings,