I want to identify all beaches on this planet (or a given subset of it) that are facing westwards (+/- 20-30 degrees).

My idea is to use OSM as the data source. Extracting all polygons that have the tag "natural=beach" gives me a dataset / shapefile of all areas that are flagged as beaches. So far so good.

I also know that I can use coastline data (either from OSM or Natural Earth for example) to identify the facing of the beaches.

Buffering the beach shapes to correct for minor mismatches and intersecting these with the coastline should provide me with data on which side of the shape is facing towards the water. Using the max/min values of all intersecting points should give me an idea of the bearing. (90 degrees +/- 20-30 degrees would be fine...)

And that's where I am lost...

My preferred tool would be QGIS, but PostGIS would be OK as well.

Is there anyone around with a clever idea how to solve this puzzle?

  • 4
    Instead of using buffers.. Wouldn't it be easier to figure out how to displace all items in your shapefile a bit towards the east, then run an Intersect between the coastline shapefile and the beaches shapefile? They will only overlap where the beaches face west. – Tim Couwelier Apr 29 '14 at 8:16
  • Tim - nice idea. Not sure that it will really work for "strange" geometries. I received another idea: take the coastline as lines and the centroid of beach polygons using v.net in grass snap the centroid to the nearest line (or in postgis). now you have a line that represents direction. calculate the bearing from the start point of the centroid to the end point the line using trig. Although nice it is not fully "within" QGIS. Any more clever ideas? – jdoe Apr 30 '14 at 13:39
  • If you can find a way to turn the coastline into a series of point data and the beach centroids aswell, you can try Nearest Neighbour Analysis as described here: link Instead of joining the attributes as shown in the example, make sure to have x,y values for the two datasets matched. using field calculator you can find the relative differnces between x and y values for the centroid and closest point. Based on the sign of the x-difference you know if it's west or east, and based on the ratio of diff(y)/diff(x) how western. – Tim Couwelier Apr 30 '14 at 14:16
  • Given I ran out of charachters, here goes: if the centroids x-value > coastline point x-value, the beach faces west. the x and y coordinates of the two would let you calc the angle towards the y-axis: (y2-y1)/(x2-x1) gives you the inclination of the line, which you can convert back to degrees – Tim Couwelier Apr 30 '14 at 14:21
  • 5
    You could rasterize your data, set open water values to zero, and beaches to 1, then run the Terrain Analysis->Aspect tool. You would get a raster of the direction of downward slope and be able to choose cells that are "westy" enough. – WxMacMan Jun 16 '14 at 17:52

The elevation service on ArcGIS Online includes ready to use worldwide data, and also a built in raster function to generate aspect. It's also pretty simple to filter simultaneously for a range of aspect values (290-250 degrees) as well as elevation (e.g. 0 to 10 meters, depending on how you define a beach - or perhaps you already have the beaches delineated?). I don't know if you're open to using ArcGIS technology - if yes, I can send you some sample REST requests.

The attached png isn't properly filtered for elevation, but shows the concept...enter image description here

Cody B.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.