maps4fs 2.2.71__tar.gz → 2.2.73__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 (36) hide show
  1. {maps4fs-2.2.71 → maps4fs-2.2.73}/PKG-INFO +27 -147
  2. {maps4fs-2.2.71 → maps4fs-2.2.73}/README.md +25 -143
  3. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/dem.py +0 -6
  4. maps4fs-2.2.73/maps4fs/generator/config.py +154 -0
  5. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/map.py +2 -0
  6. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs.egg-info/PKG-INFO +27 -147
  7. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs.egg-info/requires.txt +1 -3
  8. {maps4fs-2.2.71 → maps4fs-2.2.73}/pyproject.toml +2 -4
  9. maps4fs-2.2.71/maps4fs/generator/config.py +0 -93
  10. {maps4fs-2.2.71 → maps4fs-2.2.73}/LICENSE.md +0 -0
  11. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/__init__.py +0 -0
  12. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/__init__.py +0 -0
  13. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/__init__.py +0 -0
  14. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/background.py +0 -0
  15. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/base/__init__.py +0 -0
  16. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/base/component.py +0 -0
  17. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/base/component_image.py +0 -0
  18. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/base/component_mesh.py +0 -0
  19. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/base/component_xml.py +0 -0
  20. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/config.py +0 -0
  21. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/grle.py +0 -0
  22. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/i3d.py +0 -0
  23. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/layer.py +0 -0
  24. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/satellite.py +0 -0
  25. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/component/texture.py +0 -0
  26. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/game.py +0 -0
  27. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/qgis.py +0 -0
  28. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/settings.py +0 -0
  29. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/statistics.py +0 -0
  30. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/generator/utils.py +0 -0
  31. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs/logger.py +0 -0
  32. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs.egg-info/SOURCES.txt +0 -0
  33. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs.egg-info/dependency_links.txt +0 -0
  34. {maps4fs-2.2.71 → maps4fs-2.2.73}/maps4fs.egg-info/top_level.txt +0 -0
  35. {maps4fs-2.2.71 → maps4fs-2.2.73}/setup.cfg +0 -0
  36. {maps4fs-2.2.71 → maps4fs-2.2.73}/tests/test_generator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.2.71
3
+ Version: 2.2.73
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
@@ -18,15 +18,13 @@ Requires-Dist: osmnx>=2.0.0
18
18
  Requires-Dist: rasterio
19
19
  Requires-Dist: geopy
20
20
  Requires-Dist: trimesh
21
- Requires-Dist: imageio
22
- Requires-Dist: tifffile
23
- Requires-Dist: pympler
24
21
  Requires-Dist: pydantic
25
22
  Requires-Dist: pygmdl
26
23
  Requires-Dist: owslib
27
24
  Requires-Dist: tqdm
28
25
  Requires-Dist: scipy
29
26
  Requires-Dist: pydtmdl
27
+ Requires-Dist: manifold3d
30
28
  Dynamic: license-file
31
29
 
32
30
  ⚠️ Learn more about the 2.0 changes in the [migration guide](docs/migration.md).
@@ -54,7 +52,6 @@ Dynamic: license-file
54
52
  <a href="#Overview">Overview</a> •
55
53
  <a href="docs/step_by_step.md">Create a map in 10 steps</a> •
56
54
  <a href="docs/recommendations.md">Practical recommendations</a> •
57
- <a href="#How-To-Run">How-To-Run</a><br>
58
55
  <a href="docs/my_maps.md">My Maps</a> •
59
56
  <a href="docs/FAQ.md">FAQ</a> •
60
57
  <a href="docs/map_structure.md">Map Structure</a> •
@@ -151,38 +148,49 @@ There are several ways to use the tool. You obviously need the **first one**, bu
151
148
  ### 🚜 For most users
152
149
 
