OsmShortlink (osm_shortlink v0.1.3)
Link to this section Summary
Functions
Function calculates the openstreetmap short link see http://wiki.openstreetmap.org/wiki/Shortlink
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
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"
Link to this function
link_to_coordinates(link)
Specs
Restores the coordinates from link
iex> OsmShortlink.link_to_coordinates("http://osm.org/go/0EEQjE--")
{51.510772705078125, 0.054931640625}
iex> OsmShortlink.link_to_coordinates("http://osm.org/go/0EEQjE?M")
{51.510772705078125, 0.054931640625}