How to calculate beach orientation?

Hi everyone,

I’m building a case study application with OSM and I’m trying to figure out how I can determine a beach orientation.

My idea was to use Nominatim API to find out a beach by name, get the coordinates and understand where the sea is relative to the beach, but I’m kinda stuck with the last step (which is basically understanding the beach orientation, aka if a certain beach is facing north, south, etc.).

Can anyone give me some hints?

Thanks!

If it’s a beach by the sea, there should be a way with natural=coastline nearby. Coastlines in OSM are required to have land to the left, so you can take the direction of the coastline and add 90º to get the “facing” direction of the beach.

It is of course a question how large of a section of the coastline to consider. I would just grab a section roughly matching the size of the polygon (say, the largest width of the polygon), or some sensible default in case of node beaches.

5 Likes

If using the GIS extensions to the Postgresql database, there are functions to find the closest point on a line to a given point. Now you have two points (the one for the beach and one on the adjacent coast line) and there is a function for getting the bearing of that line.

1 Like

I think you are up to do some spatial analysis. Postgresql + Postgis, as mentioned, are a good tool for this, but you have at least to load the beach and the coastline in a database.
See Coastlines

1 Like

The suggestion to look at coastlines is a very clever idea.

But maybe geometry operations like ST_StraightSkeleton might be useful for you, to turn a beach area into a beach ”line”