ors

package
v0.0.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ors implements a client to openrouteservice.org.

See also https://openrouteservice.org/dev/#/api-docs/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	APIKey    string
	Transport http.RoundTripper
	// contains filtered or unexported fields
}

func NewORS

func NewORS(deps Deps, cfg func() Config) *Client

func (*Client) ReverseGeocode

func (o *Client) ReverseGeocode(ctx context.Context, lat, lon float64) (string, error)

type Config

type Config struct {
	APIKey string `json:"api_key"`
}

type Deps

type Deps interface {
	CtxdLogger() ctxd.Logger
}

type ReverseResp

type ReverseResp struct {
	Geocoding struct {
		Version     string `json:"version"`
		Attribution string `json:"attribution"`
		Query       struct {
			Size              int     `json:"size"`
			Private           bool    `json:"private"`
			PointLat          float64 `json:"point.lat"`
			PointLon          float64 `json:"point.lon"`
			BoundaryCircleLat float64 `json:"boundary.circle.lat"`
			BoundaryCircleLon float64 `json:"boundary.circle.lon"`
			Lang              struct {
				Name      string `json:"name"`
				Iso6391   string `json:"iso6391"`
				Iso6393   string `json:"iso6393"`
				Via       string `json:"via"`
				Defaulted bool   `json:"defaulted"`
			} `json:"lang"`
			QuerySize int `json:"querySize"`
		} `json:"query"`
		Engine struct {
			Name    string `json:"name"`
			Author  string `json:"author"`
			Version string `json:"version"`
		} `json:"engine"`
		Timestamp int64 `json:"timestamp"`
	} `json:"geocoding"`
	Type     string `json:"type"`
	Features []struct {
		Type     string `json:"type"`
		Geometry struct {
			Type        string    `json:"type"`
			Coordinates []float64 `json:"coordinates"`
		} `json:"geometry"`
		Properties struct {
			Id               string  `json:"id"`
			Gid              string  `json:"gid"`
			Layer            string  `json:"layer"`
			Source           string  `json:"source"`
			SourceId         string  `json:"source_id"`
			Name             string  `json:"name"`
			Confidence       float64 `json:"confidence"`
			Distance         float64 `json:"distance"`
			Accuracy         string  `json:"accuracy"`
			Country          string  `json:"country"`
			CountryGid       string  `json:"country_gid"`
			CountryA         string  `json:"country_a"`
			Macroregion      string  `json:"macroregion"`
			MacroregionGid   string  `json:"macroregion_gid"`
			MacroregionA     string  `json:"macroregion_a"`
			Region           string  `json:"region"`
			RegionGid        string  `json:"region_gid"`
			RegionA          string  `json:"region_a"`
			Localadmin       string  `json:"localadmin"`
			LocaladminGid    string  `json:"localadmin_gid"`
			Locality         string  `json:"locality"`
			LocalityGid      string  `json:"locality_gid"`
			Borough          string  `json:"borough"`
			BoroughGid       string  `json:"borough_gid"`
			Neighbourhood    string  `json:"neighbourhood"`
			NeighbourhoodGid string  `json:"neighbourhood_gid"`
			Continent        string  `json:"continent"`
			ContinentGid     string  `json:"continent_gid"`
			Label            string  `json:"label"`
			Addendum         struct {
				Osm struct {
					Wheelchair string `json:"wheelchair"`
					Wikidata   string `json:"wikidata,omitempty"`
					Website    string `json:"website,omitempty"`
				} `json:"osm"`
			} `json:"addendum,omitempty"`
			Street     string `json:"street,omitempty"`
			Postalcode string `json:"postalcode,omitempty"`
		} `json:"properties"`
		Bbox []float64 `json:"bbox,omitempty"`
	} `json:"features"`
	Bbox []float64 `json:"bbox"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL