Documentation ¶
Overview ¶
Package nominatim provides a client for the nominatim geocoder
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRequestFailed = errors.New("HTTP request failed")
ErrRequestFailed either the connection was lost or similar
var ErrUnableToGeocode = errors.New("unable to geocode")
ErrUnableToGeocode lat/lon don't match to a known address
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { HouseNumber string `json:"house_number"` // "31" Road string `json:"road"` // "Herrenstraße" Neighborhood string `json:"neighbourhood"` // "Innenstadt-West Östlicher Teil" Suburb string `json:"suburb"` // "Innenstadt-West" Hamlet string `json:"hamlet"` // "Inderingen" City string `json:"city"` // "Karlsruhe" CityDistrict string `json:"city_district"` // "Frohnstetten" StateDistrict string `json:"state_district"` // "Regierungsbezirk Karlsruhe" State string `json:"state"` // "Baden-Württemberg" Postcode string `json:"postcode"` // "76133" County string `json:"county"` // "Kreis Karlsruhe" Country string `json:"country"` // "Deutschland" CountryCode string `json:"country_code"` // "de" Town string `json:"town"` // "Sprintfield" Village string `json:"village"` // "Stetten am kalten Markt" }
Address contains parts of an address
func (Address) CityEquivalent ¶
CityEquivalent returns the first filled field of either 'city', 'town', 'village', 'hamlet' or 'suburb'. Based on https://github.com/openstreetmap/Nominatim/issues/885.
func (Address) GermanShort ¶
GermanShort returns the address in german format
type Client ¶
type Client struct { // Endpoint url e.g. https://nominatim.example.org/ Endpoint string }
Client for nominatim using the configured endpoint
var DefaultClient *Client
DefaultClient is initialized using the environment variables
func (*Client) Reverse ¶
Reverse executes a request to the nominatim service and returns the genuine result
func (*Client) SolidifiedReverse ¶
SolidifiedReverse does two requests to the nominatim APIs one with zoom level 10 and one with zoom level 18 and combines the results from each of them. This will fix the 'city', 'town', 'village', 'hamlet', 'suburb' reported by OSM. See https://github.com/openstreetmap/Nominatim/issues/885 for details.
type Result ¶
type Result struct { Error string `json:"error"` // "Unable to geocode" PlaceID string `json:"place_id"` // "84948520" Licence string `json:"licence"` // "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright" OsmType string `json:"osm_type"` // "way" OsmID string `json:"osm_id"` // "109123011" Lat string `json:"lat"` // "49.0081562" Lon string `json:"lon"` // "8.39770823450571" PlaceRank string `json:"place_rank"` // "30" Category string `json:"category"` // "building" Type string `json:"type"` // "yes" Importance string `json:"importance"` // "0" AddressType string `json:"addresstype"` // "building" DisplayName string `json:"display_name"` // "31, Herrenstraße, Innenstadt-West Östlicher Teil, Innenstadt-West, Karlsruhe, Regierungsbezirk Karlsruhe, Baden-Württemberg, 76133, Deutschland" Name string `json:"name"` // null Address *Address `json:"address"` }
Result contains additional information and the address of the given lat/lon pair