Cognised existence: The coastline is the land-sea boundary — the line or polygon edge that separates terrestrial from marine space. It is foundational for any analysis that requires knowing what is land, what is water, or which areas are coastal.

Question: Where is the land-sea boundary and what is its large-scale geometry?

Natural Earth downloads: https://www.naturalearthdata.com/downloads/


Realisations

Natural Earth — Coastline and Land/Ocean masks

Natural Earth provides the most widely used public-domain global coastline at three generalisation levels. It is appropriate for global-to-regional mapping and spatial analysis at scales where high-precision coastal surveys are not required.

Scale selection guide

ScaleShapefileUse case
1:10mne_10m_coastline.shpRegional analysis, national-level maps, coastal context overlays
1:50mne_50m_coastline.shpContinental overview, medium-scale thematic maps
1:110mne_110m_coastline.shpGlobal visualisation, small-scale reference maps

Python load

import geopandas as gpd
 
# Coastline as LineString (all scales follow same pattern)
coastline = gpd.read_file("ne_10m_coastline.shp")
 
# Land as Polygon (useful for land/sea masking)
land = gpd.read_file("ne_10m_land.shp")
 
# Ocean as Polygon
ocean = gpd.read_file("ne_10m_ocean.shp")
 
# Clip to a bounding box
bbox = (5.0, 54.0, 16.0, 58.0)  # roughly Denmark + neighbours
coastline_clip = coastline.cx[bbox[0]:bbox[2], bbox[1]:bbox[3]]

Key attributes (ne_10m_coastline)

FieldMeaning
featureclaFeature class (Coastline)
scalerankVisibility rank (lower = more prominent)
min_zoomSuggested minimum display zoom level

Available companion layers

LayerGeometryUse
ne_10m_landPolygonLand mask
ne_10m_oceanPolygonOcean mask
ne_10m_coastlineLineStringCoastline line
ne_10m_minor_islandsPolygonSmall islands not in main land polygon
ne_10m_reefsLineStringReef features near coast

OpenStreetMap — natural=coastline (pre-processed derivatives)

OSM encodes the coastline using the tag natural=coastline on open ways. Land is always on the left side of the way direction; sea is on the right.

Do you need a line or a polygon? The answer determines which product to use:

Use caseGeometry neededApproach
Display the coastline on a mapLineStringUse ne_10m_coastline (Natural Earth) or the OSM coastlines line file (below)
Distance to coast, buffer zone, proximity analysisLineStringEither source above
Coastal length measurementLineStringEither source above
Land/sea masking, point-in-polygon (is this point on land?)PolygonOSM land-polygons or NE ne_10m_land
Clip a dataset to land onlyPolygonOSM land-polygons or NE ne_10m_land

For the line case osmdata.openstreetmap.de also publishes a pre-assembled coastlines-as-lines file alongside the polygon products:

Download: https://osmdata.openstreetmap.de/data/coastlines.html

PackageGeometryDescription
coastlines-split-4326.zipLineStringAssembled, consistent-direction coastline segments, EPSG:4326
land-polygons-split-4326.zipPolygonLand polygons for masking, EPSG:4326
water-polygons-split-4326.zipPolygonOcean / sea water polygons
simplified-land-polygons-complete-3857.zipPolygonSimplified for tile rendering, EPSG:3857

OSM coastline — Python load

import geopandas as gpd
 
# Line form — for display, distance, proximity
coastline = gpd.read_file("coastlines-split-4326/lines.shp")
 
# Polygon form — for masking / point-in-polygon
land = gpd.read_file("land-polygons-split-4326/land_polygons.shp")
 
# Clip to a bounding box (e.g. Denmark + surrounding sea)
bbox = (7.0, 54.0, 16.0, 58.5)
coastline_dk = coastline.cx[bbox[0]:bbox[2], bbox[1]:bbox[3]]
land_dk = land.cx[bbox[0]:bbox[2], bbox[1]:bbox[3]]

Why raw Overpass / osmnx ways are problematic

Raw natural=coastline ways from Overpass or osmnx are disconnected partial segments with inconsistent direction. They are not pre-assembled into a continuous line and cannot be used directly for either display or analysis without a join step.

ApproachProblem
ox.features_from_place(..., tags={"natural": "coastline"})Returns disconnected, inconsistently oriented segments
Overpass way["natural"="coastline"]Same — partial segments, no topological join
osmcoastline (local)Correct but requires full planet .osm.pbf and the tool

For sub-national detail (e.g. Danish fjords, harbour inlets) OSM-derived coastline at full resolution surpasses Natural Earth. Use the coastlines-split-4326 (line) or land-polygons-split-4326 (polygon) product clipped to the area of interest.


Geometry Representations

Rep IDSource DatasetGeometry TypeNative CRSSuitable ForNot Suitable For
coastline_ne_10m_lineNatural Earth 10mLineStringEPSG:4326Display, distance to coast, coastal length, overlay referenceSub-kilometre precision, legal disputes
coastline_ne_10m_landNatural Earth 10mPolygonEPSG:4326Land/sea masking, point-in-polygon, clip to landCadastral or legal precision
coastline_ne_50m_lineNatural Earth 50mLineStringEPSG:4326Continental-scale mappingAny sub-regional detail
coastline_osm_linesOSM coastlines-split-4326 (assembled)LineStringEPSG:4326High-resolution display, distance-to-coast, proximity analysis, coastal lengthNot suitable as-is for land masking (use polygon form instead)
coastline_osm_land_polygonsOSM land-polygons-split-4326 (assembled)PolygonEPSG:4326Land/sea masking, point-in-polygon, clip to land, fjord and inlet detailRequires pre-downloaded file; not streamed from Overpass

Limitations

  • Natural Earth coastline is generalised — not suitable for precise coastal engineering, legal shoreline disputes, or sub-kilometre coastal modelling.
  • Island coverage at 10m is extensive but not exhaustive for very small or remote islands.
  • For authoritative national coastlines, use official surveying agency products (e.g. GeoDanmark for Denmark, Ordnance Survey for UK).
  • Raster relief products from Natural Earth include bathymetry shading but are not bathymetric data for depth analysis.
  • Raw OSM natural=coastline ways cannot be used directly — always use the pre-processed land-polygons-split-4326 product from osmdata.openstreetmap.de.