This document is a work in progress, and outlines my new workflow for generating contour lines.
Prep:
Load metadata for all available DEMs into into postgis. More on this later.
Prepare coastline data
Goal of this step is to get a series of polygons that can be used for intersection queries to determine if a contour is adjacent to the coastline.
Download OSM coastlines wget http://data.openstreetmapdata.com/coastlines-split-3857.zip