maps4fs 0.7.9__tar.gz → 0.8.3__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 (25) hide show
  1. {maps4fs-0.7.9 → maps4fs-0.8.3}/PKG-INFO +172 -25
  2. maps4fs-0.8.3/README.md +343 -0
  3. maps4fs-0.8.3/maps4fs/generator/background.py +292 -0
  4. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs/generator/component.py +66 -0
  5. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs/generator/config.py +4 -2
  6. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs/generator/dem.py +115 -32
  7. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs/generator/game.py +24 -1
  8. maps4fs-0.8.3/maps4fs/generator/i3d.py +89 -0
  9. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs/generator/map.py +43 -27
  10. maps4fs-0.8.3/maps4fs/generator/path_steps.py +72 -0
  11. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs/generator/texture.py +86 -29
  12. maps4fs-0.8.3/maps4fs/generator/tile.py +55 -0
  13. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs.egg-info/PKG-INFO +172 -25
  14. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs.egg-info/SOURCES.txt +4 -0
  15. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs.egg-info/requires.txt +3 -1
  16. {maps4fs-0.7.9 → maps4fs-0.8.3}/pyproject.toml +4 -2
  17. {maps4fs-0.7.9 → maps4fs-0.8.3}/tests/test_generator.py +68 -51
  18. maps4fs-0.7.9/README.md +0 -198
  19. {maps4fs-0.7.9 → maps4fs-0.8.3}/LICENSE.md +0 -0
  20. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs/__init__.py +0 -0
  21. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs/generator/__init__.py +0 -0
  22. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs/logger.py +0 -0
  23. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs.egg-info/dependency_links.txt +0 -0
  24. {maps4fs-0.7.9 → maps4fs-0.8.3}/maps4fs.egg-info/top_level.txt +0 -0
  25. {maps4fs-0.7.9 → maps4fs-0.8.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maps4fs
3
- Version: 0.7.9
3
+ Version: 0.8.3
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
@@ -16,7 +16,9 @@ License-File: LICENSE.md
16
16
  Requires-Dist: opencv-python
17
17
  Requires-Dist: osmnx<2.0.0
18
18
  Requires-Dist: rasterio
19
- Requires-Dist: tqdm
19
+ Requires-Dist: folium
20
+ Requires-Dist: geopy
21
+ Requires-Dist: trimesh
20
22
 
21
23
  <div align="center" markdown>
22
24
  <img src="https://github.com/iwatkot/maps4fs/assets/118521851/ffd7f0a3-e317-4c3f-911f-2c2fb736fbfa">
@@ -24,9 +26,13 @@ Requires-Dist: tqdm
24
26
  <p align="center">
25
27
  <a href="#Quick-Start">Quick Start</a> •
26
28
  <a href="#Overview">Overview</a> •
27
- <a href="#How-To-Run">How-To-Run</a>
28
- <a href="#Supported-objects">Supported objects</a> •
29
- <a href="#For-advanced-users">For advanced users</a> •
29
+ <a href="#How-To-Run">How-To-Run</a><br>
30
+ <a href="#Supported-objects">Supported objects</a> •
31
+ <a href="#Generation-info">Generation info</a> •
32
+ <a href="#Texture-schema">Texture schema</a> •
33
+ <a href="Background-terrain">Background terrain</a><br>
34
+ <a href="#For-advanced-users">For advanced users</a> •
35
+ <a jref="#Resources">Resources</a> •
30
36
  <a href="#Bugs-and-feature-requests">Bugs and feature requests</a>
31
37
  </p>
32
38
 
@@ -36,6 +42,7 @@ Requires-Dist: tqdm
36
42
  [![Docker Pulls](https://img.shields.io/docker/pulls/iwatkot/maps4fs)](https://hub.docker.com/repository/docker/iwatkot/maps4fs/general)
37
43
  [![GitHub issues](https://img.shields.io/github/issues/iwatkot/maps4fs)](https://github.com/iwatkot/maps4fs/issues)
38
44
  [![Maintainability](https://api.codeclimate.com/v1/badges/b922fd0a7188d37e61de/maintainability)](https://codeclimate.com/github/iwatkot/maps4fs/maintainability)<br>
45
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/maps4fs)](https://pypi.org/project/maps4fs)
39
46
  [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
40
47
  [![Build Status](https://github.com/iwatkot/maps4fs/actions/workflows/checks.yml/badge.svg)](https://github.com/iwatkot/maps4fs/actions)
41
48
  [![Test Coverage](https://api.codeclimate.com/v1/badges/b922fd0a7188d37e61de/test_coverage)](https://codeclimate.com/github/iwatkot/maps4fs/test_coverage)
@@ -48,6 +55,8 @@ Requires-Dist: tqdm
48
55
  🏞️ Generates height using SRTM dataset<br>
49
56
  📦 Provides a ready-to-use map template for the Giants Editor<br>
50
57
  🚜 Supports Farming Simulator 22 and 25<br>
58
+ 🔷 Generates *.obj files for background terrain based on the real-world height map 🆕<br>
59
+ 📄 Generates commands to obtain high-resolution satellite images from [QGIS](https://qgis.org/download/) 🆕<br>
51
60
 
52
61
  ## Quick Start
53
62
  There are several ways to use the tool. You obviously need the **first one**, but you can choose any of the others depending on your needs.<br>
@@ -119,7 +128,7 @@ docker run -d -p 8501:8501 iwatkot/maps4fs
119
128
  4. Fill in the required fields and click on the `Generate` button.
120
129
  5. When the map is generated click on the `Download` button to get the map.
121
130
 
122
- ![WebUI](https://github.com/user-attachments/assets/581e1206-2abd-4b3c-ad31-80554ad92d99)
131
+ ![Basic WebUI](https://github.com/user-attachments/assets/14620044-9e92-47ae-8531-d61460740f58)
123
132
 
124
133
  ### Option 3: Python package
125
134
  🔴 Recommended for developers.<br>
@@ -160,8 +169,10 @@ map = mfs.Map(
160
169
  ```
161
170
 
162
171
  4. Generate the map:
172
+ 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.
163
173
  ```python
164
- map.generate()
174
+ for active_component in map.generate():
175
+ print(active_component)
165
176
  ```
166
177
 
167
178
  The map will be saved in the `map_directory` directory.
@@ -181,30 +192,157 @@ The project is based on the [OpenStreetMap](https://www.openstreetmap.org/) data
181
192
 
182
193
  The list will be updated as the project develops.
183
194
 
184
- ## Info sequence
185
- The script will also generate the `generation_info.json` file in the `output` folder. It contains the following keys: <br>
186
- `"coordinates"` - the coordinates of the map center which you entered,<br>
187
- `"bbox"` - the bounding box of the map in lat and lon,<br>
188
- `"map_height"` - the height of the map in meters (this one is from the user input, e.g. 2048 and so on),<br>
189
- `"map_width"` - the width of the map in meters (same as above),<br>
190
- `"minimum_x"` - the minimum x coordinate of the map (UTM projection),<br>
191
- `"minimum_y"` - the minimum y coordinate of the map (UTM projection),<br>
192
- `"maximum_x"` - the maximum x coordinate of the map (UTM projection),<br>
193
- `"maximum_y"` - the maximum y coordinate of the map (UTM projection),<br>
194
- `"height"` - the height of the map in meters (it won't be equal to the parameters above since the Earth is not flat, sorry flat-earthers),<br>
195
- `"width"` - the width of the map in meters (same as above),<br>
196
- `"height_coef"` - since we need a texture of exact size, the height of the map is multiplied by this coefficient,<br>
197
- `"width_coef"` - same as above but for the width,<br>
198
- `"tile_name"` - the name of the SRTM tile which was used to generate the height map, e.g. "N52E013"<br>
199
-
200
- You can use this information to adjust some other sources of data to the map, e.g. textures, height maps, etc.
195
+ ## Generation info
196
+ The script will generate the `generation_info.json` file in the `output` folder. It splitted to the different sections, which represents the components of the map generator. You may need this information to use some other tools and services to obtain additional data for your map.<br>
197
+
198
+ List of components:
199
+ - `Config` - this component handles the `map.xml` file, where the basic description of the map is stored.
200
+ - `Texture` - this component describes the textures, that were used to generate the map.
201
+ - `DEM` - this component describes the Digital Elevation Model (the one which creates terrain on your map), which was used to generate the height map and related to the `dem.png` file.
202
+ - `I3d` - this component describes the i3d file, where some specific attributes properties and path to the files are stored.
203
+ - `Background` - this component describes the 8 tiles, that surround the map.
204
+
205
+ Below you'll find descriptions of the components and the fields that they contain.<br>
206
+ ℹ️ If there's no information about the component, it means that at the moment it does not store any data in the `generation_info.json` file.
207
+
208
+ ### Texture
209
+
210
+ Example of the `Texture` component:
211
+ ```json
212
+ "Texture": {
213
+ "coordinates": [
214
+ 45.28571409289627,
215
+ 20.237433441210115
216
+ ],
217
+ "bbox": [
218
+ 45.29492313313172,
219
+ 45.27650505266082,
220
+ 20.250522423471406,
221
+ 20.224344458948824
222
+ ],
223
+ "map_height": 2048,
224
+ "map_width": 2048,
225
+ "minimum_x": 439161.2439774908,
226
+ "minimum_y": 5013940.540089059,
227
+ "maximum_x": 441233.5397821935,
228
+ "maximum_y": 5016006.074349126,
229
+ "height": 2065.5342600671574,
230
+ "width": 2072.295804702677,
231
+ "height_coef": 1.0085616504234167,
232
+ "width_coef": 1.011863185889979
233
+ },
234
+ ```
235
+
236
+ And here's the list of the fields:
237
+
238
+ - `"coordinates"` - the coordinates of the map center which you entered,<br>
239
+ - `"bbox"` - the bounding box of the map in lat and lon,<br>
240
+ - `"map_height"` - the height of the map in meters (this one is from the user input, e.g. 2048 and so on),<br>
241
+ - `"map_width"` - the width of the map in meters (same as above),<br>
242
+ - `"minimum_x"` - the minimum x coordinate of the map (UTM projection),<br>
243
+ - `"minimum_y"` - the minimum y coordinate of the map (UTM projection),<br>
244
+ - `"maximum_x"` - the maximum x coordinate of the map (UTM projection),<br>
245
+ - `"maximum_y"` - the maximum y coordinate of the map (UTM projection),<br>
246
+ - `"height"` - the height of the map in meters (it won't be equal to the parameters above since the Earth is not flat, sorry flat-earthers),<br>
247
+ - `"width"` - the width of the map in meters (same as above),<br>
248
+ - `"height_coef"` - since we need a texture of exact size, the height of the map is multiplied by this coefficient,<br>
249
+ - `"width_coef"` - same as above but for the width,<br>
250
+ - `"tile_name"` - the name of the SRTM tile which was used to generate the height map, e.g. "N52E013"<br>
251
+
252
+ ### Background
253
+
254
+ The background component consist of the 8 tiles, each one represents the tile, that surrounds the map. The tiles are named as the cardinal points, e.g. "N", "NE", "E" and so on.<br>
255
+ Example of the `Background` component:
256
+
257
+ ```json
258
+ "Background": {
259
+ "N": {
260
+ "center_latitude": 45.30414170952092,
261
+ "center_longitude": 20.237433441210115,
262
+ "epsg3857_string": "2251363.25324853,2254278.318028022,5668072.719985372,5670987.784803056 [EPSG:3857]",
263
+ "height": 2048,
264
+ "width": 2048,
265
+ "north": 45.31335074975637,
266
+ "south": 45.29493266928547,
267
+ "east": 20.250526677438195,
268
+ "west": 20.224340204982035
269
+ },
270
+ }
271
+ ```
272
+
273
+ And here's the list of the fields:
274
+ - `"center_latitude"` - the latitude of the center of the tile,<br>
275
+ - `"center_longitude"` - the longitude of the center of the tile,<br>
276
+ - `"epsg3857_string"` - the string representation of the bounding box in the EPSG:3857 projection, it's required to obtain the satellite images in the QGIS,<br>
277
+ - `"height"` - the height of the tile in meters,<br>
278
+ - `"width"` - the width of the tile in meters,<br>
279
+ - `"north"` - the northern border of the tile,<br>
280
+ - `"south"` - the southern border of the tile,<br>
281
+ - `"east"` - the eastern border of the tile,<br>
282
+ - `"west"` - the western border of the tile,<br>
283
+
284
+ ## Texture schema
285
+ maps4fs uses a simple JSON file to define the texture schema. For each of supported games this file has unique entries, but the structure is the same. Here's an example of the schema for Farming Simulator 25:
286
+
287
+ ```json
288
+ [
289
+ {
290
+ "name": "forestRockRoots",
291
+ "count": 2,
292
+ "exclude_weight": true
293
+ },
294
+ {
295
+ "name": "grass",
296
+ "count": 2,
297
+ "tags": { "natural": "grassland" },
298
+ "color": [34, 255, 34],
299
+ "priority": 0
300
+ },
301
+ {
302
+ "name": "grassClovers",
303
+ "count": 2
304
+ },
305
+ {
306
+ "name": "grassCut",
307
+ "count": 2
308
+ },
309
+ {
310
+ "name": "grassDirtPatchy",
311
+ "count": 2,
312
+ "tags": { "natural": ["wood", "tree_row"] },
313
+ "width": 2,
314
+ "color": [0, 252, 124]
315
+ }
316
+ ]
317
+ ```
318
+ Let's have a closer look at the fields:
319
+ - `name` - the name of the texture. Just the way the file will be named.
320
+ - `count` - the number of textures of this type. For example, for the **dirtMedium** texture there will be two textures: **dirtMedium01_weight.png** and **dirtMedium02_weight.png**.
321
+ ℹ️ There's one texture that have count `0`, it's the waterPuddle texture from FS22, which not present in FS25.
322
+ - `tags` - the tags from the OpenStreetMap data. Refer to the section [Supported objects](#supported-objects) to see the list of supported tags. If there are no tags, the texture file will be generated empty and no objects will be placed on it.
323
+ - `width` - the width of the texture in meters. Some of the objects from OSM (roads, for example) are lines, not areas. So, to draw them correctly, the tool needs to know the width of the line.
324
+ - `color` - the color of the texture. It's used only in the preview images and have no effect on the map itself. But remember that previews are crucial for the map making process, so it's better to set the color to something that represents the texture.
325
+ - `priority` - the priority of the texture for overlapping. Textures with higher priorities will be drawn over the textures with lower priorities.
326
+ ℹ️ The texture with 0 priority considers the base layer, which means that all empty areas will be filled with this texture.
327
+ - `exclude_weight` - this only used for the forestRockRoots texture from FS25. It's just means that this texture has no `weight` postfix, that's all.
328
+
329
+ ## Background terrain
330
+ The tool now supports the generation of the background terrain. If you don't know what it is, here's a brief explanation. The background terrain is the world around the map. It's important to create it, because if you don't, the map will look like it's floating in the void. The background terrain is a simple plane which can (and should) be texture to look fine.<br>
331
+ So, the tool generates the background terrain in the form of the 8 tiles, which surround the map. The tiles are named as the cardinal points, e.g. "N", "NE", "E" and so on. All those tiles will be saved in the `objects/tiles` directory with corresponding names: `N.obj`, `NE.obj`, `E.obj` and so on.<br>
332
+ If you're willing to create a background terrain, you will need: Blender, the Blender Exporter Plugins and the QGIS. You'll find the download links in the [Resources](#resources) section.<br>
333
+
334
+ If you're afraid of this task, please don't be. It's really simple and I've prepaired detailed step-by-step instructions for you, you'll find them in the separate README files. Here are the steps you need to follow:
335
+
336
+ 1. [Download high-resolution satellite images](README_satellite_images.md).
337
+ 2. [Prepare the i3d files](README_i3d.md).
338
+ 3. [Import the i3d files to Giants Editor](README_giants_editor.md).
201
339
 
202
340
  ## For advanced users
203
341
  The tool supports the custom size of the map. To use this feature select `Custom` in the `Map size` dropdown and enter the desired size. The tool will generate a map with the size you entered.<br>
204
342
 
205
343
  ⛔️ Do not use this feature, if you don't know what you're doing. In most cases the Giants Editor will just crash on opening the file, because you need to enter a specific values for the map size.<br><br>
206
344
 
207
- ![Advanced settings and custom size](https://github.com/user-attachments/assets/327b6065-09ed-41d0-86a8-7d904025707c)
345
+ ![Advanced settings](https://github.com/user-attachments/assets/0446cdf2-f093-49ba-ba8f-9bef18a58b47)
208
346
 
209
347
  You can also apply some advanced settings to the map generation process. Note that they're ADVANCED, so you don't need to use them if you're not sure what they do.<br>
210
348
 
@@ -214,5 +352,14 @@ Here's the list of the advanced settings:
214
352
 
215
353
  - DEM Blur radius: the radius of the Gaussian blur filter applied to the DEM map. By default, it's set to 21. This filter just makes the DEM map smoother, so the height transitions will be more natural. You can set it to 1 to disable the filter, but it will result as a Minecraft-like map.
216
354
 
355
+ ## Resources
356
+ In this section you'll find a list of the resources that you need to create a map for the Farming Simulator.<br>
357
+ To create a basic map, you only need the Giants Editor. But if you want to create a background terrain - the world around the map, so it won't look like it's floating in the void - you also need Blender and the Blender Exporter Plugins. To create realistic textures for the background terrain, the QGIS is required to obtain high-resolution satellite images.<br>
358
+
359
+ 1. [Giants Editor](https://gdn.giants-software.com/downloads.php) - the official tool for creating maps for the Farming Simulator.
360
+ 2. [Blender](https://www.blender.org/download/) - the open-source 3D modeling software that you can use to create models for the Farming Simulator.
361
+ 3. [Blender Exporter Plugins](https://gdn.giants-software.com/downloads.php) - the official plugins for exporting models from Blender to i3d format (the format used in the Farming Simulator).
362
+ 4. [QGIS](https://qgis.org/download/) - the open-source GIS software that you can use to obtain high-resolution satellite images for your map.
363
+
217
364
  ## Bugs and feature requests
218
365
  If you find a bug or have an idea for a new feature, please create an issue [here](https://github.com/iwatkot/maps4fs/issues) or contact me directly on [Telegram](https://t.me/iwatkot).<br>
@@ -0,0 +1,343 @@
1
+ <div align="center" markdown>
2
+ <img src="https://github.com/iwatkot/maps4fs/assets/118521851/ffd7f0a3-e317-4c3f-911f-2c2fb736fbfa">
3
+
4
+ <p align="center">
5
+ <a href="#Quick-Start">Quick Start</a> •
6
+ <a href="#Overview">Overview</a> •
7
+ <a href="#How-To-Run">How-To-Run</a><br>
8
+ <a href="#Supported-objects">Supported objects</a> •
9
+ <a href="#Generation-info">Generation info</a> •
10
+ <a href="#Texture-schema">Texture schema</a> •
11
+ <a href="Background-terrain">Background terrain</a><br>
12
+ <a href="#For-advanced-users">For advanced users</a> •
13
+ <a jref="#Resources">Resources</a> •
14
+ <a href="#Bugs-and-feature-requests">Bugs and feature requests</a>
15
+ </p>
16
+
17
+
18
+ [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/iwatkot/maps4fs)](https://github.com/iwatkot/maps4fs/releases)
19
+ [![PyPI - Version](https://img.shields.io/pypi/v/maps4fs)](https://pypi.org/project/maps4fs)
20
+ [![Docker Pulls](https://img.shields.io/docker/pulls/iwatkot/maps4fs)](https://hub.docker.com/repository/docker/iwatkot/maps4fs/general)
21
+ [![GitHub issues](https://img.shields.io/github/issues/iwatkot/maps4fs)](https://github.com/iwatkot/maps4fs/issues)
22
+ [![Maintainability](https://api.codeclimate.com/v1/badges/b922fd0a7188d37e61de/maintainability)](https://codeclimate.com/github/iwatkot/maps4fs/maintainability)<br>
23
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/maps4fs)](https://pypi.org/project/maps4fs)
24
+ [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
25
+ [![Build Status](https://github.com/iwatkot/maps4fs/actions/workflows/checks.yml/badge.svg)](https://github.com/iwatkot/maps4fs/actions)
26
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/b922fd0a7188d37e61de/test_coverage)](https://codeclimate.com/github/iwatkot/maps4fs/test_coverage)
27
+ [![GitHub Repo stars](https://img.shields.io/github/stars/iwatkot/maps4fs)](https://github.com/iwatkot/maps4fs/stargazers)
28
+
29
+ </div>
30
+
31
+ 🗺️ Supports 2x2, 4x4, 8x8, 16x16 and any custom size maps<br>
32
+ 🌍 Based on real-world data from OpenStreetMap<br>
33
+ 🏞️ Generates height using SRTM dataset<br>
34
+ 📦 Provides a ready-to-use map template for the Giants Editor<br>
35
+ 🚜 Supports Farming Simulator 22 and 25<br>
36
+ 🔷 Generates *.obj files for background terrain based on the real-world height map 🆕<br>
37
+ 📄 Generates commands to obtain high-resolution satellite images from [QGIS](https://qgis.org/download/) 🆕<br>
38
+
39
+ ## Quick Start
40
+ There are several ways to use the tool. You obviously need the **first one**, but you can choose any of the others depending on your needs.<br>
41
+ ### 🚜 For most users
42
+ **Option 1:** open the [maps4fs](https://maps4fs.streamlit.app) on StreamLit and generate a map template in a few clicks.<br>
43
+
44
+ ### 😎 For advanced users
45
+ **Option 2:** run the Docker version in your browser. Launch the following command in your terminal:
46
+ ```bash
47
+ docker run -d -p 8501:8501 iwatkot/maps4fs
48
+ ```
49
+ And open [http://localhost:8501](http://localhost:8501) in your browser.<br>
50
+ If you don't know how to use Docker, navigate to the [Docker version](#option-2-docker-version), it's really simple.<br>
51
+
52
+ ### 🤯 For developers
53
+ **Option 3:** Python package. Install the package using the following command:
54
+ ```bash
55
+ pip install maps4fs
56
+ ```
57
+ And refer to the [Python package](#option-3-python-package) section to learn how to use it.<br>
58
+
59
+ ## Overview
60
+ The core idea is coming from the awesome [maps4cim](https://github.com/klamann/maps4cim) project.<br>
61
+
62
+ The main goal of this project is to generate map templates, based on real-world data, for the Farming Simulator. It's important to mention that **templates are not maps**. They are just a starting point for creating a map. This tool just uses built-in textures to highlight different types of terrain and buildings with correct shapes and scales and to generate a height map. The rest of the work is up to you. So if you thought that you could just run this tool and get a playable map, then I'm sorry to disappoint you. But if you are a map maker, then this tool will save you a lot of time.<br>
63
+ So, if you're new to map making, here's a quick overview of the process:
64
+ 1. Generate a map template using this tool.
65
+ 2. Download the Giants Editor.
66
+ 3. Open the map template in the Giants Editor.
67
+ 4. Now you can start creating your map (adding roads, fields, buildings, etc.).
68
+
69
+ ### Previews
70
+
71
+ The generator also creates a multiple previews of the map. Here's the list of them:
72
+ 1. General preview - merging all the layers into one image with different colors.
73
+ 2. Grayscale DEM preview - a grayscale image of the height map (as it is).
74
+ 3. Colored DEM preview - a colored image of the height map (from blue to red). The blue color represents the lowest point, and the red color represents the highest point.
75
+
76
+ ![16 km map](https://github.com/user-attachments/assets/82543bcc-1289-479e-bd13-85a8890f0485)<br>
77
+ *Preview of a 16 km map with a 500-meter mountain in the middle of it.*<br>
78
+
79
+ Parameters:
80
+ - coordinates: 45.15, 19.71
81
+ - size: 16 x 16 km
82
+
83
+ ## How-To-Run
84
+
85
+ You'll find detailed instructions on how to run the project below. But if you prefer video tutorials, here's one for you:
86
+ <a href="https://www.youtube.com/watch?v=ujwWKHVKsw8" target="_blank"><img src="https://github.com/user-attachments/assets/6dbbbc71-d04f-40b2-9fba-81e5e4857407"/></a>
87
+ <i>Video tutorial: How to generate a Farming Simulator 22 map from real-world data.</i>
88
+
89
+ ### Option 1: StreamLit
90
+ 🟢 Recommended for all users, you don't need to install anything.<br>
91
+ Using the [StreamLit](https://maps4fs.streamlit.app) version of the tool is the easiest way to generate a map template. Just open the link and follow the instructions.
92
+ 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>
93
+
94
+ Using it is easy and doesn't require any guides. Enjoy!
95
+
96
+ ### Option 2: Docker version
97
+ 🟠 Recommended for users who want faster processing, very simple installation.<br>
98
+ You can launch the project with minimalistic UI in your browser using Docker. Follow these steps:
99
+
100
+ 1. Install [Docker](https://docs.docker.com/get-docker/) for your OS.
101
+ 2. Run the following command in your terminal:
102
+ ```bash
103
+ docker run -d -p 8501:8501 iwatkot/maps4fs
104
+ ```
105
+ 3. Open your browser and go to [http://localhost:8501](http://localhost:8501).
106
+ 4. Fill in the required fields and click on the `Generate` button.
107
+ 5. When the map is generated click on the `Download` button to get the map.
108
+
109
+ ![Basic WebUI](https://github.com/user-attachments/assets/14620044-9e92-47ae-8531-d61460740f58)
110
+
111
+ ### Option 3: Python package
112
+ 🔴 Recommended for developers.<br>
113
+ You can use the Python package to generate maps. Follow these steps:
114
+
115
+ 1. Install the package from PyPI:
116
+ ```bash
117
+ pip install maps4fs
118
+ ```
119
+ 2. Import the Game class and create an instance of it:
120
+ ```python
121
+ import maps4fs as mfs
122
+
123
+ game = mfs.Game.from_code("FS25")
124
+ ```
125
+ 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>
126
+ Structure example:<br>
127
+
128
+ ```text
129
+ 📁 data
130
+ ┣ 📄 fs22-map-template.zip
131
+ ┗ 📄 fs22-texture-schema.json
132
+ ```
133
+
134
+ So it's recommended to download the `data` directory from the repository and place it in the root of your project.<br>
135
+
136
+ 3. Create an instance of the Map class:
137
+ ```python
138
+ import maps4fs as mfs
139
+
140
+ map = mfs.Map(
141
+ game,
142
+ (52.5200, 13.4050), # Latitude and longitude of the map center.
143
+ height=1024, # The height of the map in meters.
144
+ width=1024, # The width of the map in meters.
145
+ map_directory="path/to/your/map/directory", # The directory where the map will be saved.
146
+ )
147
+ ```
148
+
149
+ 4. Generate the map:
150
+ 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.
151
+ ```python
152
+ for active_component in map.generate():
153
+ print(active_component)
154
+ ```
155
+
156
+ The map will be saved in the `map_directory` directory.
157
+
158
+ ## Supported objects
159
+ The project is based on the [OpenStreetMap](https://www.openstreetmap.org/) data. So, refer to [this page](https://wiki.openstreetmap.org/wiki/Map_Features) to understand the list below.
160
+ - "building": True
161
+ - "highway": ["motorway", "trunk", "primary"]
162
+ - "highway": ["secondary", "tertiary", "road", "service"]
163
+ - "highway": ["unclassified", "residential", "track"]
164
+ - "natural": ["grassland", "scrub"]
165
+ - "landuse": "farmland"
166
+ - "natural": ["water"]
167
+ - "waterway": True
168
+ - "natural": ["wood", "tree_row"]
169
+ - "railway": True
170
+
171
+ The list will be updated as the project develops.
172
+
173
+ ## Generation info
174
+ The script will generate the `generation_info.json` file in the `output` folder. It splitted to the different sections, which represents the components of the map generator. You may need this information to use some other tools and services to obtain additional data for your map.<br>
175
+
176
+ List of components:
177
+ - `Config` - this component handles the `map.xml` file, where the basic description of the map is stored.
178
+ - `Texture` - this component describes the textures, that were used to generate the map.
179
+ - `DEM` - this component describes the Digital Elevation Model (the one which creates terrain on your map), which was used to generate the height map and related to the `dem.png` file.
180
+ - `I3d` - this component describes the i3d file, where some specific attributes properties and path to the files are stored.
181
+ - `Background` - this component describes the 8 tiles, that surround the map.
182
+
183
+ Below you'll find descriptions of the components and the fields that they contain.<br>
184
+ ℹ️ If there's no information about the component, it means that at the moment it does not store any data in the `generation_info.json` file.
185
+
186
+ ### Texture
187
+
188
+ Example of the `Texture` component:
189
+ ```json
190
+ "Texture": {
191
+ "coordinates": [
192
+ 45.28571409289627,
193
+ 20.237433441210115
194
+ ],
195
+ "bbox": [
196
+ 45.29492313313172,
197
+ 45.27650505266082,
198
+ 20.250522423471406,
199
+ 20.224344458948824
200
+ ],
201
+ "map_height": 2048,
202
+ "map_width": 2048,
203
+ "minimum_x": 439161.2439774908,
204
+ "minimum_y": 5013940.540089059,
205
+ "maximum_x": 441233.5397821935,
206
+ "maximum_y": 5016006.074349126,
207
+ "height": 2065.5342600671574,
208
+ "width": 2072.295804702677,
209
+ "height_coef": 1.0085616504234167,
210
+ "width_coef": 1.011863185889979
211
+ },
212
+ ```
213
+
214
+ And here's the list of the fields:
215
+
216
+ - `"coordinates"` - the coordinates of the map center which you entered,<br>
217
+ - `"bbox"` - the bounding box of the map in lat and lon,<br>
218
+ - `"map_height"` - the height of the map in meters (this one is from the user input, e.g. 2048 and so on),<br>
219
+ - `"map_width"` - the width of the map in meters (same as above),<br>
220
+ - `"minimum_x"` - the minimum x coordinate of the map (UTM projection),<br>
221
+ - `"minimum_y"` - the minimum y coordinate of the map (UTM projection),<br>
222
+ - `"maximum_x"` - the maximum x coordinate of the map (UTM projection),<br>
223
+ - `"maximum_y"` - the maximum y coordinate of the map (UTM projection),<br>
224
+ - `"height"` - the height of the map in meters (it won't be equal to the parameters above since the Earth is not flat, sorry flat-earthers),<br>
225
+ - `"width"` - the width of the map in meters (same as above),<br>
226
+ - `"height_coef"` - since we need a texture of exact size, the height of the map is multiplied by this coefficient,<br>
227
+ - `"width_coef"` - same as above but for the width,<br>
228
+ - `"tile_name"` - the name of the SRTM tile which was used to generate the height map, e.g. "N52E013"<br>
229
+
230
+ ### Background
231
+
232
+ The background component consist of the 8 tiles, each one represents the tile, that surrounds the map. The tiles are named as the cardinal points, e.g. "N", "NE", "E" and so on.<br>
233
+ Example of the `Background` component:
234
+
235
+ ```json
236
+ "Background": {
237
+ "N": {
238
+ "center_latitude": 45.30414170952092,
239
+ "center_longitude": 20.237433441210115,
240
+ "epsg3857_string": "2251363.25324853,2254278.318028022,5668072.719985372,5670987.784803056 [EPSG:3857]",
241
+ "height": 2048,
242
+ "width": 2048,
243
+ "north": 45.31335074975637,
244
+ "south": 45.29493266928547,
245
+ "east": 20.250526677438195,
246
+ "west": 20.224340204982035
247
+ },
248
+ }
249
+ ```
250
+
251
+ And here's the list of the fields:
252
+ - `"center_latitude"` - the latitude of the center of the tile,<br>
253
+ - `"center_longitude"` - the longitude of the center of the tile,<br>
254
+ - `"epsg3857_string"` - the string representation of the bounding box in the EPSG:3857 projection, it's required to obtain the satellite images in the QGIS,<br>
255
+ - `"height"` - the height of the tile in meters,<br>
256
+ - `"width"` - the width of the tile in meters,<br>
257
+ - `"north"` - the northern border of the tile,<br>
258
+ - `"south"` - the southern border of the tile,<br>
259
+ - `"east"` - the eastern border of the tile,<br>
260
+ - `"west"` - the western border of the tile,<br>
261
+
262
+ ## Texture schema
263
+ maps4fs uses a simple JSON file to define the texture schema. For each of supported games this file has unique entries, but the structure is the same. Here's an example of the schema for Farming Simulator 25:
264
+
265
+ ```json
266
+ [
267
+ {
268
+ "name": "forestRockRoots",
269
+ "count": 2,
270
+ "exclude_weight": true
271
+ },
272
+ {
273
+ "name": "grass",
274
+ "count": 2,
275
+ "tags": { "natural": "grassland" },
276
+ "color": [34, 255, 34],
277
+ "priority": 0
278
+ },
279
+ {
280
+ "name": "grassClovers",
281
+ "count": 2
282
+ },
283
+ {
284
+ "name": "grassCut",
285
+ "count": 2
286
+ },
287
+ {
288
+ "name": "grassDirtPatchy",
289
+ "count": 2,
290
+ "tags": { "natural": ["wood", "tree_row"] },
291
+ "width": 2,
292
+ "color": [0, 252, 124]
293
+ }
294
+ ]
295
+ ```
296
+ Let's have a closer look at the fields:
297
+ - `name` - the name of the texture. Just the way the file will be named.
298
+ - `count` - the number of textures of this type. For example, for the **dirtMedium** texture there will be two textures: **dirtMedium01_weight.png** and **dirtMedium02_weight.png**.
299
+ ℹ️ There's one texture that have count `0`, it's the waterPuddle texture from FS22, which not present in FS25.
300
+ - `tags` - the tags from the OpenStreetMap data. Refer to the section [Supported objects](#supported-objects) to see the list of supported tags. If there are no tags, the texture file will be generated empty and no objects will be placed on it.
301
+ - `width` - the width of the texture in meters. Some of the objects from OSM (roads, for example) are lines, not areas. So, to draw them correctly, the tool needs to know the width of the line.
302
+ - `color` - the color of the texture. It's used only in the preview images and have no effect on the map itself. But remember that previews are crucial for the map making process, so it's better to set the color to something that represents the texture.
303
+ - `priority` - the priority of the texture for overlapping. Textures with higher priorities will be drawn over the textures with lower priorities.
304
+ ℹ️ The texture with 0 priority considers the base layer, which means that all empty areas will be filled with this texture.
305
+ - `exclude_weight` - this only used for the forestRockRoots texture from FS25. It's just means that this texture has no `weight` postfix, that's all.
306
+
307
+ ## Background terrain
308
+ The tool now supports the generation of the background terrain. If you don't know what it is, here's a brief explanation. The background terrain is the world around the map. It's important to create it, because if you don't, the map will look like it's floating in the void. The background terrain is a simple plane which can (and should) be texture to look fine.<br>
309
+ So, the tool generates the background terrain in the form of the 8 tiles, which surround the map. The tiles are named as the cardinal points, e.g. "N", "NE", "E" and so on. All those tiles will be saved in the `objects/tiles` directory with corresponding names: `N.obj`, `NE.obj`, `E.obj` and so on.<br>
310
+ If you're willing to create a background terrain, you will need: Blender, the Blender Exporter Plugins and the QGIS. You'll find the download links in the [Resources](#resources) section.<br>
311
+
312
+ If you're afraid of this task, please don't be. It's really simple and I've prepaired detailed step-by-step instructions for you, you'll find them in the separate README files. Here are the steps you need to follow:
313
+
314
+ 1. [Download high-resolution satellite images](README_satellite_images.md).
315
+ 2. [Prepare the i3d files](README_i3d.md).
316
+ 3. [Import the i3d files to Giants Editor](README_giants_editor.md).
317
+
318
+ ## For advanced users
319
+ The tool supports the custom size of the map. To use this feature select `Custom` in the `Map size` dropdown and enter the desired size. The tool will generate a map with the size you entered.<br>
320
+
321
+ ⛔️ Do not use this feature, if you don't know what you're doing. In most cases the Giants Editor will just crash on opening the file, because you need to enter a specific values for the map size.<br><br>
322
+
323
+ ![Advanced settings](https://github.com/user-attachments/assets/0446cdf2-f093-49ba-ba8f-9bef18a58b47)
324
+
325
+ You can also apply some advanced settings to the map generation process. Note that they're ADVANCED, so you don't need to use them if you're not sure what they do.<br>
326
+
327
+ Here's the list of the advanced settings:
328
+
329
+ - DEM multiplier: the height of the map is multiplied by this value. So the DEM map is just a 16-bit grayscale image, which means that the maximum avaiable value there is 65535, while the actual difference between the deepest and the highest point on Earth is about 20 km. So, by default this value is set to 3. Just note that this setting mostly does not matter, because you can always adjust it in the Giants Editor, learn more about the [heightScale](https://www.farming-simulator.org/19/terrain-heightscale.php) parameter on the [PMC Farming Simulator](https://www.farming-simulator.org/) website.
330
+
331
+ - DEM Blur radius: the radius of the Gaussian blur filter applied to the DEM map. By default, it's set to 21. This filter just makes the DEM map smoother, so the height transitions will be more natural. You can set it to 1 to disable the filter, but it will result as a Minecraft-like map.
332
+
333
+ ## Resources
334
+ In this section you'll find a list of the resources that you need to create a map for the Farming Simulator.<br>
335
+ To create a basic map, you only need the Giants Editor. But if you want to create a background terrain - the world around the map, so it won't look like it's floating in the void - you also need Blender and the Blender Exporter Plugins. To create realistic textures for the background terrain, the QGIS is required to obtain high-resolution satellite images.<br>
336
+
337
+ 1. [Giants Editor](https://gdn.giants-software.com/downloads.php) - the official tool for creating maps for the Farming Simulator.
338
+ 2. [Blender](https://www.blender.org/download/) - the open-source 3D modeling software that you can use to create models for the Farming Simulator.
339
+ 3. [Blender Exporter Plugins](https://gdn.giants-software.com/downloads.php) - the official plugins for exporting models from Blender to i3d format (the format used in the Farming Simulator).
340
+ 4. [QGIS](https://qgis.org/download/) - the open-source GIS software that you can use to obtain high-resolution satellite images for your map.
341
+
342
+ ## Bugs and feature requests
343
+ If you find a bug or have an idea for a new feature, please create an issue [here](https://github.com/iwatkot/maps4fs/issues) or contact me directly on [Telegram](https://t.me/iwatkot).<br>