Documentation ¶
Overview ¶
Package places provides global location information to enrich metadata with location details.
Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.
This program is free software: you can redistribute it and/or modify it under Version 3 of the GNU Affero General Public License (the "AGPL"): <https://docs.photoprism.app/license/agpl> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. The AGPL is supplemented by our Trademark and Brand Guidelines, which describe how our Brand Assets may be used: <https://www.photoprism.app/trademark>
Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.
Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>
Index ¶
- Constants
- Variables
- func PerformRequest(serviceUrl, id string) (r *http.Response, err error)
- type Location
- func (l Location) Category() (result string)
- func (l Location) CellID() string
- func (l Location) City() (result string)
- func (l Location) CountryCode() (result string)
- func (l Location) District() (result string)
- func (l Location) Keywords() (result []string)
- func (l Location) Label() (result string)
- func (l Location) Latitude() (result float64)
- func (l Location) Longitude() (result float64)
- func (l Location) Name() (result string)
- func (l Location) PlaceID() string
- func (l Location) Postcode() (result string)
- func (l Location) Source() string
- func (l Location) State() (result string)
- func (l Location) Street() (result string)
- type Place
Constants ¶
const ApiName = "places"
ApiName is the backend API name.
Variables ¶
var Key = "f60f5b25d59c397989e3cd374f81cdd7710a4fca"
var Retries = 2
Retries specifies the number of attempts to retry the service request.
var RetryDelay = 100 * time.Millisecond
RetryDelay specifies the waiting time between retries.
var Secret = "photoprism"
var ServiceUrls = []string{
"https://places.photoprism.app/v1/location/%s",
}
ServiceUrls specifies the reverse geocoding service URLs.
var UserAgent = ""
Functions ¶
Types ¶
type Location ¶
type Location struct { ID string `json:"id"` LocLat float64 `json:"lat"` LocLng float64 `json:"lng"` LocName string `json:"name"` LocStreet string `json:"street"` LocPostcode string `json:"postcode"` LocCategory string `json:"category"` Place Place `json:"place"` Cached bool `json:"-"` }
Location represents a specific geolocation identified by its S2 ID.
func FindLocation ¶
FindLocation retrieves location details from the backend API.
func (Location) CountryCode ¶
CountryCode returns the location address country code.
type Place ¶
type Place struct { PlaceID string `json:"id"` LocLabel string `json:"label"` LocDistrict string `json:"district"` LocCity string `json:"city"` LocState string `json:"state"` LocCountry string `json:"country"` LocKeywords string `json:"keywords"` }
Place represents a region identified by city, state, and country.