0

Im using the geocoder gem for ruby. I want to find natural places in openstreetmap in a given area (viewbox). Currently it looks like this:

Geocoder.search(q, params: {viewbox: viewbox, bounded: 1, limit: 20})

Where q is the search term. If I use q = '[school]' for example, I'm able to find all schools in the given viewbox. But How do I find natural places like woods etc.? I could use q = 'wood' but I want to avoid finding buildings or streets containing the word 'wood'.

kernification
  • 511
  • 1
  • 5
  • 15
  • I am not sure if you could do such thing: You probably need to do your own semmantic mapping, for example woods is where there are forests, parks, gardins, etc ... so instead of looking for woods, your api call must send the semantic keywords that are associated with nature related objects. A map engine doesn't know if woods mean nature, a shop, street or a neighborhood name. So you need to find a way to tell it this – Gilg Him Jan 10 '20 at 12:08

1 Answers1

1

Geocoders usually are intended for finding named places. To query for unnamed places of a specific type better use Overpass API instead and search for natural=wood (unmanaged woodland) and landuse=forest (woodland managed by humans). Example: https://overpass-turbo.eu/s/PDo

Unfortunately I haven't used Overpass API with ruby myself so far however there is at least one ruby gem for this purpose: overpass-api-ruby.

scai
  • 20,297
  • 4
  • 56
  • 72