Documentation ¶
Index ¶
- type Changeset
- type Client
- func (c *Client) CreateChangeset() (*Changeset, error)
- func (c *Client) GetMyChangesets(onlyOpen bool) ([]*Changeset, error)
- func (c *Client) RetrieveMapObjects(minLat, minLon, maxLat, maxLon float64) (*Wrap, error)
- func (c *Client) SaveChangeset(cs *Changeset) error
- func (c *Client) SaveNode(n *Node, cs *Changeset) error
- type Node
- type Tag
- type User
- type Wrap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Changeset ¶
type Changeset struct { XMLName xml.Name `xml:"changeset"` ID int64 `xml:"id,attr,omitempty"` User string `xml:"user,attr,omitempty"` UID int64 `xml:"uid,attr,omitempty"` CreatedAt time.Time `xml:"created_at,attr,omitempty"` ClosedAt time.Time `xml:"closed_at,attr,omitempty"` Open bool `xml:"open,attr,omitempty"` MinLat float64 `xml:"min_lat,attr,omitempty"` MinLon float64 `xml:"min_lon,attr,omitempty"` MaxLat float64 `xml:"max_lat,attr,omitempty"` MaxLon float64 `xml:"max_lon,attr,omitempty"` CommentCount int64 `xml:"comments_count,attr,omitempty"` Tags []Tag `xml:"tag"` }
Changeset contains information about a changeset in the API. You need to create a changeset before submitting any changes to the API.
type Client ¶
type Client struct { APIBaseURL string HTTPClient *http.Client CurrentUser *User DebugHTTPRequests bool // contains filtered or unexported fields }
Client represents an OSM client which is capable of RW operations on the OpenStreetMap
func New ¶
New instantiates a new client and retrieves information about the current user. Set useDevServer to true to change the API URL to the api06.dev.openstreetmap.org server.
func NewWithAPIEndpoint ¶ added in v0.3.0
NewWithAPIEndpoint instantiates a new client and retrieves information about the current user. Set apiEndpoint to your desired API endpoint (e.g. https://api06.dev.openstreetmap.org/api/0.6)
func (*Client) CreateChangeset ¶
CreateChangeset creates a new changeset
func (*Client) GetMyChangesets ¶
GetMyChangesets retrieves a list of (open) changesets from the API
func (*Client) RetrieveMapObjects ¶
RetrieveMapObjects queries all objects within the passed bounds. You need to ensure the min values are below the max values.
func (*Client) SaveChangeset ¶
SaveChangeset updates or creates a changeset
type Node ¶
type Node struct { XMLName xml.Name `xml:"node"` ID int64 `xml:"id,attr,omitempty"` Version int64 `xml:"version,attr,omitempty"` Changeset int64 `xml:"changeset,attr,omitempty"` User string `xml:"user,attr,omitempty"` UID int64 `xml:"uid,attr,omitempty"` Latitude float64 `xml:"lat,attr"` Longitude float64 `xml:"lon,attr"` Tags []Tag `xml:"tag"` }
Node represents one node in the OpenStreetMap
type Tag ¶
type Tag struct { XMLName xml.Name `xml:"tag"` Key string `xml:"k,attr"` Value string `xml:"v,attr"` }
Tag represents a key-value pair used in all objects inside OpenStreetMap
type User ¶
type User struct { XMLName xml.Name `xml:"user"` ID int64 `xml:"id,attr"` DisplayName string `xml:"display_name,attr"` AccountCreated time.Time `xml:"account_created,attr"` Description string `xml:"description"` }
User contains information about an User in the OpenStreetMap
type Wrap ¶
type Wrap struct { XMLName xml.Name `xml:"osm"` User *User `xml:"user,omitempty"` Changesets []*Changeset `xml:"changeset,omitempty"` Nodes []*Node `xml:"node,omitempty"` }
Wrap is a mostly internal used struct which holds requests to / responses from the API. You will get a Wrap object when querying map objects from the API