Planet Modding/Real World Data
Lots of real world data exists for the real planet Earth, including worldwide infrastructure data, elevation data, land cover (plant) data], and satellite imagery. This data is typically distributed as very large images (sometimes thousands of images) that contain georeferencing data that ties those images to points on the earth. It is possible to convert from these real world locations into Medieval Engineers' planet data files, allowing for using real world data for modded planets without distortion.
Georeferencing
Medieval Engineers' planet surfaces are defined by six separate faces, each one using a specially distorted Gnomonic projection such that pixels are as close to a constant area as possible. This special distortion can be represented in GDAL using a geolocation array, and is written in code as the Sandbox.Engine.Voxels.MyCubemapHelpers.UniformToProjection
method.
The arguments to gdalwarp required to convert to/from this method vary for each face that is being converted, referencing geolocation array at me-geolocation-16k.png. These options are correct for converting from real world data to ME data. For converting ME data files to real world coordinates replace SRC with DST.
REM Forward
-to "DST_SRS=+proj=gnom +lat_0=0 +lon_0=0 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png"
REM Left
-to "DST_SRS=+proj=gnom +lat_0=0 +lon_0=-90 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png"
REM Back
-to "DST_SRS=+proj=gnom +lat_0=0 +lon_0=-180 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png"
REM Right
-to "DST_SRS=+proj=gnom +lat_0=0 +lon_0=90 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png"
REM Up
-to "DST_SRS=+proj=gnom +lat_0=90 +lon_0=0 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png"
REM Down
-to "DST_SRS=+proj=gnom +lat_0=-90 +lon_0=180 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png"
Examples
These examples assume you've downloaded and installed GDAL and the geolocation file.
Real World Elevation
This example will use the ETOPO1 dataset to provide global elevation data.
REM Scale elevation values so the elevations are all positive, convert to float, and set the SRS to long/lat
gdal_translate ETOPO1_Bed_g_geotiff.tif -scale -12000 12000 0 65535 -ot Float32 -a_srs "+proj=longlat" ETOPO1_Unsigned.vrt
REM Ignore translation from Earth to 16km sphere
set PROJ_IGNORE_CELESTIAL_BODY=YES
REM Disable metadata files
set GDAL_PAM_ENABLED=NO
REM Create front.png
gdalwarp -dstnodata None -r average -nomd -wt Float32 -ot UInt16 -multi -wo SOURCE_EXTRA=100 -wo SAMPLE_GRID=YES -te 0 0 32000 32000 -ts 8192 8192 -to "DST_SRS=+proj=gnom +lat_0=0 +lon_0=0 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png" ETOPO1_Unsigned.vrt -overwrite front.png
REM Create left.png
gdalwarp -dstnodata None -r average -nomd -wt Float32 -ot UInt16 -multi -wo SOURCE_EXTRA=100 -wo SAMPLE_GRID=YES -te 0 0 32000 32000 -ts 8192 8192 -to "DST_SRS=+proj=gnom +lat_0=0 +lon_0=-90 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png" ETOPO1_Unsigned.vrt -overwrite left.png
REM Create back.png
gdalwarp -dstnodata None -r average -nomd -wt Float32 -ot UInt16 -multi -wo SOURCE_EXTRA=100 -wo SAMPLE_GRID=YES -te 0 0 32000 32000 -ts 8192 8192 -to "DST_SRS=+proj=gnom +lat_0=0 +lon_0=-180 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png" ETOPO1_Unsigned.vrt -overwrite back.png
REM Create right.png
gdalwarp -dstnodata None -r average -nomd -wt Float32 -ot UInt16 -multi -wo SOURCE_EXTRA=100 -wo SAMPLE_GRID=YES -te 0 0 32000 32000 -ts 8192 8192 -to "DST_SRS=+proj=gnom +lat_0=0 +lon_0=90 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png" ETOPO1_Unsigned.vrt -overwrite right.png
REM Create up.png
gdalwarp -dstnodata None -r average -nomd -wt Float32 -ot UInt16 -multi -wo SOURCE_EXTRA=100 -wo SAMPLE_GRID=YES -te 0 0 32000 32000 -ts 8192 8192 -to "DST_SRS=+proj=gnom +lat_0=90 +lon_0=0 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png" ETOPO1_Unsigned.vrt -overwrite up.png
REM Create down.png
gdalwarp -dstnodata None -r average -nomd -wt Float32 -ot UInt16 -multi -wo SOURCE_EXTRA=100 -wo SAMPLE_GRID=YES -te 0 0 32000 32000 -ts 8192 8192 -to "DST_SRS=+proj=gnom +lat_0=-90 +lon_0=180 +R=16000 +x_0=16000 +y_0=16000" -to "DST_GEOLOC_ARRAY=me-geolocation-16k.png" ETOPO1_Unsigned.vrt -overwrite down.png