153
150
  **Option 1:** Open the [maps4fs](https://maps4fs.xyz) and generate a map template in a few clicks.<br>
151
+ 🟢 Recommended for all users.
152
+ 🛠️ Don't need to install anything.
153
+ 🗺️ Supported map sizes: 2x2, 4x4, custom sizes not available.
154
+ ✂️ Map scaling: not supported.
155
+ ⚙️ Advanced settings: some settings not available.
154
156
 
155
157
  ![Basic WebUI](https://github.com/iwatkot/maps4fs/releases/download/2.0.0/maps4fs_wui.png)
156
158
 
157
159
  ### 😎 For advanced users
158
160
 
159
- **Option 2:** Run the Docker version in your browser. Launch the following command in your terminal:
160
-
161
- ```bash
162
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs iwatkot/maps4fs
163
- ```
161
+ **Option 2:** Run the Docker version in your browser.
162
+ 🟠 Recommended for users who want bigger maps, fast generation, nice-looking textures, and advanced settings.
163
+ 🛠️ Docker installation required, launch with one command.
164
+ 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
165
+ ✂️ Map scaling: supported.
166
+ ⚙️ Advanced settings: all settings available.
164
167
 
165
- If you want to persist your data, you can mount a directory to the container:
168
+ Launch the following command in your terminal to use the Setup Wizard:
166
169
 
167
- ```bash
168
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs -v /c/maps4fs:/usr/src/app/mfsrootdir iwatkot/maps4fs
170
+ ```powershell
171
+ powershell -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/iwatkot/maps4fs/main/setup-wizard.ps1' -UseBasicParsing).Content"
169
172
  ```
170
173
 
171
- Learn more in the [My Maps](docs/my_maps.md) documentation.
174
+ ℹ️ Check out detailed instructions about [local deployment](docs/local_deployment.md).
172
175
 
173
- And open [http://localhost:8501](http://localhost:8501) in your browser.<br>
174
- If you don't know how to use Docker, navigate to the [Docker version](#option-2-docker-version), it's really simple.<br>
175
- Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
176
176
 
177
177
  ### 🤯 For developers
178
178
 
179
- **Option 3:** Python package. Install the package using the following command:
179
+ **Option 3:** Python package or run from source code.
180
+ 🔴 Recommended for developers who want full control over the generation process and fastest performance.
181
+ 🛠️ Requires Python, pip, and Git.
182
+ 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
183
+ ✂️ Map scaling: supported.
184
+ ⚙️ Advanced settings: all settings available.
185
+
186
+ Install the package using the following command:
180
187
 
181
188
  ```bash
182
189
  pip install maps4fs
183
190
  ```
184
191
 
185
- 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>
192
+ ℹ️ Check out detailed instructions about [Maps4FS Python Package Deployment](docs/local_deployment_source.md).
193
+
186
194
 
187
195
  ## Overview
188
196
 
@@ -216,134 +224,6 @@ Parameters:
216
224
 
217
225
  Don't know where to start? Don't worry, just follow this [step-by-step guide](docs/step_by_step.md) to create your first map in 10 simple steps.<br>
218
226
 
219
- ## How-To-Run
220
-
221
- ### Option 1: Public version
222
-
223
- 🟢 Recommended for all users.
224
- 🛠️ Don't need to install anything.
225
- 🗺️ Supported map sizes: 2x2, 4x4.
226
- ✂️ Map scaling: not supported.
227
- ⚙️ Advanced settings: partial.
228
- 🖼️ Texture dissolving: disabled.
229
- Using the public version on [maps4fs.xyz](https://maps4fs.xyz) is the easiest way to generate a map template. Just open the link and follow the instructions.
230
- 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>
231
-
232
- Using it is easy and doesn't require any guides. Enjoy!
233
-
234
- ### Option 2: Docker version
235
-
236
- 🟠 Recommended for users who want bigger maps, fast generation, nice-looking textures, and advanced settings.
237
- 🛠️ Launch with one single command.
238
- 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
239
- ✂️ Map scaling: supported.
240
- ⚙️ Advanced settings: enabled.
241
- 🖼️ Texture dissolving: enabled.
242
- Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
243
-
244
- 📹 Check out the [video tutorial](https://www.youtube.com/watch?v=1AHGIxTxSBM) on how to install Docker and use the Docker version.
245
-
246
- You can launch the project with minimalistic UI in your browser using Docker. Follow these steps:
247
-
248
- 1. Install [Docker](https://docs.docker.com/get-docker/) for your OS.
249
- 2. Run the following command in your terminal:
250
-
251
- ```bash
252
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs iwatkot/maps4fs
253
- ```
254
-
255
- If you want to persist your data, you can mount a directory to the container:
256
-
257
- ```bash
258
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs -v /c/maps4fs:/usr/src/app/mfsrootdir iwatkot/maps4fs
259
- ```
260
-
261
- 3. Open your browser and go to [http://localhost:8501](http://localhost:8501).
262
- 4. Fill in the required fields and click on the `Generate` button.
263
- 5. When the map is generated click on the `Download` button to get the map.
264
-
265
- ### Option 3: Python package or source code
266
-
267
- 🔴 Recommended for developers.
268
- 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
269
- ✂️ Map scaling: supported.
270
- ⚙️ Advanced settings: enabled.
271
- 🖼️ Texture dissolving: enabled.
272
- You can use the Python package to generate maps. Follow these steps:
273
-
274
- 1. Install the package from PyPI:
275
-
276
- ```bash
277
- pip install maps4fs
278
- ```
279
-
280
- Or clone the repository and install the package from the source code:
281
-
282
- ```bash
283
- git clone https://github.com/iwatkot/maps4fs.git
284
- cd maps4fs
285
- dev/create_venv.ps1 # for Windows
286
- sh dev/create_venv.sh # for Linux
287
-
288
- # Activate the virtual environment.
289
- ./venv/scripts/activate # for Windows
290
- source venv/bin/activate # for Linux
291
-
292
- # Edit the demo.py file to set the parameters.
293
- python demo.py
294
- ```
295
-
296
- 2. Import the Game class and create an instance of it:
297
-
298
- ```python
299
- import maps4fs as mfs
300
-
301
- game_code = "fs25"
302
- game = mfs.Game.from_code(game_code)
303
-
304
- dtm_provider = mfs.dtm.SRTM30Provider
305
-
306
- lat, lon = 45.28, 20.23
307
- coordinates = (lat, lon)
308
- size = 2048
309
- rotation = 25
310
-
311
- map_directory = "map_directory"
312
- os.makedirs(map_directory, exist_ok=True)
313
-
314
- mp = mfs.Map(
315
- game,
316
- dtm_provider,
317
- None,
318
- coordinates,
319
- size,
320
- rotation,
321
- map_directory,
322
- )
323
- ```
324
-
325
- 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>
326
- Structure example:<br>
327
-
328
- ```text
329
- 📁 data
330
- ┣ 📄 fs22-map-template.zip
331
- ┗ 📄 fs22-texture-schema.json
332
- ```
333
-
334
- So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
335
-
336
- 3. Launch the generation process.
337
- 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.
338
-
339
- ```python
340
- for component_name in mp.generate():
341
- print(f"Generating {component_name}...")
342
- ```
343
-
344
- The map will be saved in the `map_directory` directory.
345
-
346
- ➡️ Check out the [demo.py](demo.py) file for a complete example.
347
227
 
348
228
  ## Schemas Editor
349
229
 
@@ -23,7 +23,6 @@
23
23
  <a href="#Overview">Overview</a> •
24
24
  <a href="docs/step_by_step.md">Create a map in 10 steps</a> •
25
25
  <a href="docs/recommendations.md">Practical recommendations</a> •
26
- <a href="#How-To-Run">How-To-Run</a><br>
27
26
  <a href="docs/my_maps.md">My Maps</a> •
28
27
  <a href="docs/FAQ.md">FAQ</a> •
29
28
  <a href="docs/map_structure.md">Map Structure</a> •
@@ -120,38 +119,49 @@ There are several ways to use the tool. You obviously need the **first one**, bu
120
119
  ### 🚜 For most users
121
120
 
122
121
  **Option 1:** Open the [maps4fs](https://maps4fs.xyz) and generate a map template in a few clicks.<br>
122
+ 🟢 Recommended for all users.
123
+ 🛠️ Don't need to install anything.
124
+ 🗺️ Supported map sizes: 2x2, 4x4, custom sizes not available.
125
+ ✂️ Map scaling: not supported.
126
+ ⚙️ Advanced settings: some settings not available.
123
127
 
124
128
  ![Basic WebUI](https://github.com/iwatkot/maps4fs/releases/download/2.0.0/maps4fs_wui.png)
125
129
 
126
130
  ### 😎 For advanced users
127
131
 
128
- **Option 2:** Run the Docker version in your browser. Launch the following command in your terminal:
129
-
130
- ```bash
131
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs iwatkot/maps4fs
132
- ```
132
+ **Option 2:** Run the Docker version in your browser.
133
+ 🟠 Recommended for users who want bigger maps, fast generation, nice-looking textures, and advanced settings.
134
+ 🛠️ Docker installation required, launch with one command.
135
+ 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
136
+ ✂️ Map scaling: supported.
137
+ ⚙️ Advanced settings: all settings available.
133
138
 
134
- If you want to persist your data, you can mount a directory to the container:
139
+ Launch the following command in your terminal to use the Setup Wizard:
135
140
 
136
- ```bash
137
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs -v /c/maps4fs:/usr/src/app/mfsrootdir iwatkot/maps4fs
141
+ ```powershell
142
+ powershell -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/iwatkot/maps4fs/main/setup-wizard.ps1' -UseBasicParsing).Content"
138
143
  ```
139
144
 
140
- Learn more in the [My Maps](docs/my_maps.md) documentation.
145
+ ℹ️ Check out detailed instructions about [local deployment](docs/local_deployment.md).
141
146
 
142
- And open [http://localhost:8501](http://localhost:8501) in your browser.<br>
143
- If you don't know how to use Docker, navigate to the [Docker version](#option-2-docker-version), it's really simple.<br>
144
- Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
145
147
 
146
148
  ### 🤯 For developers
147
149
 
148
- **Option 3:** Python package. Install the package using the following command:
150
+ **Option 3:** Python package or run from source code.
151
+ 🔴 Recommended for developers who want full control over the generation process and fastest performance.
152
+ 🛠️ Requires Python, pip, and Git.
153
+ 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
154
+ ✂️ Map scaling: supported.
155
+ ⚙️ Advanced settings: all settings available.
156
+
157
+ Install the package using the following command:
149
158
 
150
159
  ```bash
151
160
  pip install maps4fs
152
161
  ```
153
162
 
154
- 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>
163
+ ℹ️ Check out detailed instructions about [Maps4FS Python Package Deployment](docs/local_deployment_source.md).
164
+
155
165
 
156
166
  ## Overview
157
167
 
@@ -185,134 +195,6 @@ Parameters:
185
195
 
186
196
  Don't know where to start? Don't worry, just follow this [step-by-step guide](docs/step_by_step.md) to create your first map in 10 simple steps.<br>
187
197
 
188
- ## How-To-Run
189
-
190
- ### Option 1: Public version
191
-
192
- 🟢 Recommended for all users.
193
- 🛠️ Don't need to install anything.
194
- 🗺️ Supported map sizes: 2x2, 4x4.
195
- ✂️ Map scaling: not supported.
196
- ⚙️ Advanced settings: partial.
197
- 🖼️ Texture dissolving: disabled.
198
- Using the public version on [maps4fs.xyz](https://maps4fs.xyz) is the easiest way to generate a map template. Just open the link and follow the instructions.
199
- 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>
200
-
201
- Using it is easy and doesn't require any guides. Enjoy!
202
-
203
- ### Option 2: Docker version
204
-
205
- 🟠 Recommended for users who want bigger maps, fast generation, nice-looking textures, and advanced settings.
206
- 🛠️ Launch with one single command.
207
- 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
208
- ✂️ Map scaling: supported.
209
- ⚙️ Advanced settings: enabled.
210
- 🖼️ Texture dissolving: enabled.
211
- Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
212
-
213
- 📹 Check out the [video tutorial](https://www.youtube.com/watch?v=1AHGIxTxSBM) on how to install Docker and use the Docker version.
214
-
215
- You can launch the project with minimalistic UI in your browser using Docker. Follow these steps:
216
-
217
- 1. Install [Docker](https://docs.docker.com/get-docker/) for your OS.
218
- 2. Run the following command in your terminal:
219
-
220
- ```bash
221
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs iwatkot/maps4fs
222
- ```
223
-
224
- If you want to persist your data, you can mount a directory to the container:
225
-
226
- ```bash
227
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs -v /c/maps4fs:/usr/src/app/mfsrootdir iwatkot/maps4fs
228
- ```
229
-
230
- 3. Open your browser and go to [http://localhost:8501](http://localhost:8501).
231
- 4. Fill in the required fields and click on the `Generate` button.
232
- 5. When the map is generated click on the `Download` button to get the map.
233
-
234
- ### Option 3: Python package or source code
235
-
236
- 🔴 Recommended for developers.
237
- 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
238
- ✂️ Map scaling: supported.
239
- ⚙️ Advanced settings: enabled.
240
- 🖼️ Texture dissolving: enabled.
241
- You can use the Python package to generate maps. Follow these steps:
242
-
243
- 1. Install the package from PyPI:
244
-
245
- ```bash
246
- pip install maps4fs
247
- ```
248
-
249
- Or clone the repository and install the package from the source code:
250
-
251
- ```bash
252
- git clone https://github.com/iwatkot/maps4fs.git
253
- cd maps4fs
254
- dev/create_venv.ps1 # for Windows
255
- sh dev/create_venv.sh # for Linux
256
-
257
- # Activate the virtual environment.
258
- ./venv/scripts/activate # for Windows
259
- source venv/bin/activate # for Linux
260
-
261
- # Edit the demo.py file to set the parameters.
262
- python demo.py
263
- ```
264
-
265
- 2. Import the Game class and create an instance of it:
266
-
267
- ```python
268
- import maps4fs as mfs
269
-
270
- game_code = "fs25"
271
- game = mfs.Game.from_code(game_code)
272
-
273
- dtm_provider = mfs.dtm.SRTM30Provider
274
-
275
- lat, lon = 45.28, 20.23
276
- coordinates = (lat, lon)
277
- size = 2048
278
- rotation = 25
279
-
280
- map_directory = "map_directory"
281
- os.makedirs(map_directory, exist_ok=True)
282
-
283
- mp = mfs.Map(
284
- game,
285
- dtm_provider,
286
- None,
287
- coordinates,
288
- size,
289
- rotation,
290
- map_directory,
291
- )
292
- ```
293
-
294
- 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>
295
- Structure example:<br>
296
-
297
- ```text
298
- 📁 data
299
- ┣ 📄 fs22-map-template.zip
300
- ┗ 📄 fs22-texture-schema.json
301
- ```
302
-
303
- So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
304
-
305
- 3. Launch the generation process.
306
- 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.
307
-
308
- ```python
309
- for component_name in mp.generate():
310
- print(f"Generating {component_name}...")
311
- ```
312
-
313
- The map will be saved in the `map_directory` directory.
314
-
315
- ➡️ Check out the [demo.py](demo.py) file for a complete example.
316
198
 
317
199
  ## Schemas Editor
318
200
 
@@ -7,9 +7,6 @@ import cv2
7
7
  import numpy as np
8
8
  from pydtmdl import DTMProvider
9
9
 
10
- # import rasterio # type: ignore
11
- from pympler import asizeof # type: ignore
12
-
13
10
  import maps4fs.generator.config as mfscfg
14
11
  from maps4fs.generator.component.base.component_image import ImageComponent
15
12
 
@@ -297,9 +294,6 @@ class DEM(ImageComponent):
297
294
  """
298
295
  resampled_data = cv2.resize(data, self.output_resolution, interpolation=cv2.INTER_LINEAR)
299
296
 
300
- size_of_resampled_data = asizeof.asizeof(resampled_data) / 1024 / 1024
301
- self.logger.debug("Size of resampled data: %s MB.", size_of_resampled_data)
302
-
303
297
  return resampled_data
304
298
 
305
299
  def rotate_dem(self) -> None:
@@ -0,0 +1,154 @@
1
+ """This module contains configuration files for the maps4fs generator."""
2
+
3
+ import os
4
+ import shutil
5
+ import subprocess
6
+ import tempfile
7
+
8
+ from osmnx import settings as ox_settings
9
+
10
+ from maps4fs.logger import Logger
11
+
12
+ logger = Logger()
13
+
14
+ MFS_TEMPLATES_DIR = os.path.join(os.getcwd(), "templates")
15
+
16
+
17
+ def ensure_templates():
18
+ """Ensure templates directory exists and is populated with data.
19
+
20
+ If MFS_TEMPLATES_DIR is empty or doesn't exist, clone the maps4fsdata
21
+ repository and run the preparation script to populate it.
22
+ """
23
+
24
+ # Check if templates directory exists and has content
25
+ if os.path.exists(MFS_TEMPLATES_DIR) and os.listdir(MFS_TEMPLATES_DIR):
26
+ logger.info("Templates directory already exists and contains data: %s", MFS_TEMPLATES_DIR)
27
+ return
28
+
29
+ logger.info("Templates directory is empty or missing, preparing data...")
30
+
31
+ # Create templates directory if it doesn't exist
32
+ os.makedirs(MFS_TEMPLATES_DIR, exist_ok=True)
33
+
34
+ try:
35
+ with tempfile.TemporaryDirectory() as temp_dir:
36
+ clone_dir = os.path.join(temp_dir, "maps4fsdata")
37
+
38
+ logger.info("Cloning maps4fsdata repository to temporary directory...")
39
+ # Clone the repository with depth 1 (shallow clone)
40
+ subprocess.run(
41
+ [
42
+ "git",
43
+ "clone",
44
+ "--depth",
45
+ "1",
46
+ "https://github.com/iwatkot/maps4fsdata.git",
47
+ clone_dir,
48
+ ],
49
+ check=True,
50
+ capture_output=True,
51
+ text=True,
52
+ )
53
+
54
+ # Make the preparation script executable
55
+ prep_script = os.path.join(clone_dir, "prepare_data.sh")
56
+ if os.path.exists(prep_script):
57
+ os.chmod(prep_script, 0o755)
58
+
59
+ logger.info("Running data preparation script...")
60
+ # Run the preparation script from the cloned directory
61
+ subprocess.run(
62
+ ["./prepare_data.sh"], cwd=clone_dir, check=True, capture_output=True, text=True
63
+ )
64
+
65
+ # Copy the generated data directory to templates directory
66
+ data_src = os.path.join(clone_dir, "data")
67
+ if os.path.exists(data_src):
68
+ logger.info(
69
+ "Copying prepared data to templates directory: %s", MFS_TEMPLATES_DIR
70
+ )
71
+ # Copy all files from data directory to MFS_TEMPLATES_DIR
72
+ for item in os.listdir(data_src):
73
+ src_path = os.path.join(data_src, item)
74
+ dst_path = os.path.join(MFS_TEMPLATES_DIR, item)
75
+ if os.path.isdir(src_path):
76
+ shutil.copytree(src_path, dst_path, dirs_exist_ok=True)
77
+ else:
78
+ shutil.copy2(src_path, dst_path)
79
+ logger.info("Templates data prepared successfully")
80
+ else:
81
+ logger.error("Data directory not found after running preparation script")
82
+ raise FileNotFoundError(
83
+ "Data preparation script did not create expected data directory"
84
+ )
85
+ else:
86
+ logger.error("Preparation script not found: %s", prep_script)
87
+ raise FileNotFoundError("prepare_data.sh not found in cloned repository")
88
+
89
+ except subprocess.CalledProcessError as e:
90
+ logger.error("Failed to prepare templates data: %s", str(e))
91
+ if e.stdout:
92
+ logger.error("Script stdout: %s", e.stdout)
93
+ if e.stderr:
94
+ logger.error("Script stderr: %s", e.stderr)
95
+ raise
96
+ except Exception as e:
97
+ logger.error("Error preparing templates: %s", str(e))
98
+ raise
99
+
100
+
101
+ ensure_templates()
102
+
103
+ MFS_ROOT_DIR = os.getenv("MFS_ROOT_DIRECTORY", os.path.join(os.getcwd(), "mfsrootdir"))
104
+ MFS_CACHE_DIR = os.path.join(MFS_ROOT_DIR, "cache")
105
+ MFS_DATA_DIR = os.path.join(MFS_ROOT_DIR, "maps")
106
+ os.makedirs(MFS_CACHE_DIR, exist_ok=True)
107
+ os.makedirs(MFS_DATA_DIR, exist_ok=True)
108
+ logger.info(
109
+ "MFS_ROOT_DIR: %s. MFS_CACHE_DIR: %s. MFS_DATA_DIR: %s.",
110
+ MFS_ROOT_DIR,
111
+ MFS_CACHE_DIR,
112
+ MFS_DATA_DIR,
113
+ )
114
+
115
+ DTM_CACHE_DIR = os.path.join(MFS_CACHE_DIR, "dtm")
116
+ SAT_CACHE_DIR = os.path.join(MFS_CACHE_DIR, "sat")
117
+
118
+ osmnx_cache = os.path.join(MFS_CACHE_DIR, "osmnx")
119
+ osmnx_data = os.path.join(MFS_CACHE_DIR, "odata")
120
+ os.makedirs(osmnx_cache, exist_ok=True)
121
+ os.makedirs(osmnx_data, exist_ok=True)
122
+
123
+
124
+ ox_settings.cache_folder = osmnx_cache
125
+ ox_settings.data_folder = osmnx_data
126
+
127
+
128
+ def get_package_version(package_name: str) -> str:
129
+ """Get the package version.
130
+
131
+ Arguments:
132
+ package_name (str): The name of the package to check.
133
+
134
+ Returns:
135
+ str: The version of the package, or "unknown" if it cannot be determined.
136
+ """
137
+ try:
138
+ result = subprocess.run(
139
+ [os.sys.executable, "-m", "pip", "show", package_name], # type: ignore
140
+ stdout=subprocess.PIPE,
141
+ stderr=subprocess.PIPE,
142
+ text=True,
143
+ check=True,
144
+ )
145
+ for line in result.stdout.splitlines():
146
+ if line.startswith("Version:"):
147
+ return line.split(":", 1)[1].strip()
148
+ return "unknown"
149
+ except Exception:
150
+ return "unknown"
151
+
152
+
153
+ PACKAGE_VERSION = get_package_version("maps4fs")
154
+ logger.info("maps4fs version: %s", PACKAGE_VERSION)
@@ -67,6 +67,8 @@ class Map:
67
67
 
68
68
  # region custom OSM properties
69
69
  self.custom_osm = custom_osm
70
+ if custom_osm and not os.path.isfile(custom_osm):
71
+ raise FileNotFoundError(f"Custom OSM file {custom_osm} does not exist.")
70
72
  mfsutils.check_and_fix_osm(self.custom_osm, save_directory=self.map_directory)
71
73
  # endregion
72
74
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.2.71
3
+ Version: 2.2.73
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
@@ -18,15 +18,13 @@ Requires-Dist: osmnx>=2.0.0
18
18
  Requires-Dist: rasterio
19
19
  Requires-Dist: geopy
20
20
  Requires-Dist: trimesh
21
- Requires-Dist: imageio
22
- Requires-Dist: tifffile
23
- Requires-Dist: pympler
24
21
  Requires-Dist: pydantic
25
22
  Requires-Dist: pygmdl
26
23
  Requires-Dist: owslib
27
24
  Requires-Dist: tqdm
28
25
  Requires-Dist: scipy
29
26
  Requires-Dist: pydtmdl
27
+ Requires-Dist: manifold3d
30
28
  Dynamic: license-file
31
29
 
32
30
  ⚠️ Learn more about the 2.0 changes in the [migration guide](docs/migration.md).
@@ -54,7 +52,6 @@ Dynamic: license-file
54
52
  <a href="#Overview">Overview</a> •
55
53
  <a href="docs/step_by_step.md">Create a map in 10 steps</a> •
56
54
  <a href="docs/recommendations.md">Practical recommendations</a> •
57
- <a href="#How-To-Run">How-To-Run</a><br>
58
55
  <a href="docs/my_maps.md">My Maps</a> •
59
56
  <a href="docs/FAQ.md">FAQ</a> •
60
57
  <a href="docs/map_structure.md">Map Structure</a> •
@@ -151,38 +148,49 @@ There are several ways to use the tool. You obviously need the **first one**, bu
151
148
  ### 🚜 For most users
152
149
 
153
150
  **Option 1:** Open the [maps4fs](https://maps4fs.xyz) and generate a map template in a few clicks.<br>
151
+ 🟢 Recommended for all users.
152
+ 🛠️ Don't need to install anything.
153
+ 🗺️ Supported map sizes: 2x2, 4x4, custom sizes not available.
154
+ ✂️ Map scaling: not supported.
155
+ ⚙️ Advanced settings: some settings not available.
154
156
 
155
157
  ![Basic WebUI](https://github.com/iwatkot/maps4fs/releases/download/2.0.0/maps4fs_wui.png)
156
158
 
157
159
  ### 😎 For advanced users
158
160
 
159
- **Option 2:** Run the Docker version in your browser. Launch the following command in your terminal:
160
-
161
- ```bash
162
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs iwatkot/maps4fs
163
- ```
161
+ **Option 2:** Run the Docker version in your browser.
162
+ 🟠 Recommended for users who want bigger maps, fast generation, nice-looking textures, and advanced settings.
163
+ 🛠️ Docker installation required, launch with one command.
164
+ 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
165
+ ✂️ Map scaling: supported.
166
+ ⚙️ Advanced settings: all settings available.
164
167
 
165
- If you want to persist your data, you can mount a directory to the container:
168
+ Launch the following command in your terminal to use the Setup Wizard:
166
169
 
167
- ```bash
168
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs -v /c/maps4fs:/usr/src/app/mfsrootdir iwatkot/maps4fs
170
+ ```powershell
171
+ powershell -ExecutionPolicy Bypass -Command "iex (iwr 'https://raw.githubusercontent.com/iwatkot/maps4fs/main/setup-wizard.ps1' -UseBasicParsing).Content"
169
172
  ```
170
173
 
171
- Learn more in the [My Maps](docs/my_maps.md) documentation.
174
+ ℹ️ Check out detailed instructions about [local deployment](docs/local_deployment.md).
172
175
 
173
- And open [http://localhost:8501](http://localhost:8501) in your browser.<br>
174
- If you don't know how to use Docker, navigate to the [Docker version](#option-2-docker-version), it's really simple.<br>
175
- Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
176
176
 
177
177
  ### 🤯 For developers
178
178
 
179
- **Option 3:** Python package. Install the package using the following command:
179
+ **Option 3:** Python package or run from source code.
180
+ 🔴 Recommended for developers who want full control over the generation process and fastest performance.
181
+ 🛠️ Requires Python, pip, and Git.
182
+ 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
183
+ ✂️ Map scaling: supported.
184
+ ⚙️ Advanced settings: all settings available.
185
+
186
+ Install the package using the following command:
180
187
 
181
188
  ```bash
182
189
  pip install maps4fs
183
190
  ```
184
191
 
185
- 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>
192
+ ℹ️ Check out detailed instructions about [Maps4FS Python Package Deployment](docs/local_deployment_source.md).
193
+
186
194
 
187
195
  ## Overview
188
196
 
@@ -216,134 +224,6 @@ Parameters:
216
224
 
217
225
  Don't know where to start? Don't worry, just follow this [step-by-step guide](docs/step_by_step.md) to create your first map in 10 simple steps.<br>
218
226
 
219
- ## How-To-Run
220
-
221
- ### Option 1: Public version
222
-
223
- 🟢 Recommended for all users.
224
- 🛠️ Don't need to install anything.
225
- 🗺️ Supported map sizes: 2x2, 4x4.
226
- ✂️ Map scaling: not supported.
227
- ⚙️ Advanced settings: partial.
228
- 🖼️ Texture dissolving: disabled.
229
- Using the public version on [maps4fs.xyz](https://maps4fs.xyz) is the easiest way to generate a map template. Just open the link and follow the instructions.
230
- 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>
231
-
232
- Using it is easy and doesn't require any guides. Enjoy!
233
-
234
- ### Option 2: Docker version
235
-
236
- 🟠 Recommended for users who want bigger maps, fast generation, nice-looking textures, and advanced settings.
237
- 🛠️ Launch with one single command.
238
- 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
239
- ✂️ Map scaling: supported.
240
- ⚙️ Advanced settings: enabled.
241
- 🖼️ Texture dissolving: enabled.
242
- Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
243
-
244
- 📹 Check out the [video tutorial](https://www.youtube.com/watch?v=1AHGIxTxSBM) on how to install Docker and use the Docker version.
245
-
246
- You can launch the project with minimalistic UI in your browser using Docker. Follow these steps:
247
-
248
- 1. Install [Docker](https://docs.docker.com/get-docker/) for your OS.
249
- 2. Run the following command in your terminal:
250
-
251
- ```bash
252
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs iwatkot/maps4fs
253
- ```
254
-
255
- If you want to persist your data, you can mount a directory to the container:
256
-
257
- ```bash
258
- docker run -d -p 8501:8501 -p 8000:8000 --name maps4fs -v /c/maps4fs:/usr/src/app/mfsrootdir iwatkot/maps4fs
259
- ```
260
-
261
- 3. Open your browser and go to [http://localhost:8501](http://localhost:8501).
262
- 4. Fill in the required fields and click on the `Generate` button.
263
- 5. When the map is generated click on the `Download` button to get the map.
264
-
265
- ### Option 3: Python package or source code
266
-
267
- 🔴 Recommended for developers.
268
- 🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
269
- ✂️ Map scaling: supported.
270
- ⚙️ Advanced settings: enabled.
271
- 🖼️ Texture dissolving: enabled.
272
- You can use the Python package to generate maps. Follow these steps:
273
-
274
- 1. Install the package from PyPI:
275
-
276
- ```bash
277
- pip install maps4fs
278
- ```
279
-
280
- Or clone the repository and install the package from the source code:
281
-
282
- ```bash
283
- git clone https://github.com/iwatkot/maps4fs.git
284
- cd maps4fs
285
- dev/create_venv.ps1 # for Windows
286
- sh dev/create_venv.sh # for Linux
287
-
288
- # Activate the virtual environment.
289
- ./venv/scripts/activate # for Windows
290
- source venv/bin/activate # for Linux
291
-
292
- # Edit the demo.py file to set the parameters.
293
- python demo.py
294
- ```
295
-
296
- 2. Import the Game class and create an instance of it:
297
-
298
- ```python
299
- import maps4fs as mfs
300
-
301
- game_code = "fs25"
302
- game = mfs.Game.from_code(game_code)
303
-
304
- dtm_provider = mfs.dtm.SRTM30Provider
305
-
306
- lat, lon = 45.28, 20.23
307
- coordinates = (lat, lon)
308
- size = 2048
309
- rotation = 25
310
-
311
- map_directory = "map_directory"
312
- os.makedirs(map_directory, exist_ok=True)
313
-
314
- mp = mfs.Map(
315
- game,
316
- dtm_provider,
317
- None,
318
- coordinates,
319
- size,
320
- rotation,
321
- map_directory,
322
- )
323
- ```
324
-
325
- 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>
326
- Structure example:<br>
327
-
328
- ```text
329
- 📁 data
330
- ┣ 📄 fs22-map-template.zip
331
- ┗ 📄 fs22-texture-schema.json
332
- ```
333
-
334
- So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
335
-
336
- 3. Launch the generation process.
337
- 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.
338
-
339
- ```python
340
- for component_name in mp.generate():
341
- print(f"Generating {component_name}...")
342
- ```
343
-
344
- The map will be saved in the `map_directory` directory.
345
-
346
- ➡️ Check out the [demo.py](demo.py) file for a complete example.
347
227
 
348
228
  ## Schemas Editor
349
229
 
@@ -3,12 +3,10 @@ osmnx>=2.0.0
3
3
  rasterio
4
4
  geopy
5
5
  trimesh
6
- imageio
7
- tifffile
8
- pympler
9
6
  pydantic
10
7
  pygmdl
11
8
  owslib
12
9
  tqdm
13
10
  scipy
14
11
  pydtmdl
12
+ manifold3d
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maps4fs"
7
- version = "2.2.71"
7
+ version = "2.2.73"
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"}
@@ -22,15 +22,13 @@ dependencies = [
22
22
  "rasterio",
23
23
  "geopy",
24
24
  "trimesh",
25
- "imageio",
26
- "tifffile",
27
- "pympler",
28
25
  "pydantic",
29
26
  "pygmdl",
30
27
  "owslib",
31
28
  "tqdm",
32
29
  "scipy",
33
30
  "pydtmdl",
31
+ "manifold3d",
34
32
  ]
35
33
 
36
34
  [project.urls]
@@ -1,93 +0,0 @@
1
- """This module contains configuration files for the maps4fs generator."""
2
-
3
- import os
4
- import shutil
5
- import subprocess
6
-
7
- from osmnx import settings as ox_settings
8
-
9
- from maps4fs.logger import Logger
10
-
11
- logger = Logger()
12
-
13
- DEFAULT_TEMPLATES_DIR = os.path.join(os.getcwd(), "data")
14
- MFS_TEMPLATES_DIR = os.getenv("MFS_TEMPLATES_DIRECTORY")
15
- if MFS_TEMPLATES_DIR is None:
16
- logger.info("MFS_TEMPLATES_DIRECTORY is not set. Using default templates directory.")
17
- MFS_TEMPLATES_DIR = DEFAULT_TEMPLATES_DIR
18
- else:
19
- logger.info("MFS_TEMPLATES_DIRECTORY is set to: %s", MFS_TEMPLATES_DIR)
20
- if not os.path.isdir(MFS_TEMPLATES_DIR):
21
- logger.info("Templates directory %s does not exist. Creating it.", MFS_TEMPLATES_DIR)
22
- os.makedirs(MFS_TEMPLATES_DIR, exist_ok=True)
23
-
24
- # Check if there any files (directory is empty).
25
- if not os.listdir(MFS_TEMPLATES_DIR):
26
- logger.info("Templates directory %s is empty. Copying default files.", MFS_TEMPLATES_DIR)
27
- for item in os.listdir(DEFAULT_TEMPLATES_DIR):
28
- s = os.path.join(DEFAULT_TEMPLATES_DIR, item)
29
- d = os.path.join(MFS_TEMPLATES_DIR, item)
30
- if os.path.isdir(s):
31
- shutil.copytree(s, d, False, None)
32
- else:
33
- shutil.copy2(s, d)
34
- logger.info("Default files copied to %s.", MFS_TEMPLATES_DIR)
35
- else:
36
- logger.warning(
37
- "Templates directory %s is not empty. Will not copy default files. "
38
- "Ensure that the directory contains the necessary template files.",
39
- MFS_TEMPLATES_DIR,
40
- )
41
-
42
- MFS_ROOT_DIR = os.getenv("MFS_ROOT_DIRECTORY", os.path.join(os.getcwd(), "mfsrootdir"))
43
- MFS_CACHE_DIR = os.path.join(MFS_ROOT_DIR, "cache")
44
- MFS_DATA_DIR = os.path.join(MFS_ROOT_DIR, "data")
45
- os.makedirs(MFS_CACHE_DIR, exist_ok=True)
46
- os.makedirs(MFS_DATA_DIR, exist_ok=True)
47
- logger.info(
48
- "MFS_ROOT_DIR: %s. MFS_CACHE_DIR: %s. MFS_DATA_DIR: %s.",
49
- MFS_ROOT_DIR,
50
- MFS_CACHE_DIR,
51
- MFS_DATA_DIR,
52
- )
53
-
54
- DTM_CACHE_DIR = os.path.join(MFS_CACHE_DIR, "dtm")
55
- SAT_CACHE_DIR = os.path.join(MFS_CACHE_DIR, "sat")
56
-
57
- osmnx_cache = os.path.join(MFS_CACHE_DIR, "osmnx")
58
- osmnx_data = os.path.join(MFS_CACHE_DIR, "odata")
59
- os.makedirs(osmnx_cache, exist_ok=True)
60
- os.makedirs(osmnx_data, exist_ok=True)
61
-
62
-
63
- ox_settings.cache_folder = osmnx_cache
64
- ox_settings.data_folder = osmnx_data
65
-
66
-
67
- def get_package_version(package_name: str) -> str:
68
- """Get the package version.
69
-
70
- Arguments:
71
- package_name (str): The name of the package to check.
72
-
73
- Returns:
74
- str: The version of the package, or "unknown" if it cannot be determined.
75
- """
76
- try:
77
- result = subprocess.run(
78
- [os.sys.executable, "-m", "pip", "show", package_name], # type: ignore
79
- stdout=subprocess.PIPE,
80
- stderr=subprocess.PIPE,
81
- text=True,
82
- check=True,
83
- )
84
- for line in result.stdout.splitlines():
85
- if line.startswith("Version:"):
86
- return line.split(":", 1)[1].strip()
87
- return "unknown"
88
- except Exception:
89
- return "unknown"
90
-
91
-
92
- PACKAGE_VERSION = get_package_version("maps4fs")
93
- logger.info("maps4fs version: %s", PACKAGE_VERSION)
File without changes
File without changes
File without changes
File without changes