Preparation of inputs - wattzhikang/terrainHydrology GitHub Wiki

To generate terrain, the generator will need 3 inputs.

Note: This whole system is finicky. It will be improved in future efforts.

Raster inputs

These 2 inputs are rasters. That is, they are images, in which each pixel denotes a value for a particular region of the map. They can be in any common image format (.jpg, .png, etc), and may have color channels, but they will be interpreted in grayscale.

Regardless of how the images are saved, the program will convert them to 8-bit bitmaps, so each pixel will have a single value [0--255).

They should be square, and they should both be lined up. That is, they should have the same center.

This images can be created in GIMP, Paint, or any other program.

River slope

Pixels in this image indicate the rate at which the generated rivers should gain elevation. Although this only influences rivers, the rivers are the basis for the terrain, so this map can be thought of as the base slope for the terrain.

Higher pixel values indicate a higher slope, up to 255, which denotes a 10% grade, or 10cm rise over 1m run.

Terrain slope

This influences the rate at which terrain should rise in between the rivers. This is not the same as the river slope rate. Higher values here will create deep valleys.

The highest value will denote a steep gradient of 100%, or a rise of 1m per 1m.

Shoreline

The Shoreline is an ESRI shapefile that demarcates the land from the sea.

A user may create this file manually, or using the img-to-shp command.

Note: The program does not currently support inland seas or lakes. A future development effort will change this.

Using img-to-shp

The img-to-shp can create a shapefile based on an image. This can be useful because such an image can be easily created from whatever workflow is used to create the river slope and terrain slope images. For more details, see the page that documents this subcommand.

Details for creating your own shapefile

It should be a Polygon shapefile (shape type 5) with 1 polygon.

This program currently creates does everything in an orthographic projected coordinate system. This will change in the future. See the page about coordinate systems for details. For now, the shoreline shapefile should use the following well-known text description of the coordinate system:

PROJCS["unknown",
    GEOGCS["GCS_unknown",
        DATUM["D_WGS_1984",
            SPHEROID["WGS_1984",6378137.0,298.257223563]
        ],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]
    ],
    PROJECTION["Orthographic"],
    PARAMETER["False_Easting",0.0],
    PARAMETER["False_Northing",0.0],
    PARAMETER["Longitude_Of_Center",{longitude}],
    PARAMETER["Latitude_Of_Center",{latitude}],
    UNIT["Meter",1.0]
]

(I'm not sure I would use the phrase "well-known" to describe that, but that's the official name.) Where {latitude} and {longitude} should be the coordinates of the center, lining up with the center of the river slope and terrain slope images.