Documentation
¶
Overview ¶
Package overpass provides a client for using the Overpass API.
Usage:
import "github.com/serjvanilla/go-overpass"
Construct a new client, then use Query method on the client to receive result for your OverpassQL queries.
client := overpass.New() //Retrieve relation with all its members, recursively. result, _ := client.Query("[out:json];relation(1673881);>>;out body;") //Take a note that you should use "[out:json]" in your query for correct work.
Default client uses overpass-api.de endpoint, but you can choose another with NewWithSettings method.
client := overpass.NewWithSettings("http://api.openstreetmap.fr/oapi/interpreter/", 1, http.DefaultClient)
You also can use default client directly by calling Query independently.
result, _ := overpass.Query("[out:json];relation(1673881);>>;out body;")
Rate limiting ¶
Library respects servers rate limits and will not perform more than one request simultaneously with default client. With custom client you are able to adjust that value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultClient = New()
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client manages communication with the Overpass API.
func NewWithSettings ¶
func NewWithSettings( apiEndpoint string, maxParallel int, httpClient HTTPClient, ) Client
NewWithSettings returns Client with custom settings.
type ElementType ¶
type ElementType string
ElementType represents possible types for Overpass response elements.
const ( ElementTypeNode ElementType = "node" ElementTypeWay ElementType = "way" ElementTypeRelation ElementType = "relation" )
Possible values are node, way and relation.
type HTTPClient ¶
type Meta ¶
type Meta struct { ID int64 Timestamp *time.Time Version int64 Changeset int64 User string UID int64 Tags map[string]string }
Meta contains fields common for all OSM types.
type Relation ¶
type Relation struct { Meta Members []RelationMember Bounds *Box }
Relation represents OSM relation type.
type RelationMember ¶
type RelationMember struct { Type ElementType Node *Node Way *Way Relation *Relation Role string }
RelationMember represents OSM relation member type.
type Result ¶
type Result struct { Timestamp time.Time Count int Nodes map[int64]*Node Ways map[int64]*Way Relations map[int64]*Relation }
Result returned by Query and contains parsed result of Overpass query.
type ServerError ¶
func (*ServerError) Error ¶
func (e *ServerError) Error() string