Giter VIP home page Giter VIP logo

elevation_server's Introduction

Building from source

Tested to work on Ubuntu 20.04.1 in Docker container

apt update
apt install -y golang git
apt install -y liblz4-dev

export GOPATH=$HOME/go
mkdir -p $GOPATH/src/github.com/wladich
cd $GOPATH/src/github.com/wladich
git clone https://github.com/wladich/elevation_server.git

cd elevation_server/cmd/elevation_server
go build
cd ../make_data
go get
go build

Built executables are at paths:

  • cmd/elevation_server/elevation_server
  • cmd/make_data/make_data

Installation

Place binaries to directory of your choice, for example to /usr/local/bin.

Usage

Prepare data

  1. Grab DEM files in hgt format with 3 arc-second resolution. The best available source is http://viewfinderpanoramas.org/dem3.html. Place all *.hgt files to one directory.
  2. run make_data -hgt <PATH_TO_HGT_FILES> -out dem_tiles
  3. You should find two files: dem_tiles and dem_tiles.idx

Start server

Run elevation_server -dem <PATH_TO_dem_tiles>

Other options:

  -dem string
        path to file with elevation tile
  -host string
        address to bind to (default "127.0.0.1")
  -port int
        port to listen (default 8080)
  -threads int
        maximum number of concurrently served requests (default 10)

API

The server uses HTTP protocol. The only endpoint is "/", request type is POST. The request consists of a list of latitude-longitude coordinate pairs. Coordinates are floating point numbers in decimal format, separated with a space character. First number in the pair is latitude, second is longitude. Pairs are separated from each other with newline character (\n).

Response contains the list of elevations as floating point numbers in decimal format separated with newlines.

Error is being returned in following cases:

  • request body size exceeds 250000 bytes
  • request contains more than 10000 points
  • request has invalid format

Example:

curl https://elevation.example.com --data-binary $'49.18148 16.35126\n49.13545 16.33615'
375.60
259.470

elevation_server's People

Contributors

wladich avatar

Stargazers

 avatar

Watchers

 avatar  avatar

elevation_server's Issues

Invalid HGT size

$ wget http://viewfinderpanoramas.org/dem1/O35.zip
$ unzip O35.zip
$ make_data -hgt O35 -out dem_tiles
0 / 24 [_________________________________________________________________] 0.00% Elapsed       0s 0s
panic: invalid HGT size

goroutine 1 [running]:
main.makeTiles(0x7fff7d46168e, 0x4, 0x7fff7d461698, 0x9, 0x5)
	github.com/wladich/elevation_server/cmd/make_data/main.go:161 +0x389
main.main()
	github.com/wladich/elevation_server/cmd/make_data/main.go:181 +0x17c
$ ls -lh O35
total 594M
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N56E024.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N56E025.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N56E026.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N56E027.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N56E028.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N56E029.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N57E024.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N57E025.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N57E026.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N57E027.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N57E028.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N57E029.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N58E024.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N58E025.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N58E026.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N58E027.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N58E028.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N58E029.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N59E024.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N59E025.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N59E026.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N59E027.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N59E028.hgt
-rw-r--r-- 1 sikmir users 25M 26. 5.  2014 N59E029.hgt

command not found

hi,
while trying to run run make_data -hgt <PATH_TO_HGT_FILES> -out dem_tiles it says make_data: command not found in ubuntu 20.04.
any suggestions will be highly appreciable.

Thank you

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.