February 28, 2016
by chris
0 comments
On openstreetmapdata.com Jochen and me provide daily updated processed OpenStreetMap coastline data for use in maps and elsewhere. It is used for example by the standard map on openstreetmap.org to provide an up-to-date rendering of the coastline. This data is available in a number of different forms:
- land and water polygons – depending on what you want to do you might need either of them
- as large polygons covering whole continents or split into smaller chunks easy to process
- in the full resolution available in the OSM database or in a simplified version significantly reduced in data volume for more efficient rendering of map tiles for low zoom levels
- in Mercator projection or in geographic coordinates
![openstreetmapdata.com coastline variants](http://web.archive.org./web/20160406091216im_/http://blog.imagico.de/wp-content/uploads/2016/01/coastline_variants.png)
Not all combinations of these variants are available which mostly has good reasons:
- The water polygons are only available in a split version since creating one giant polygon with an inner ring for every island on Earth might be theoretically possible but hardly any program would be able to process it.
- The simplified version is only available in Mercator projection since it is only intended for rendering web maps at low zoom levels, not for anything else.
simplified water polygons
What we have not provided to date either are simplified water polygons in Mercator projection and this is one of the most frequent requests we get. Since many map styles use water polygons this is a frequent problem and many data users try to run ST_Simplify() on the full resolution water polygons which of course is a bad idea and leads to clearly visible problems because of the splits:
![wikimedia maps rendering error due to wrong simplification](http://web.archive.org./web/20160406091216im_/http://blog.imagico.de/wp-content/uploads/2016/01/simplify_split_wm.png)
To properly simplify the coastline this needs to be done before splitting the polygons. We generate the new simplified water polygons by inverting the simplified land polygons. The method for doing this is similar to the approach we used for the Antarctic icesheet data. The tools for that are available as open source.
![New simplified water polygons](http://web.archive.org./web/20160406091216im_/http://blog.imagico.de/wp-content/uploads/2016/01/simplified_water_polygons.png)
You can download the new simplified water polygon file on the water polygons page. A number of things should be kept in mind when using this data:
- The polygons are split with minimal overlap. The normal split polygons have considerable overlap to prevent rendering artefacts with AGG renderers like Mapnik. This is not necessary here since the splits are pixel aligned at all zoom levels.
- Do not try to reproject this data into other projections, it won’t work. If you need different projections use the data in geographic coordinates (see below).
- The geometry should exactly match the simplified land polygons and is equally meant to be used for z=0-9.
When using either the simplified land or water polygons keep in mind: they are only meant for improving performance and reducing data volume at the low zoom levels. This should have no or a negligible visual effect. If you want a generalized version of the coastline data for a better readable map or more freedom in styling have a look at the generalized coastline data we offer as well.
split polygons for reprojection
Another problem we had is with the files in geographic coordinates. These are primarily meant for reprojection into other coordinate systems to produce maps in arbitrary projections. This however was normally only possible with the unsplit versions of the files since the splitting was done in a way that cannot generally be reprojected without causing gaps in the polygons at the splits.
![Reprojection errors with standard split polygons](http://web.archive.org./web/20160406091216im_/http://blog.imagico.de/wp-content/uploads/2016/01/split_reproject.png)
To avoid this and to provide split polygons that can be reprojected we now generate an alternative splitting that can be reprojected without problems. You can find these temporarily on
http://data.openstreetmapdata.com/land-polygons-split-regular-4326.zip
http://data.openstreetmapdata.com/water-polygons-split-regular-4326.zip
We intend to replace the current split files in geographic coordinates with these in the long term so if there is anyone using the old files in ways where these new versions would not be a suitable replacement let us know.
![regularly split coastline polygons](http://web.archive.org./web/20160406091216im_/http://blog.imagico.de/wp-content/uploads/2016/01/split_regular.png)
These polygons are split in a 1×1 degree tiling and are produced with some overlap except of course at the 180-degree-meridian and at the poles. If your use depends on this overlap you will have to take special care of these areas like done in the following example from the south pole by dissolving these splits after reprojection.
![reprojected split polygons](http://web.archive.org./web/20160406091216im_/http://blog.imagico.de/wp-content/uploads/2016/01/split_regular_reproj.png)
coastline validity
Apart from these new features we have now moved to a new verification system to detect larger errors in the OpenStreetMap data before rolling out a new version of the files. As a reminder: the OSM coastline data is somewhat fragile and although OSMCoastline can fix a number of the most common errors automatically there are cases where automatic fixing does not work and we do not put up the broken data then to avoid maps and other applications using our files to get larger errors. Instead when a larger unfixable error is detected we do not make available the new broken data set but keep the previous one.
The check to detect larger errors is done by rasterizing the data and comparing the new land-water-mask with the old one. The new comparison technique based on gdal_maskcompare will be more systematic and predictable and errors everywhere on earth should be treated equally. We hope this will lead to less frequent lockups because larger edits are wrongly identified as errors as well as less situations where true errors like islands going missing because their coastline is damaged are not noticed. Of course all of this is no alternative to diligence and restraint on side of the mappers when making larger coastline changes. Recently there have been a lot of changes made in coastline tagging of larger lakes so our files could not be updated for more than a month – something like that will always lead to problems.
And finally – if you find this data useful or just enjoy having frequently updated coastlines on openstreetmap.org please contribute to the operation costs of openstreetmapdata.com or support us in other ways – the donation button is not there for decoration.