[JT] Jochen Topf's Blog
Mon 2013-03-11 18:08

State of the OSM Coastline

A year ago I released the first version of the OSMCoastline program that extracts and assembles coastlines from OSM data. Since then I have learned more about coastlines in OSM than I ever wanted to know, fixed numerous coastline bugs myself and added more features to the software. OSMCoastline has been in production use at Geofabrik and the German map server for more six months now.

OSM Inspector

While assembling the coastline data, OSMCoastline spits out information about errors in the OSM data, such as self-intersections of the coastline or ways that are oriented the wrong way around. In September 2012 I added a coastline view to the OSM Inspector. This view shows those (potential) and real problems. Since I made this data easily available, people have been very diligent at fixing the problems. Unfortunately new problems crop up again and again as people are working on the OSM data who either don’t know how to correctly tag the coastline or they are not paying enough attention to what they are doing.

Currently we have reached a sort of stalemate. Most days the coastline is broken in a few places, but people fix those problems quickly. OSMCoastline automatically fixes some problems (not in OSM, just in its output) and some problems only affect very small areas, so the situation is not too bad. But it needs constant attention. If we don’t keep up with fixes, the coastline data is unusable after a few days.

Lakes tagged as coastlines

When I started work on the coastline there were a lot of small and large lakes incorrectly tagged with natural=coastline instead of natural=water or similar. There were two common cases: Very large lakes (like the Great Lakes in North America) that were created before the introduction of multipolygon relations. Without multipolygon relations there was no way these large lakes could be modelled in OSM. The other case are inlets, lagoons, etc. that were tagged as coastline but they are actually not connected to the sea, maybe there is a dam that cuts them off or so. In some cases it is not immediately obvious whether these features are part of the coastline or separate entities. But by looking closely at the aerial images you can usually see whether there is a connection or not. Sometimes these connections are seasonal, though, or change with the tides, and it is not always clear what the best tagging is.

Since then I added the display of “small lakes” tagged as coastline to the OSM Inspector, they show up as “Questionable” because I want people to use their judgement in fixing them. First I displayed only features with less than 1,000 nodes, those were all converted to proper lakes quickly. Currently I show those kinds of features with less than 10,000 nodes.

There are only a few of those cases left in the world and I am not sure whether it is a good idea to fix them all. Those lakes are huge and having multipolygons that big could make editing the data difficult. Ultimately this can only be fixed in my opinion by adding a proper multipolygon object type to OSM.

You can see the remaining large features tagged as coastlines in the image above and here is a list:

There is some debate whether the Caspian Sea is to be classified as lake or as a sea, which might have important consequences for its use by neighboring states, but all the other features are definitly lakes.

Another issue is that properly tagged lakes will not show up in small zoom levels any more, because coastlines are rendered in all zoom levels, but lakes are only rendered in zoom level 6 and up. But this can and should be solved by creating properly generalized water polygons of large lakes that can be used in lower zoom levels.


The coastline of Antarctica in OSM is quite bad and we are working on fixing this. But the quality of the data is not the only issue here. The following map sketch illustrates this issue.

First, the current coastline is cut off at 85.0511° South, so the dark blue area on the map sketch above is lost. The commonly used web maps can’t show anything below this line, so you can’t see this. But if you use a different map projection this is a problem. Second, to support these maps the coastline is “closed” by adding a fake coastline (the “red lines” in the image above). So in OSM the land area of Antarctica actually ends at 85.0511° S, there is a round ocean around the South Pole…

The Antarctica import mentioned above will change the coastline to use the outer line of the ice shelves (the green line in the map sketch, see the wiki for the reasoning). As a nice side effect this will solve the first problem. The second problem is solved by leaving the coastline open (ie not connecting the ends at 180°W and 180°E to anything) and adding a special case to the software using the coastline. OSMCoastline already knows how to handle this case. It internally closes the coastline creating an Antarctica polygon that either goes to the 85.0511° line or to 90° depending on which output projection you have chosen. So the result will be usable in the usual tiled web maps as well as in other maps.


Similar to the Antarctica case but slightly different is the case at the Antimeridian (180th meridian). The antimeridian crosses Russia, Fiji, and Antarctica. I’ll leave this problem as an exercise for the reader…


There are currently about 716,000 ways tagged natural=coastline with together 30 million nodes representing 1.2 million kilometers of coastline. This means that on average there is a node every 41 meters in the coastline, an extraordinary achievement for the OSM community!

There are nearly 480,000 islands, most rather small. The largest single object created from this coastline is the polygon for the land mass of Asia+Africa+Europe containing 4.3 million nodes followed by the 3.5 million node polygon of the American continent.


The OSMCoastline tool has been around for a year now and has proven to be very stable. It is easier to install, better documented, runs much faster and has more features than its predecessor coastcheck. Of course as the author of OSMCoastline I am biased but I can only recommend that everybody who still uses coastcheck switch to OSMCoastline.

OSMCoastline does not only generate the coastline as line, but also land and water polygons. Optionally it can split up the huge polygons into manageable pieces. Unlike coastcheck which can only generate land polygons and splits them up in a grid of regularly tiled pieces, OSMCoastline will split the polygons recursively into smaller and smaller pieces until each has less points than a configurable limit.

OSMCoastline counts all problems detected while it runs. It will exit with different return codes depending on whether there were no problems at all, only a few warnings, or too many or larger errors. You can use the return code to decide whether the data is usable at all. This is far better than with coastcheck where you had to manually check whether the data is usable.

Results of a daily run of OSMCoastline are available at OpenStreetMapData.com [now: osmdata.openstreetmap.de]. In addition to the check done by OSMCoastline itself, as explained above, OpenStreetMapData.com also checks a rendered bitmap of the coastline data against last days rendering to find out if there are large changes. If there are too many changes, OpenStreetMapData.com will keep the old data. It is better to keep older data than giving out a possibly broken coastline.

The German map/tile server has been updated automatically each night from OpenStreetMapData.com for several months now without any reported problems.

Generalized Coastlines

Christoph Hormann has been working on generalizing coastlines. These look very nice and I think we should work towards using them on OSM maps. We probably need generalized lakes, too, and as coastlines often coincide with boundaries, generalized boundaries, to make this really look perfect.

Tags: antarctica · openstreetmap · osmcoastline · osmdata