I wonder if there is any API I could query OSM data through, for example; Are (lon_1, lat_1) at land or at sea? Or could it be possible to get an island as a well-defined polygon? The only usage I've seen so far has just been tools for rendering OSM data (generating tiles).
-
This MapServer seems to be quite interesting. Thanks – vikingosegundo Feb 12 '11 at 16:57
-
You should add your update as an answer and accept it. – John Willemse May 28 '13 at 09:34
-
This API lets you download features from OSM: https://buntinglabs.com/solutions/openstreetmap-extracts – Brendan Mar 22 '23 at 18:31
8 Answers
Yes, there is an api and xapi (extended api).
I havent used these yet.
But there is also the cloudmade api to OSM. I played a bit with the python api.
I am not sure, if any of them could help you with your particular problem, but you could search for a coastline near to your point. If your point is within the polygon tagged natural=coastline, you have an island (or a continent)...

- 7,551
- 4
- 41
- 81

- 52,040
- 14
- 137
- 178
-
What is the XML format it delivers and how would I render that into a raster image in my application? – Matthew Lock Sep 17 '09 at 08:14
-
3to generate a iamge from the xml u need a renderer. there a several. see here http://wiki.openstreetmap.org/wiki/Renderers – vikingosegundo Sep 17 '09 at 12:27
-
1For large and/or complex queries [Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API) is the way to go. – scai Feb 20 '17 at 10:51
You can use CloudMade's Geocoding API to search for an island in the OpenStreetMap data. The API will return the geometry of the result by default, and this sounds to me what you are looking for. For example, Arran off the coast of Scotland can be found by the following http request:
http://geocoding.cloudmade.com/BC9A493B41014CAABB98F0471D759707/geocoding/find/Arran,UK.js?results=1
(and as a neat little hack, changing the .js to .html previews the result.
More docs and examples on the API are at developers.cloudmade.com/projects/show/geocoding-http-api If you don't want to use the http api, then abstraction APIs are available in multiple languages - ruby, python, perl and others.

- 933
- 6
- 13
-
This link appears to be stale. It was from more than 10 years ago after all. – wegry Jan 05 '20 at 19:21
No one seems to have mentioned here the Leaflet API:
http://leafletjs.com/reference.html

- 21,790
- 65
- 230
- 411
-
4This is not really answering what the author asked. He wants a way to query OpenStreetMap, not to display a map. Leaflet is "an open-source JavaScript library for mobile-friendly interactive maps" as quoted on their website. – xarlymg89 May 10 '17 at 15:49
I have used CloudMade OSM extracts but had some problems with them. For example, Norway was clipped too tightly, causing some roads on the west coast to disappear.
I now prefer the overpass API.
Put something like this into the query form at http://www.overpass-api.de/query_form.html
<osm-script timeout="10000" element-limit="1073741824">
<union into="_">
<bbox-query into="_" s="52.3170669250001" n="52.4027433480001" w="4.80527567900009" e="4.97793537400008"/>
<recurse from="_" into="_" type="up"/>
<recurse from="_" into="_" type="down"/>
</union>
<print from="_" limit="" mode="meta" order="id"/>
</osm-script>
Put the bounds of the area you want, in degrees, in the s, n, w and e attributes of the element.

- 1,648
- 1
- 24
- 34
Of course, the javascript api is called openlayers.

- 1,420
- 12
- 11
-
2I know about openlayers, but isn't that just for displaying/operating on rendered tiles? – Yngve Sneen Lindal Jul 07 '09 at 23:58
MapQuest
has a set of 'Open' web service APIs based on OpenStreetMap data with fairly unrestrictive Terms (i.e. the Terms follow closely to that of OSM):
http://developer.mapquest.com/plans

- 8,857
- 3
- 29
- 45

- 6,825
- 5
- 38
- 35
I've found a great API for reading Openstreetmap data; Mapscript. This is an interface to MapServer, which is able to read *.map and *.shp files. It is able to use a spatial index and is therefore potentially extremely fast. I've done random polygon lookups (checking if a polygon intersects land) of the world coastline shape file in 40 ms.

- 1,013
- 3
- 12
- 24
how about http://wiki.openstreetmap.org/wiki/Nominatim? I had used this and setup my own server

- 600
- 1
- 6
- 19