package
0.8.0
Repository: https://github.com/paulmach/osm.git
Documentation: pkg.go.dev

# README

osm/osmapi Godoc Reference

Package osmapi provides an interface to the OSM v0.6 API.

Usage:

node, err := osmapi.Node(ctx, 1010)

This call issues a request to api.openstreetmap.org/api/0.6/node/1010 and returns a parsed osm.Node object with all the methods attached.

List of functions

func Map(context.Context, bounds *osm.Bounds) (*osm.OSM, error)

func Node(context.Context, osm.NodeID) (*osm.Node, error)
func Nodes(context.Context, []osm.NodeID) (osm.Nodes, error)
func NodeVersion(context.Context, osm.NodeID, v int) (*osm.Node, error)
func NodeHistory(context.Context, osm.NodeID) (osm.Nodes, error)

func NodeWays(context.Context, osm.NodeID) (osm.Ways, error)
func NodeRelations(context.Context, osm.NodeID) (osm.Relations, error)

func Way(context.Context, osm.WayID) (*osm.Way, error)
func Ways(context.Context, []osm.WayID) (osm.Ways, error)
func WayFull(context.Context, osm.WayID) (*osm.OSM, error)
func WayVersion(context.Context, osm.WayID, v int) (*osm.Way, error)
func WayHistory(context.Context, osm.WayID) (osm.Ways, error)

func WayRelations(context.Context, osm.WayID) (osm.Relations, error)

func Relation(context.Context, osm.RelationID) (*osm.Relation, error)
func Relations(context.Context, []osm.RelationID) (osm.Relations, error)
func RelationFull(context.Context, osm.RelationID) (*osm.OSM, error)
func RelationVersion(context.Context, osm.RelationID, v int) (*osm.Relation, error)
func RelationHistory(context.Context, osm.RelationID) (osm.Relations, error)

func RelationRelations(context.Context, osm.RelationID) (osm.Relations, error)

func Changeset(context.Context, osm.ChangesetID) (*osm.Changeset, error)
func ChangesetWithDiscussion(context.Context, osm.ChangesetID) (*osm.Changeset, error)
func ChangesetDownload(context.Context, osm.ChangesetID) (*osm.Change, error)

func Note(ctx context.Context, id osm.NoteID) (*osm.Note, error) {
func Notes(ctx context.Context, bounds *osm.Bounds, opts ...NotesOption) (osm.Notes, error)
func NotesSearch(ctx context.Context, query string, opts ...NotesOption) (osm.Notes, error)

func User(ctx context.Context, id osm.UserID) (*osm.User, error)

See the godoc reference for more details.

Rate limiting

This package can make sure of x/time/rate.Limiter to throttle requests to the official api. Example usage:

// 10 qps
osmapi.DefaultDatasource.Limiter = rate.NewLimiter(10, 1)

# Functions

At adds an `at=2006-01-02T15:04:05Z` parameter to the request.
Changeset returns a given changeset from the osm rest api.
ChangesetDownload returns the full osmchange for the changeset using the osm rest api.
ChangesetWithDiscussion returns a changeset and its discussion from the osm rest api.
Limit indicates the number of results to return valid values [1,10000].
Map returns the latest elements in the given bounding box.
MaxDaysClosed specifies the number of days a note needs to be closed to no longer be returned.
NewDatasource creates a Datasource using the given client.
Node returns the latest version of the node from the osm rest api.
NodeHistory returns all the versions of the node from the osm rest api.
NodeRelations returns all relations a node is part of.
Nodes returns the latest version of the nodes from the osm rest api.
NodeVersion returns the specific version of the node from the osm rest api.
NodeWays returns all ways a node is part of.
Note returns the note from the osm rest api.
Notes returns the notes in a bounding box.
NotesSearch returns the notes in a bounding box whose text matches the query.
Relation returns the latest version of the relation from the osm rest api.
RelationFull returns the relation and its nodes for the latest version the relation.
RelationHistory returns all the versions of the relation from the osm rest api.
RelationRelations returns all relations a relation is part of.
Relations returns the latest version of the relations from the osm rest api.
RelationVersion returns the specific version of the relation from the osm rest api.
User returns the user from the osm rest api.
Way returns the latest version of the way from the osm rest api.
WayFull returns the way and its nodes for the latest version the way.
WayHistory returns all the versions of the way from the osm rest api.
WayRelations returns all relations a way is part of.
Ways returns the latest version of the ways from the osm rest api.
WayVersion returns the specific version of the way from the osm rest api.

# Constants

BaseURL defines the api host.

# Variables

DefaultDatasource is the Datasource used by package level convenience functions.

# Structs

Datasource defines context about the http client to use to make requests.
ForbiddenError means 403 from the api.
GoneError is returned for deleted elements that get 410 from the api.
NotFoundError means 404 from the api.
RequestURITooLongError is returned when requesting too many ids in a multi id request, ie.
UnexpectedStatusCodeError is return for a non 200 or 404 status code.

# Interfaces

FeatureOption can be used when fetching a feature or a set of different features.
NotesOption defines a valid option for the osmapi.Notes by bounding box api.
A RateLimiter is something that can wait until its next allowed request.