JRA
(Jukka Rahkonen)
2
Hi,
I can’t say anything about OpenStreetMap API, but if the data is imported into PostGIS then this mail and following ones in the thread may give one solution for finding the closest beaches:
http://postgis.refractions.net/pipermail/postgis-users/2009-August/024137.html
Oracle Spatial has a special function for this task, this is worth reading even if you do not have plans to acquire Oracle Spatial licence:
http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/73/using-oracles-sdonn-operator-some-examples/
And one standardised, but only partly working alternative is to set up a WFS service delivering OpenStreetMap data (very simple task to do by importing osm data into PostGIS with osm2pgsql and then publishing the point, line and polygon layers with Geoserver). It works only partly for you because WFS does not have “find the closest feature” function. It does, however, have “find within distance of” filter that is searching all the beaches which are closer than a given distance to a reference geometry. WFS standard is also worth reading even if the final aim is to build something that is tailored for OSM, and it is here:
http://www.opengeospatial.org/standards/wfs