OsmShortlink (osm_shortlink v0.1.3)

Link to this section Summary

Functions

Restores the coordinates from link

Link to this section Functions

Link to this function

generate_link(lat, lng, zoom, marker \\ false)

Specs

generate_link(number(), number(), pos_integer(), boolean()) :: binary()

Function calculates the openstreetmap short link see http://wiki.openstreetmap.org/wiki/Shortlink

Its a port to elixir of the erlang code made by Krzysztof Marciniak - Public Domain

other implementations are:

https://github.com/openstreetmap/openstreetmap-website/blob/master/lib/short_link.rb

https://github.com/openstreetmap/openstreetmap-website/blob/master/app/assets/javascripts/application.js

based on https://gist.github.com/mdornseif/5652824 by Maximillian Dornseif

iex> OsmShortlink.generate_link(51.5110,0.0550, 16)
"http://osm.org/go/0EEQjEEb"
iex> OsmShortlink.generate_link(51.5110,0.0550, 9)
"http://osm.org/go/0EEQjE--"
iex> OsmShortlink.generate_link(51.5110,0.0550, 9, true)
"http://osm.org/go/0EEQjE--?m"