Go to file
Gael-de-Sailly 4d6adc295f Added CSV reader for Lua
to deal with biomes.csv and decorations.csv
(not implemented yet)
2018-02-20 18:14:38 +01:00
.gitignore Added .gitignore to ignore __pycache__ 2018-02-15 16:28:49 +01:00
LICENSE Added license 2018-01-08 16:25:33 +01:00
README.md Rename variable "coefficient" to "river_power" 2018-02-05 23:08:25 +01:00
biomes.csv Added some biomes, and a biome table file 2018-02-19 12:38:54 +01:00
clc.lct Added some biomes, and a biome table file 2018-02-19 12:38:54 +01:00
csv.lua Added CSV reader for Lua 2018-02-20 18:14:38 +01:00
database.py Added support for landcover file on Python side. 2018-02-20 11:59:50 +01:00
decorations.csv Add biomes CSV files 2018-02-19 12:38:54 +01:00
depends.txt Add depends 2018-02-04 00:35:06 +01:00
geometry.py Reorganize the code 2018-02-19 01:19:03 +01:00
image_convert.py Added ability to define map projection 2018-02-20 17:36:31 +01:00
init.lua Allow metadata for layers, 2018-02-04 15:26:29 +01:00
landcover.py Added landcover.py 2018-02-20 11:29:32 +01:00
map_transform.py Added ability to define map projection 2018-02-20 17:36:31 +01:00
mod.conf Added README and renamed mod 2018-01-09 22:14:58 +01:00
rivers.py Fixed start points for river algorithm 2018-02-19 02:02:23 +01:00

README.md

Geo Mapgen

Geo Mapgen is a (still experimental) mod for Minetest that allows to generate map from digital elevation models like SRTM.

It is somewhat like realterrain but behaves differently: you need to run a separate Python file that transform the image into a database that is directly readable by Minetest. This solution was made to avoid running Lua libraries with Minetest (which is not recommended) or reading directly the image with the Lua API that is not made for that.

Grand Canyon

Usage

You must first convert the DEM image into a database, using the python script image_convert.py provided by this mod. You need a working Python installation, with libraries numpy and imageio, and tkinter for graphical mode.

This will generate 2 files in the world directory: heightmap.dat which is the database, and heightmap.dat.conf, configuration file working with the database.

Syntax for the Python script:

  • Open in graphical mode (needs tkinter):
image_convert.py -g
  • Use in command line mode:
image_convert.py input_file.tif minetest_world_directory [options]

Note that even if TIFF files are the most commonly used, any image with only one color channel can be loaded by this script.

Complete list of options:

  • -g: Open in graphical mode.
  • -f [integer]: Fragmentation. In the database, the image is cut into squares with a fixed size (by default 80 px) to make data searching faster.
  • -s [float]: Vertical scale, number of meters per node (default is 40). Can also be adjusted in the configuration file heightmap.dat.conf.
  • -r [integer|filepath]: Enable rivers. If integer, minimal surface for catchment area, to produce a river (usually some thousands). If filepath to an image, this image is read and river is set where value > 0.
  • -l [integer]: Controls the elevation (in meters) below which river are no more calculated. Default to -128.
  • -c [float]: This controls how much river widen when joining together. At 1, river width is proportional to its catchment area; at 0, rivers are all one block wide.
  • -d [integer]: To avoid wide rives completely filling narrow gorges, limit the width of the river if the valley is deeper than this size (in meters, default is 40)

Example of use:

./image_convert.py '/home/gael/dem/srtm_38_04.tif' '/home/gael/.minetest/worlds/bidule' -f 100 -s 90

If you use rivers, the calculation can take a long time (can be over 15 minutes). Please be patient, you can do something else during it's calculating.

Once the files are generated, you can start playing.

Additional information

Distributed under the GNU Lesser General Public License, version 2.1. Code by Gael-de-Sailly (Gaël C.)