Skip to content

Open route service SDK ported to Go since I wanna write my backend in go and not be forced to use js or python

License

Notifications You must be signed in to change notification settings

sagarsubedi/goors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Go API to consume openrouteservice(s) painlessly!

This library lets you consume the openrouteservice API in Go applications. It allows you to painlessly consume the following services:

  • Directions (routing)
  • Geocoding | Reverse Geocoding | Structured Geocoding (powered by Pelias)
  • Isochrones (accessibility)
  • Time-distance matrix
  • POIs (points of interest)
  • Elevation (linestring or point)
  • Optimization

See the examples in the examples folder.

Note: In order to use this client, you have to register for a token at openrouteservice. To understand the features of openrouteservice, please don't forget to read the docs. For visualization purposes on the map, please use openrouteservice maps.

Documentation

This library uses the ORS API for request validation. To understand the input of each API specifically, please check the API Playground that provides interactive documentation.

Installation and Usage

Requirements:

  • git
  • go

Install the library:

go get github.com/sagarsubedi/openrouteservice-go

Use the library:

package main

import (
    "github.com/sagarsubedi/openrouteservice-go"
)

func main() {
    orsDirections := openrouteservice.NewOrsDirections(map[string]interface{}{
        "api_key": "XYZ",
    })
    // ...
}

Pair with local openrouteservice instance:

package main

import (
    "github.com/sagarsubedi/openrouteservice-go"
)

func main() {
    orsDirections := openrouteservice.NewOrsDirections(map[string]interface{}{
        "host": "<http://localhost:8082/ors>",
    })
    // ...
}

Development Setup

Clone the openrouteservice-go repository from GitHub into a development environment of your choice.

git clone https://github.com/sagarsubedi/openrouteservice-go.git cd openrouteservice-go

Make your openrouteservice API key available for tests and examples:

echo "API_KEY=your_api_key_here" > .env

Running Tests

To run tests, use the Go testing tool: go test ./...

Deployment flow:

Apply the changes in a feature branch and test it locally. Once the feature is ready, merge it to develop, deploy it to the testing environment.

Checkout in main, merge from develop and use npm run release to generate a release. This will generate a new release commit as well as a git tag and an entry in CHANGELOG.md.

For more details about commitizen and standard-version, see this article.

About

Open route service SDK ported to Go since I wanna write my backend in go and not be forced to use js or python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages