Documentation
¶
Overview ¶
Package nomi provides a client to the Nominatiom webservice from OpenStreetMaps.org. It features Redis-backed caching and automatic request rate limiting in respect of Nominatim's Usage Policy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultClientOptions = ClientOptions{
Endpoint: "https://nominatim.openstreetmap.org",
MaxRPS: 1,
}
)
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { City string `json:"city"` CityDistrict string `json:"city_district"` Construction string `json:"construction"` Continent string `json:"continent"` County string `json:"country"` State string `json:"state"` Country string `json:"country"` CountryCode string `json:"country_code"` HouseNumber string `json:"house_number"` Neighbourhood string `json:"neighbourhood"` Postcode string `json:"postcode"` PublicBuilding string `json:"public_building"` Suburb string `json:"suburb"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opt *ClientOptions) (*Client, error)
NewClient returns a client to Nominatim specified by options.
func (*Client) Search ¶
func (c *Client) Search(params SearchParams, options SearchOptions) (SearchResponse, error)
type ClientOptions ¶
type ClientOptions struct { // Endpoint defaults to Nominatim server from OpenStreetMaps. // Overwrite to use a 3rd party or your own server. Endpoint string Email string UserAgent string // MaxRPS specifies the maximum requests per second a client is allowed to make. // It will slow down automatically to meet this value. // Nominatim allows a maximum of 1 rps, which is used as a default if // value is not specified. MaxRPS int64 }
type Place ¶
type Place struct { PlaceID int `json:"place_id"` Licence string `json:"licence"` OSMType string `json:"osm_type"` OSMID int `json:"osm_id"` Boundingbox []string `json:"boundingbox"` Lon string `json:"lon"` Lat string `json:"lat"` DisplayName string `json:"display_name"` // PlaceRank is based on a rather complex algorithm taking the place type // and various other attributes into account. For example it seems checks // whether this object is a village, a city, a country, a continent, // a highway, a lake and similar other properties. PlaceRank int `json:"place_rank"` Category string `json:"category"` Class string `json:"class"` Type string `json:"type"` Importance float64 `json:"importance"` Icon string `json:"icon"` Address Address `json:"address"` }
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point represents a physical point in geographic notation [lat, lng]
type SearchOptions ¶
type SearchParams ¶
type SearchParams struct { // i.e. "Zurich, Switzerland" Query string // Query and the following options are mutually exclusive. Query has precedence. Street string City string County string State string Country string Postalcode string // Limit search results to a specific country (or a list of countries). // Should be the ISO 3166-1alpha2 code, e.g. gb for the United Kingdom, de for Germany, etc. CountryCodes []string // The preferred area to find search results. Any two corner points of the box are accepted in any order as long as they span a real box. Viewbox *Box // Restrict the results to only items contained with the viewbox (see above). // Restricting the results to the bounding box also enables searching by amenity only. Bounded bool }
type SearchResponse ¶
type SearchResponse []Place
Source Files
¶
Click to show internal directories.
Click to hide internal directories.