Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 2.86 KB

README.md

File metadata and controls

80 lines (54 loc) · 2.86 KB

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

Installation

Download the pre-built binaries

Download the pre-built binaries for your platform from latest release.

Install using Go
$ go install github.com/stefanb/osmshortlink-go/cmd/osmshortlink@latest
$ osmshortlink 46.05141 14.50604 17
https://osm.org/go/0Ik3VNr_A-?m

Run using Go without installing

$ go run github.com/stefanb/osmshortlink-go/cmd/osmshortlink@latest 46.05141 14.50604 17
https://osm.org/go/0Ik3VNr_A-?m

Pre-built binaries

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

Development

Run: go run ./cmd/osmshortlink/main.go 46.05141 14.50604 17

Testing: go test -v -race -cover ./...

Fuzz testing: go test -fuzz=. -fuzztime=1m