A simple library in Go to generate heightmap images of a given location.
In order to generate the heightmap, you must have at least an Api key for the following services:
import (
"github.com/michaelvial/hmapgen"
)
// South, West, North and East Lat/Lng coordinates
area := ["45.142724","6.0888359","45.7316515","7.1368806"]
// Available options
options := hmapgen.Options{
Service: "bing", // Either bing or ign
Key: "xxx", // The API key for the elevation service
Precision: 1000, // Interval between each points (in meter)
File: "./images/output.png", // Heightmap filename
}
// Heightmap generation
hmapinfo, err := hmapgen.GenerateHeightMap(area, options)
// Filename
fmt.Printf("Output file:", hmapinfo.Filename)
// Diff between the lowest point and the highest point (in meter)
fmt.Printf("Height offset:", hmapinfo.HeightOffset)
All source code is licensed under the MIT License.