osm

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent = "OpenStreetMap_Go_Client/0.1" // Default UserAgent used by osm queries.

)

Variables

View Source
var DefaultClient = Client{
	UserAgent: UserAgent,
}

Functions

This section is empty.

Types

type Address

type Address struct {
	City          string `json:"city"`
	StateDistrict string `json:"state_district"`
	State         string `json:"state"`
	Postcode      string `json:"postcode"`
	Country       string `json:"country"`
	CountryCode   string `json:"country_code"`
}

Address gives (optional) additional informations about a Place.

type Client

type Client struct {
	UserAgent       string
	AddressDetails  bool
	AcceptLanguages []string
}

func (*Client) Search

func (c *Client) Search(query string) ([]Place, error)

Search queries the OpenStreetMap Nominatim service for a given place.

type Place

type Place struct {
	ID          int64    `json:"place_id"`
	Rank        int64    `json:"place_rank"`
	Licence     string   `json:"licence"`
	OsmType     string   `json:"osm_type"`
	OsmID       int64    `json:"osm_id"`
	Boundingbox []string `json:"boundingbox"`
	Lat         string   `json:"lat"`
	Lng         string   `json:"lon"`
	DisplayName string   `json:"display_name"`
	Category    string   `json:"category"`
	Type        string   `json:"type"`
	Importance  float64  `json:"importance"`
	Address     Address  `json:"address"`
}

Place describes a place location from Nominatim's OpenStreetMap database.

func Search(query string) ([]Place, error)

Search queries the OpenStreetMap Nominatim service for a given place, using the default client.

Jump to

Keyboard shortcuts

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