OpenStreetMap API – Make the Most of Free Resources
What is OpenStreetMap(OSM)?
OpenStreetMap is a project to create free map of the world that can be edited. OSM has been successful because of map data access issues and increased use of low cost satellite navigation system across the world. Real power of OSM is developers across the world and the contribution they are making to the entire ecosystem with the help of OSM APIs.
OSM has more than 2 million registered users who are collecting and adding Map related data with the help of surveys, GPS devices, aerial photography and other methods. Data quality may vary as it is not controlled by any centralized entity. Many companies like Craigslist, Foursquare, MapQuest are planning to switch to OSM.
OSM has been supported by Yahoo! also for use of its aerial photography. After Google went paid companies have switched to OSM and that includes Apple also. OSM community is active and organizes annual conference with an agenda to spread the use of OSM.
Editing of Maps is done with web based editor known as iD(HTML App) made using d3.js by Mapbox.
OSM would provide route planning also with the use of OSRM, GraphHopper and MapQuest.
Maps provided by OSM are viewed using Web Browser, GNOME Maps, Marble, Foxtrot GPS and Emerillon.
Great Use of OSM
After the 2010 Haiti Earthquake it took only 2 days to map the roads and buildings of Haiti. That is the power of open source software. It was used by various organizations to reach to reach out to victims of the Earthquake. After Haiti Earthquake OSM data has been used after multiple crisis and disasters like Mali, Typhoon Haiyan, Ebola Epidemic etc.
OSM Data Format
OSM data consists of four core elements like Nodes(geographical point), Ways(ordered list of nodes), Relations(ordered list of nodes, ways and relations) and Tags(key-value pairs).
OSM data is stored in PostreSQL. Data transfer would be in XML or PBF(Protocol Buffer Binary Format).
OSM Editing API is based on RESTful APIs. Access to modify would be provided only after authorization is done using OAuth.
Get Map Data by passing bounding box, this would be left represented as long of leftmost side of the box, right is the longitude of the rightmost side of the box, bottom would be latitude of bottom side of box and top would be latitude of top side of the box.
How Bounding box computation works
Nodes (includes nodeâ€™s old and new location to bounding box), Ways(includes all of the wayâ€™s nodes to the bounding box), Relations(adding or removing nodes or ways or relation would triggers its complete details to be added to bounding box).
Changesets represents the changes that are happening to OSM data. Changesets(changes) are represented with the help of comment(human readable comments) this is similar to any version control system. OSM follows a mechanism in order to make sure that open changesets are not causing any issues with the database integrity and there are no loose ends. You canâ€™t delete changesets at this stage for the changesets that do not contain any changes.
For changesets following API options are available: create, get changeset by id, put, close, get(download), expand bounding box, get changesets, upload diff, changeset comment, changeset subscribe, changeset unsubscribe.For Nodes, Ways and Relations OSM has options like create, read, update and delete. You can get single or multiple elements at any time.
Traces for GPS
GPS Traces from OSM is provided in GPX(GPS Exchange format). You can upload also in the same GPX file format. You can download GPX files by accessing with GET method.
Map Notes API
This set of API provides option to add geo-referenced text notes. This API includes Get Notes, Post Comment, Search.
APIs are used when you want to do limited number of operations. But when you want to upload in a big number do it with bulk upload mechanisms.