Skip to content

feat(render): add sea and ocean rendering from coastline data#193

Open
utaysi wants to merge 2 commits intooriginalankur:mainfrom
utaysi:fix/sea-land-classification
Open

feat(render): add sea and ocean rendering from coastline data#193
utaysi wants to merge 2 commits intooriginalankur:mainfrom
utaysi:fix/sea-land-classification

Conversation

@utaysi
Copy link

@utaysi utaysi commented Feb 14, 2026

Problem

Currently, only inland water bodies (rivers, lakes, bays) are rendered. Open seas and oceans are not shown at all, because OSM represents them as coastline lines rather than water polygons. PR #142 addressed sea/ocean rendering and fixed it for several examples shown there. However, the issue persists on the current main branch for other locations. This is especially noticeable for coastal cities like Istanbul, where the sea appears as blank land-colored background.

Solution

  • Fetch OSM coastline data and convert the coastline lines into water polygons by splitting the viewport into land and water regions
  • Classify land vs water polygons using the OSM coastline winding direction convention (land on left, water on right when following the line direction). This correctly handles cities spanning multiple disconnected land masses, such as Istanbul's European and Asian sides separated by the Bosphorus

Before / After

Istanbul

uv run create_map_poster.py -c "Istanbul" -C "Turkey"

Before After
istanbul_before istanbul_after

The Bosphorus strait was already rendered as water, but the Sea of Marmara (south) was not — it appeared as blank land-colored background. Now the open sea renders correctly.

Kadikoy

uv run ./create_map_poster.py --city "Kadikoy" --country "Istanbul" -lat 40.9855555556 -long 29.0258055556 -d 4500

Before After
kadikoy_before kadikoy_after

Kadikoy (another part of Istanbul outside of 1st map area) appeared almost landlocked. Now the surrounding sea renders correctly, showing it as the coastal peninsula it is.

Build water polygons from OSM coastline lines by splitting the viewport into land and water regions. Fetch coastline as a new data step and render sea areas beneath existing water layers.
Replace center-point heuristic with OSM coastline winding rule (land on left, water on right) so that cities spanning multiple land masses like Istanbul render both sides correctly as land.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant