Giter Club home page Giter Club logo

elevation's Introduction

Elevation API

Simple elevation API reading data from SRTM HGT files.

Supported data

  • 30m (1 arc second)
  • 90m (3 arc seconds)

Usage

Build Docker image.

docker build -t elevation:latest .

Start container with mounted directory containing SRTM HGT files.

docker run --name elevation -v $(pwd)/data:/opt/elevation/data -p 127.0.0.1:8080:8080 -d elevation:latest

Request

Due to limitations in query length, POST method should be used for large requests.

GET

Coordinate order is latitude,longitude.

curl -v 'http://127.0.0.1:8080/json?locations=48.1234,21.1234|49.12,22.12|1,1'

POST

curl -v -X POST \
    -H 'Content-Type: application/json'
    -d '{"locations":[{"latitude":48.1234,"longitude":21.1234},{"latitude":49.12,"longitude":22.12},{"latitude":1,"longitude":1}]}' \
    'http://127.0.0.1:8080/json'

Response

  • elevation is in meters
  • resolution is in arc seconds (1 - 30m, 3 - 90m)
  • for location with unknown elevation (missing data file, location out of SRTM range, void) parameter "error" with value 404 will appear in result object.
{
    "result": [
        {
            "latitude": 48.1234,
            "longitude": 21.1234,
            "elevation": 103,
            "resolution": 1
        },
        {
            "latitude": 49.12,
            "longitude": 22.12,
            "elevation": 420,
            "resolution": 1
        },
        {
            "latitude": 1,
            "longitude": 1,
            "error": 404
        }
    ]
}

License

Licensed under MIT license.

elevation's People

Contributors

petoc avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

leontenorio

elevation's Issues

Error trying to use the repository

I cloned the repository and tried to build using the build step on the readme:

sudo docker build -t elevation:latest .

But the result wasn't the expected, it was an error:

[+] Building 1.5s (13/14)                                                                                         
 => [internal] load .dockerignore                                                                            0.0s
 => => transferring context: 103B                                                                            0.0s
 => [internal] load build definition from Dockerfile                                                         0.0s
 => => transferring dockerfile: 513B                                                                         0.0s
 => [internal] load metadata for docker.io/library/alpine:edge                                               1.2s
 => [internal] load metadata for docker.io/library/golang:alpine                                             1.2s
 => [internal] load build context                                                                            0.0s
 => => transferring context: 352B                                                                            0.0s
 => [stage-1 1/4] FROM docker.io/library/alpine:edge@sha256:2d01a16bab53a8405876cec4c27235d47455a7b72b75334  0.0s
 => [builder 1/5] FROM docker.io/library/golang:alpine@sha256:fd9d9d7194ec40a9a6ae89fcaef3e47c47de7746dd584  0.0s
 => CACHED [stage-1 2/4] RUN apk update                                                                      0.0s
 => CACHED [stage-1 3/4] WORKDIR /opt/elevation/                                                             0.0s
 => CACHED [builder 2/5] WORKDIR /go/src/github.com/petoc/elevation/                                         0.0s
 => CACHED [builder 3/5] RUN apk add upx                                                                     0.0s
 => CACHED [builder 4/5] COPY main.go go.mod ./                                                              0.0s
 => ERROR [builder 5/5] RUN go mod vendor     && CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -  0.3s
------
 > [builder 5/5] RUN go mod vendor     && CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -w" -a -o main .     && upx --ultra-brute main:
#0 0.285 github.com/petoc/elevation imports
#0 0.285        github.com/hashicorp/golang-lru/v2: missing go.sum entry for module providing package github.com/hashicorp/golang-lru/v2 (imported by github.com/petoc/elevation); to add:
#0 0.285        go get github.com/petoc/elevation
#0 0.285 github.com/petoc/elevation imports
#0 0.285        github.com/julienschmidt/httprouter: missing go.sum entry for module providing package github.com/julienschmidt/httprouter (imported by github.com/petoc/elevation); to add:
#0 0.285        go get github.com/petoc/elevation
#0 0.285 github.com/petoc/elevation imports
#0 0.285        github.com/petoc/hgt: missing go.sum entry for module providing package github.com/petoc/hgt (imported by github.com/petoc/elevation); to add:
#0 0.285        go get github.com/petoc/elevation
------
Dockerfile:5
--------------------
   4 |     COPY main.go go.mod ./
   5 | >>> RUN go mod vendor \
   6 | >>>     && CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -w" -a -o main . \
   7 | >>>     && upx --ultra-brute main
   8 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c go mod vendor     && CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags \"-s -w\" -a -o main .     && upx --ultra-brute main" did not complete successfully: exit code: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.