Skip to content

An exact implementation of the editing functionality in the OSM-API.

License

Notifications You must be signed in to change notification settings

OsmSharp/io-api

Repository files navigation

OsmSharp.IO.API

NuGet Badge

This is a simple C# client to allow using OSM API easily over REST. Please read the API's documentation and use it responsibly. Misuse can have an adverse affect on the OSM ecosystem. Pull requests are welcome. You will need VisualStudio, VS Code or Rider to modify this project.

Features

  • Supports Logging using ILogger
  • Supports Authentication with username and password, OAuth 1 and OAuth 2
  • Supports every documented operation of the Osm Api v0.6
  • Is thread safe

Example Usage

// Create a client factory (pointing at the dev server)
var clientFactory = new ClientsFactory(null, new HttpClient(),
	"https://master.apis.dev.openstreetmap.org/api/");
// After testing, use "https://www.openstreetmap.org/api/" for production

Get a Node

var client = clientFactory.CreateNonAuthClient();
var node = await client.GetNode(100);

Delete a Node (map changes require BasicAuth or OAuth)

var authClient = clientFactory.CreateBasicAuthClient("username", "password");
var changeSetTags = new TagsCollection() { new Tag("comment", "Deleting a node.") };
var changeSetId = await client.CreateChangeset(changeSetTags);
node.Version = await client.DeleteElement(changeSetId, node);
await client.CloseChangeset(changeSetId);

See the functional tests for examples of each operation.

Supported Operations

πŸŒ• = Does not use authentication

πŸŒ— = With or without authentication (behavior may differ)

πŸŒ‘ = Requires authentication

General Api Stuff

  • πŸŒ• Get Api versions
  • πŸŒ• Get Api capabilities
  • πŸŒ• Get a map section

Change Sets

  • πŸŒ• Get a specific changeset's metadata
  • πŸŒ• Get a specific changeset's changes
  • πŸŒ• Search for changesets
  • πŸŒ‘ Create a new changeset with metadata
  • πŸŒ‘ Add changes to an open changeset
  • πŸŒ‘ Update an open changeset's metadata
  • πŸŒ‘ Close an open changeset
  • πŸŒ‘ Add comments to a changeset
  • πŸŒ‘ Subscribe to a changeset
  • πŸŒ‘ UnSubscribe to a changeset

Map Elements

  • πŸŒ• Get an element
  • πŸŒ• Get an element's version history
  • πŸŒ• Get a specific version of an element
  • πŸŒ• Search for elements
  • πŸŒ• Get relations containing a specific element
  • πŸŒ• Get ways containing a specific node
  • πŸŒ• Get a relation and all of its elements
  • πŸŒ• Get a way and all of its nodes
  • πŸŒ‘ Create a new element
  • πŸŒ‘ Update an element
  • πŸŒ‘ Delete an element

Gpx Files

  • πŸŒ• Get trackpoints in an area
  • πŸŒ— Get a gpx file's metadata
  • πŸŒ— Get a gpx file's original upload data
  • πŸŒ‘ Get current user's gpx files
  • πŸŒ‘ Create a new gpx file
  • πŸŒ‘ Update a gpx file's metadata
  • πŸŒ‘ Delete a gpx file

User Info

  • πŸŒ• Get details about a user
  • πŸŒ• Get details about many users
  • πŸŒ‘ Get current user's permissions
  • πŸŒ‘ Get current user's details
  • πŸŒ‘ Get current user's preferences
  • πŸŒ‘ Update current user's preferences
  • πŸŒ‘ Get a current user's preference
  • πŸŒ‘ Update a current user's preference
  • πŸŒ‘ Delete a current user's preference

Notes

  • πŸŒ• Search for notes
  • πŸŒ• Get an RSS feed of notes in an area
  • πŸŒ• Get a note
  • πŸŒ— Create a new note
  • πŸŒ‘ Comment on a note
  • πŸŒ‘ Close a note
  • πŸŒ‘ ReOpen a note

Contribute

Issues and pull requests are welcome.

About

An exact implementation of the editing functionality in the OSM-API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages