0

I create some project for travel but now I need database for beaches all over the world. is there some database of this type. Can I scraping from somewhere. Is it posible to get it from openstreetmap ?

I try with: http://poi.openstreetmap.nl/ but there is no this type of objects (POI)

Also I was try with google places but there is also havent this type...

2 Answers2

2

Elements in OpenStreetMap are described by tags. For beaches there is the natural=beach tag.

If you want to retrieve all beaches from OSM you can either use the Overpass APi and run a query for all elements having this tag or get the raw data (the planet or an extract) and run the query afterwards.

The Overpass-XML query would look like:

<osm-script output="json">
  <union>
    <query type="node">
      <has-kv k="natural" v="beach"/>
    </query>
    <query type="way">
      <has-kv k="natural" v="beach"/>
    </query>
    <query type="relation">
      <has-kv k="natural" v="beach"/>
    </query>
  </union>
  <recurse type="down"/>
</osm-script>

and the equivalent Overpass-QL query (which is just a compacter format):

[out:json];(node["natural"="beach"];way["natural"="beach"];relation["natural"="beach"];);>;;

You can either run this query directly to retrieve the raw data (it is also possible to retrieve XML instead of JSON) or show the result on OverpassTurbo.

Note that this is a really heavy query as it involves checking the whole world, not just a particular geographic region (which could be achieved by specifying a bounding box). Hence the query will take some time to run and you might have to increase the timeout.

A different approach is to download the planet or an extract you are interested in and use osmfilter to extract all elements with certain tags attached to them.

scai
  • 20,297
  • 4
  • 56
  • 72
  • how many results I will get? is there some keyword too for beaches ? – Marcus Ivanov Aug 20 '13 at 17:56
  • All results. The keyword (=tag) for beaches is *natural=beach* as already noted. – scai Aug 20 '13 at 18:01
  • "remark": "runtime error: Query timed out in \"recurse\" at line 1 after 181 seconds." – Marcus Ivanov Aug 20 '13 at 20:23
  • Also how I can get more information abut beaches , with openstrretmap I get just position and name of beach ? – Marcus Ivanov Aug 20 '13 at 21:43
  • As I mentioned you will likely run into timeouts with such a heavy query. Try to increase it. Additionally I added a different approach for extracting those tags to my answer. Also what other information about beaches do you want to have? Some of those beaches may have other tags attached to them, others don't. That's how OSM works. – scai Aug 21 '13 at 05:29
  • I want as much as posible information about beach. Its bad that google places dont have this tag – Marcus Ivanov Aug 21 '13 at 18:17
0

Not exactly for beaches, but you can find a lot of categorized POIs on this site: http://waypointer.info

Igor Luzhanov
  • 780
  • 1
  • 7
  • 14