Slipee
Slipee is a server, CLI tool and GO package for making static maps from a slippy map type tile server.
Motivation
Slipee fills the need for a server (microservice) to serve static map images to backend services in the EIND tech stack.
It provides static map images from a OSM-type tile server. The size, zoom and center lat/long coordinates of the image is adjustable. Images a cached on disk, with no eviction currently implemented.
Request types
Clients requests images on a single endpoint in one of three ways.
NORMAL - HTTP GET
- served from cache or queued for next request
If the image exists in cache, it is served with HTTP 200. If not, then the request is queued with an empty HTTP 202 (Accepted) response.
PRONTO - HTTP GET
- synchronously/on the fly
If the image is not cache, the server will generate and serve the image on the fly. Pronto is disabled by default.
QUEUE - HTTP POST
- queue for later
The image is put on queue and served later on NORMAL requests.
Example usage
Run the server using the command slipee serve
. It will listen on port 8090.
Then visit the browser or curl an url like:
http://localhost:7654/?zoom=16&width=500&height=500&lat=59.926181&long=10.775909
Supported query args are:
- zoom
- width
- height
- lat
- long
- pronto
These are the same as the ones mentioned in configuration below.
Installation
Download your binary from the releases page and (otionally) put it in your path.
Linux
wget -c https://github.com/krilor/slipee/releases/download/v0.0.2/slipee_0.0.2_Linux_x86_64.tar.gz -O slipee.tar.gz
tar --exclude='*.md' --exclude=LICENSE -xzf slipee.tar.gz
sudo mv slipee /usr/local/bin/slipee
rm slipee.tar.gz
GO(lang)
go get -u github.com/krilor/slipee
Configuration
You can use command line flags or environment variables.
$ slipee help
USAGE:
slipee <command> [flags]
COMMANDS:
help See this message
serve Serve slipee as a server
FLAGS:
-address string
the address to listen on
-cache string
directory for cached maps (default "./slipee_cache")
-height int
width in pixels (default 500)
-label string
the label to add to the image (default "Slipee | © OpenStreetMap contributors")
-lat float
latitude
-long float
longitude
-port int
port to listen on (default 7654)
-pronto
if clients are allowed to buypass queue and ask for static images promtly
-queue int
queue size (default 1000)
-tileserver string
the tile server url with ${[xyz]} type variables (default "https://a.tile.openstreetmap.org/${z}/${x}/${y}.png")
-width int
width in pixels (default 500)
-zoom int
zoom level (default 16)
ENVIRONMENT VARIABLES:
Flags parameters can also be specified as environment variables.
Use uppercase flag name and the prefix 'SLIPEE_'.
Example: tileserver -> SLIPEE_TILESERVER
Command line flags have precedence over environment variables.
TODOs
The following things needs to be done:
- Docker container
- Handle edge cases (like 0 zoom, where canvas is bigger than 256x256)
- Context
- Add more docs
- Add docs for Varnish cache recommendations
Alternatives
Check out the the list over at Open Street Map wiki. There are some pretty good alternatives.
The name
Slipee is taken from the phonetic respelling of the word slippy, referring to a slippy map map. It's prononced as slip-ee, aka. in IPA, its / ˈslɪp i /
Releasing with goreleaser
- Check the current version tag using
git tag -l
- Create a new tag using
git tag -a v0.0.1 -m "some message"
- Push the tag using
git push origin v0.0.1
- Run goreleaser
goreleaser