Generate map templates for Farming Simulator from real places.
Project description
Quick Start • Overview • How-To-Run • Supported objects • For advanced users • Bugs and feature requests
🗺️ Supports 2x2, 4x4, 8x8, 16x16 and any custom size maps
🌍 Based on real-world data from OpenStreetMap
🏞️ Generates height using SRTM dataset
📦 Provides a ready-to-use map template for the Giants Editor
🚜 Supports Farming Simulator 22 and 25*
* changes in the library are ready, waiting for the Giants to release the Giants Editor v10. Meanwhile the option to generate a map for FS25 is disabled.
Quick Start
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.
🚜 For most users
Option 1: open the maps4fs on StreamLit and generate a map template in a few clicks.
😎 For advanced users
Option 2: run the Docker version in your browser. Launch the following command in your terminal:
docker run -d -p 8501:8501 iwatkot/maps4fs
And open http://localhost:8501 in your browser.
If you don't know how to use Docker, navigate to the Docker version, it's really simple.
🤯 For developers
Option 3: Python package. Install the package using the following command:
pip install maps4fs
And refer to the Python package section to learn how to use it.
Overview
The core idea is coming from the awesome maps4cim project.
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.
So, if you're new to map making, here's a quick overview of the process:
- Generate a map template using this tool.
- Download the Giants Editor.
- Open the map template in the Giants Editor.
- Now you can start creating your map (adding roads, fields, buildings, etc.).
Previews
The generator also creates a multiple previews of the map. Here's the list of them:
- General preview - merging all the layers into one image with different colors.
- Grayscale DEM preview - a grayscale image of the height map (as it is).
- 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.
Preview of a 16 km map with a 500-meter mountain in the middle of it.
Parameters:
- coordinates: 45.15, 19.71
- size: 16 x 16 km
How-To-Run
You'll find detailed instructions on how to run the project below. But if you prefer video tutorials, here's one for you: Video tutorial: How to generate a Farming Simulator 22 map from real-world data.
Option 1: StreamLit
🟢 Recommended for all users, you don't need to install anything.
Using the StreamLit version of the tool is the easiest way to generate a map template. Just open the link and follow the instructions.
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.
Using it is easy and doesn't require any guides. Enjoy!
Option 2: Docker version
🟠 Recommended for users who want faster processing, very simple installation.
You can launch the project with minimalistic UI in your browser using Docker. Follow these steps:
- Install Docker for your OS.
- Run the following command in your terminal:
docker run -d -p 8501:8501 iwatkot/maps4fs
- Open your browser and go to http://localhost:8501.
- Fill in the required fields and click on the
Generate
button. - When the map is generated click on the
Download
button to get the map.
Option 3: Python package
🔴 Recommended for developers.
You can use the Python package to generate maps. Follow these steps:
- Install the package from PyPI:
pip install maps4fs
- Import the Game class and create an instance of it:
import maps4fs as mfs
game = mfs.Game.from_code("FS25")
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.
Structure example:
📁 data
┣ 📄 fs22-map-template.zip
┗ 📄 fs22-texture-schema.json
So it's recommended to download the data
directory from the repository and place it in the root of your project.
- Create an instance of the Map class:
import maps4fs as mfs
map = mfs.Map(
game,
(52.5200, 13.4050), # Latitude and longitude of the map center.
height=1024, # The height of the map in meters.
width=1024, # The width of the map in meters.
map_directory="path/to/your/map/directory", # The directory where the map will be saved.
)
- Generate the map:
map.generate()
The map will be saved in the map_directory
directory.
Supported objects
The project is based on the OpenStreetMap data. So, refer to this page to understand the list below.
- "building": True
- "highway": ["motorway", "trunk", "primary"]
- "highway": ["secondary", "tertiary", "road", "service"]
- "highway": ["unclassified", "residential", "track"]
- "natural": ["grassland", "scrub"]
- "landuse": "farmland"
- "natural": ["water"]
- "waterway": True
- "natural": ["wood", "tree_row"]
- "railway": True
The list will be updated as the project develops.
Info sequence
The script will also generate the generation_info.json
file in the output
folder. It contains the following keys:
"coordinates"
- the coordinates of the map center which you entered,
"bbox"
- the bounding box of the map in lat and lon,
"map_height"
- the height of the map in meters (this one is from the user input, e.g. 2048 and so on),
"map_width"
- the width of the map in meters (same as above),
"minimum_x"
- the minimum x coordinate of the map (UTM projection),
"minimum_y"
- the minimum y coordinate of the map (UTM projection),
"maximum_x"
- the maximum x coordinate of the map (UTM projection),
"maximum_y"
- the maximum y coordinate of the map (UTM projection),
"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),
"width"
- the width of the map in meters (same as above),
"height_coef"
- since we need a texture of exact size, the height of the map is multiplied by this coefficient,
"width_coef"
- same as above but for the width,
"tile_name"
- the name of the SRTM tile which was used to generate the height map, e.g. "N52E013"
You can use this information to adjust some other sources of data to the map, e.g. textures, height maps, etc.
For advanced users
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.
⛔️ 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.
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.
Here's the list of the advanced settings:
-
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 parameter on the PMC Farming Simulator website.
-
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.
Bugs and feature requests
If you find a bug or have an idea for a new feature, please create an issue here or contact me directly on Telegram.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file maps4fs-0.7.4.tar.gz
.
File metadata
- Download URL: maps4fs-0.7.4.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ca8aa698935d4d2ed1200d795a55619f63b7c258fba1cb8ed08181366975ba8 |
|
MD5 | 0a837f60506004df4a318b8afd1f3fd1 |
|
BLAKE2b-256 | 27e24491a59f12e3f3c51b22e55e43c57ad4a9b304981fe6afc7deebc8be4f57 |
File details
Details for the file maps4fs-0.7.4-py3-none-any.whl
.
File metadata
- Download URL: maps4fs-0.7.4-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b483af3148606295e42b76d2c5fb3eb18748dc2971160e3bcf557c57269c3b98 |
|
MD5 | 1a4d9993cfda9c9d1bce49de9accfbd2 |
|
BLAKE2b-256 | 97aa06503a94edffb29ab516f520605e10c00fb1b14ca1d76d546638d984cf54 |