This library contains an OpenLR implementation for Golang.
A Zero dependency Golang implementation for OpenLR™ binary physical formats according to the White Paper and the reference implementation.
The OpenLR specification can be found at OpenLR.org.
Currently only supports line encoding to binary and go version 1.18+
go get -u https://github.com/uber/openlr-go
package main
import (
b64 "encoding/base64"
"fmt"
"github.com/uber/openlr-go/location"
)
func main() {
llr := location.LineLocationReference{
Poffs: 0,
Noffs: 0,
Points: []location.LocationReferencePoint{
location.LocationReferencePoint{Lat: 48.0632865,
Lon: 9.9750602,
Frc: 1,
Fow: 3,
Bear: 298,
Lfrcnp: 1,
Dnp: 88},
location.LocationReferencePoint{Lat: 48.0632865,
Lon: 9.9750602,
Frc: 1,
Fow: 3,
Bear: 298,
Lfrcnp: 7,
Dnp: 0},
},
}
encodedBinary, _ := llr.Encode()
fmt.Println(b64.StdEncoding.EncodeToString(encodedBinary))
}
This produces the following output
CwNhbCU+jzPLAwD0/34zGw==
If you encounter any problems with this library, please file a bug report in Issues
.
Due to time constraints, we check the issues monthly (or more often if we can). Issues & PR's are normall checked and responded to on the 15th calendar day of the month.
We welcome contributions. Please see Contributing.md for more details.
Copyright 2023 Uber Technologies, Inc.
Licensed under Apache 2.0.