Closed dave closed 1 year ago
package main
import (
"fmt"
"net/http"
"github.com/tkrajina/go-elevations/geoelevations"
)
func main() {
srtm, err := geoelevations.NewSrtm(http.DefaultClient)
if err != nil {
panic(err.Error())
}
elevation, err := srtm.GetElevation(http.DefaultClient, 30.404229, 79.547245)
if err != nil {
panic(err.Error())
}
fmt.Println("Elevation is", elevation)
}
Output:
[...]
2022/11/23 17:20:22 > http://srtm.kurviger.de/SRTM3//South_America/S56W070.hgt.zip -> S56W070.hgt.zip
2022/11/23 17:20:22 > http://srtm.kurviger.de/SRTM3//South_America/S56W071.hgt.zip -> S56W071.hgt.zip
2022/11/23 17:20:22 > http://srtm.kurviger.de/SRTM3//South_America/S56W072.hgt.zip -> S56W072.hgt.zip
2022/11/23 17:20:22 > South_America
2022/11/23 17:20:22 load contents
2022/11/23 17:20:22 File N30E079.hgt.zip not retrieved => retrieving: http://srtm.kurviger.de/SRTM3//Eurasia/N30E079.hgt.zip
2022/11/23 17:20:26 Written 1755068 bytes to N30E079.hgt.zip
2022/11/23 17:20:26 Loaded 2884802bytes from N30E079.hgt.zip, squareSize=0
Elevation is NaN
Aah reading through the documentation it looks like this is a void in the data. I'll close this and work on an interpolation script.
Here's a very quick and dirty interpolation algorithm: https://github.com/dave/go-elevations if anyone is interested.
I'm getting lots of NaNs from this point...
An example:
Locals in the debugger at that point are:
Any ideas why?