maps4fs 1.7.1__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 +3 -2
- maps4fs/generator/texture.py +5 -1
- {maps4fs-1.7.1.dist-info → maps4fs-1.7.2.dist-info}/METADATA +48 -20
- {maps4fs-1.7.1.dist-info → maps4fs-1.7.2.dist-info}/RECORD +7 -7
- {maps4fs-1.7.1.dist-info → maps4fs-1.7.2.dist-info}/LICENSE.md +0 -0
- {maps4fs-1.7.1.dist-info → maps4fs-1.7.2.dist-info}/WHEEL +0 -0
- {maps4fs-1.7.1.dist-info → maps4fs-1.7.2.dist-info}/top_level.txt +0 -0
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,
|
maps4fs/generator/texture.py
CHANGED
@@ -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
|
-
|
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.
|
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
|
@@ -141,7 +141,7 @@ Check out the [Docker FAQ](docs/FAQ_docker.md) if you have any questions.<br>
|
|
141
141
|
```bash
|
142
142
|
pip install maps4fs
|
143
143
|
```
|
144
|
-
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>
|
145
145
|
|
146
146
|
## Overview
|
147
147
|
The core idea is coming from the awesome [maps4cim](https://github.com/klamann/maps4cim) project.<br>
|
@@ -201,7 +201,7 @@ docker run -d -p 8501:8501 --name maps4fs iwatkot/maps4fs
|
|
201
201
|
4. Fill in the required fields and click on the `Generate` button.
|
202
202
|
5. When the map is generated click on the `Download` button to get the map.
|
203
203
|
|
204
|
-
### Option 3: Python package
|
204
|
+
### Option 3: Python package or source code
|
205
205
|
🔴 Recommended for developers.
|
206
206
|
🗺️ Supported map sizes: 2x2, 4x4, 8x8, 16x16 km and any custom size.
|
207
207
|
⚙️ Advanced settings: enabled.
|
@@ -212,11 +212,50 @@ You can use the Python package to generate maps. Follow these steps:
|
|
212
212
|
```bash
|
213
213
|
pip install maps4fs
|
214
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
|
+
|
215
232
|
2. Import the Game class and create an instance of it:
|
216
233
|
```python
|
217
234
|
import maps4fs as mfs
|
218
235
|
|
219
|
-
|
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
|
+
)
|
220
259
|
```
|
221
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>
|
222
261
|
Structure example:<br>
|
@@ -229,28 +268,17 @@ Structure example:<br>
|
|
229
268
|
|
230
269
|
So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
|
231
270
|
|
232
|
-
3.
|
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:
|
271
|
+
3. Launch the generation process.
|
246
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.
|
247
273
|
```python
|
248
|
-
for
|
249
|
-
print(
|
274
|
+
for component_name in mp.generate():
|
275
|
+
print(f"Generating {component_name}...")
|
250
276
|
```
|
251
277
|
|
252
278
|
The map will be saved in the `map_directory` directory.
|
253
279
|
|
280
|
+
➡️ Check out the [demo.py](demo.py) file for a complete example.
|
281
|
+
|
254
282
|
## Modder Toolbox
|
255
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>
|
256
284
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
maps4fs/__init__.py,sha256=
|
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=
|
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.
|
24
|
-
maps4fs-1.7.
|
25
|
-
maps4fs-1.7.
|
26
|
-
maps4fs-1.7.
|
27
|
-
maps4fs-1.7.
|
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,,
|
File without changes
|
File without changes
|
File without changes
|