Skip to content

Go module and command-line tool for handling OpenStreetMap shortlinks

License

Notifications You must be signed in to change notification settings

stefanb/osmshortlink-go

Repository files navigation

osmshortlink-go: Go module and command-line tool for creating, encoding & decoding of OpenStreetMap shortlinks

Go Reference Test golangci-lint CodeQL Go Report Card codebeat badge OpenSSF Scorecard GitHub Release

Specification: https://wiki.openstreetmap.org/wiki/Shortlink

Usage

Creating a link in Go

package main

import "github.com/stefanb/osmshortlink-go"

func main() {
	shortlink, err := osmshortlink.Create(46.05141, 14.50604, 17)
	if err != nil {
		panic(err)
	}
	print(shortlink)
}

Prints: https://osm.org/go/0Ik3VNr_A-?m

Try it in Go playground

Command-line tool

You can download pre-built binaries for various platforms from latest release.

Usage: osmshortlink [latitude] [longitude] [zoom]

For example:

$ osmshortlink 46.05141 14.50604 17
https://osm.org/go/0Ik3VNr_A-?m