OSMCOASTLINE(1)
β¨ osmcoastline β¨
okay bestie, gather round, because osmcoastline is literally the main character of OpenStreetMap coastline extraction and i need you to know her π
π NAME π
osmcoastline β pulls the coastline out of OpenStreetMap data, no cap ππ¦
π SYNOPSIS π
osmcoastline [OPTIONS] --output-database=OUTPUT-DB INPUT-FILE
π DESCRIPTION π
so here's the vibe: osmcoastline takes your INPUT-FILE β usually a planet file (or, and this is the glow-up move, the output of the osmcoastline_filter program, more on that below π) β and it extracts all the coastline data out of it, then assembles every little piece into polygons so map renderers and friends can actually use them. it's giving puzzle night but make it cartography π§©
everything it makes gets written into the Spatialite database OUTPUT-DB. depending on which options you pass, that db will hold your coastlines in different formats. the deets are down in the options section below, and also in README.md if you want the full director's cut β¨
π OPTIONS π
-h,--helpβ shows you the usage info. the "help me help you" of it all π«Ά-b,--bbox-overlap=OVERLAPβ when polygons are just Too Bigβ’ they get split into two halves (and recursively again and again if they still can't behave). wherever those polygons touch, thisOVERLAPgets added, because two polygons that merely kiss tend to cause rendering drama. the value is in whatever units your projection uses (so for WGS84 (EPSG: 4326) it's in degrees, and for Mercator (EPSG: 3857) it's in meters). set it too small and you'll get rendering artefacts at the touching points. set it bigger and your output polygons get bigger too. the ideal value depends on the map scale or zoom level you're prepping data for. set it to0to disable the overlap entirely. default is0.0001for WGS84 and10for Mercator. π pick wisely-c,--close-distance=DISTANCEβosmcoastlinestitches ways taggednatural=coastlineinto rings, but sometimes the OSM data has a little gap in the coastline (rude). if that gap is smaller thanDISTANCE,osmcoastlinewill close it for you. use0to turn this feature off completely.-d,--debugβ turns on debugging output. for when you need to see everything π-e,--exit-ignore-warningsβ exit with code 0 even if warnings happened. "i'm choosing peace" mode π-f,--overwriteβ overwrites the output file if it's already there. no hesitation, no mercy π-g,--gdal-driver=DRIVERβ lets you pick literally any GDAL driver. fair warning though: only the"SQLite","GPKG"and"ESRI Shapefile"GDAL drivers have actually been tested. default is"SQLite".-i,--no-indexβ skips creating spatial indexes in the output db. default is to create those indexes, which makes the db chunkier but data access faster. so this flag = smaller db, slower lookups. your call bestie βοΈ-l,--output-linesβ outputs the coastlines as lines into the database file.-m,--max-points=NUMβ set this to0and no splitting of large polygons and linestrings will happen, periodt. set it to any other positive integer andosmcoastlinewill try to split polygons/linestrings so they never have more than this many points. heads up: depending on the overlap you set with-band the actual shape of the polygons, sometimes it's just not possible to get them small enough π andosmcoastlinewill warn you onSTDERRwhen that happens. default is1000.-o,--output-database=FILEβ the Spatialite database file for output. this option is mandatory, like genuinely you cannot skip it. π₯-p,--output-polygons=land|water|both|noneβ which polygons get written out. default island. pick your fighter πποΈ-r,--output-ringsβ outputs rings into the database file. this one's for debugging, iykyk π-s,--srs=EPSGCODEβ sets the spatial reference system / projection. use4326for WGS84, or3857for "Web Mercator". if you're doing the usual tiled web maps,3857is probably the right call. for other stuff β especially if you want to re-project into some other projection β4326is probably right. other projections are currently not supported, sorry babe π default is4326.-S,--write-segments=FILENAMEβ writes out all coastline segments to the file you name. a segment is a connection between two points. these get written in an internal format that's meant for use with theosmcoastline_segmentsprogram only. the file contains all segments actually in the OSM data and only those. gaps are (possibly) closed at a later stage ofosmcoastline's run, but those closing segments won't be in this file. so no, don't expect them π-v,--verboseβ gives you detailed info on whatosmcoastlineis doing, including timing. the play-by-play commentary ποΈ-V,--versionβ displays the program version and license information.
π NOTES π
to speed up processing you might want to run the osmcoastline_filter program first. check its man page for the details, bestie πβοΈπ¨
π¨ DIAGNOSTICS π¨
osmcoastline exits with exit code:
0β if everything was okay. we love a clean run β¨1β if there were warnings while processing the coastline (unless-eis set).2β if there were errors while processing the coastline.3β if there was a fatal error when running the program.4β if there was a problem with the command line arguments. we've all been there π
π EXAMPLES π
run osmcoastline on a planet file using the default options:
osmcoastline -o coastline.db planet.osm.pbf
running osmcoastline_filter first (the speedrun strat):
osmcoastline_filter -o coastline.osm.pbf planet.osm.pbf
osmcoastline -o coastline.db coastline.osm.pbf
π SEE ALSO π
README.mdosmcoastline_filter(1),osmcoastline_readmeta(1),osmcoastline_segments(1),osmcoastline_ways(1)- Project page
- OSMCoastline in OSM wiki
Β©οΈ COPYRIGHT Β©οΈ
Copyright (C) 2012-2026 Jochen Topf <jochen@topf.org>. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. π (yes that's the whole vibe, and yes you do have to keep it)
π CONTACT π
got questions? found a bug? wanna report it? go to <https://osmcode.org/contact.html> β they're nice, promise π«Ά
π AUTHORS π
Jochen Topf <jochen@topf.org>.
and that's the whole page, bestie π this was osmcoastline version 2.5.0, mwah, go make some beautiful coastlines πβ¨
π¦ where this page comes from
- ubuntu stonking: osmcoastline 2.5.0-1build1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms