Documentation
¶
Overview ¶
Package photon is the library behind the photon command line: the HTTP client, request shaping, and the typed data models for the Photon geocoding service by Komoot (photon.komoot.io).
Photon is based on OpenStreetMap data with 700M+ places, buildings, roads, and POIs. It supports full-text search and reverse geocoding with no API key required.
Index ¶
- Constants
- type Client
- func (c *Client) NearbyPlaces(ctx context.Context, query string, lat, lon float64, limit int, lang string) ([]Place, error)
- func (c *Client) ReversePlaces(ctx context.Context, lat, lon string, limit int, lang string) ([]Place, error)
- func (c *Client) SearchPlaces(ctx context.Context, query string, limit int, lang string) ([]Place, error)
- type Config
- type Domain
- type Place
Constants ¶
const Host = "photon.komoot.io"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the Photon geocoding service over HTTP.
func (*Client) NearbyPlaces ¶
func (c *Client) NearbyPlaces(ctx context.Context, query string, lat, lon float64, limit int, lang string) ([]Place, error)
NearbyPlaces searches for places matching query near the given coordinates.
type Config ¶
type Config struct {
BaseURL string
ReverseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
Lang string
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the photon driver. It carries no state; the per-run client is built by the factory Register hands kit.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type Place ¶
type Place struct {
Name string `json:"name"`
Type string `json:"type"` // osm_value: city, restaurant, etc.
Category string `json:"category"` // osm_key: place, amenity, etc.
Street string `json:"street"`
HouseNumber string `json:"house_number"`
Postcode string `json:"postcode"`
City string `json:"city"`
State string `json:"state"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
OsmID int64 `json:"osm_id"`
OsmType string `json:"osm_type"`
}
Place is a geocoding result from the Photon API.