[JT] Jochen Topf's Blog
Thu 2012-04-19 17:41

More Coastlines Stuff

For a while now I have been working on OSMCoastline adding features bit by bit. (See this blog article for some background info.) OSMCoastline now closes small gaps in the coastline and it can split up the huge polygons into smaller ones. You can create land polygons or water polygons depending on your needs and you can have it all in WGS84 or in the usual Mercator projection used for tiles web maps (EPSG 3857). So it does a lot more than the coastcheck application used for these things before. And the software is still a lot faster.

There are several ways the polygons could be split up. The old coastcheck program split the polygons using a static grid. I went a different route: Polygons with more than 1000 points (or whatever you set on the command line) are split in half either horizontally or vertically (in the direction of the larger extent). This is done recursively. You can see the result on the Korean peninsula in the image. This way it doesn’t matter where you are in the world and to what detail you want to render, you’ll always deal with reasonably small polygons. Polygons overlap slightly (again, you can say how much overlap you want) so that you will get no rendering artefacts where they touch.

It took a while to get all the details right, but the software is reasonably feature-complete now. But it is not production-ready yet. I have to figure out good defaults for all the settings and add a few more configuration options. And I have to be better when detecting and fixing errors in the data. If problems are detected they have to be classified into “really bad problems” and “small problems”. Some tiny uninhabited island in the Pacific being broken is a “small problem” the whole American continent missing is a “really bad problem”. At the OSM pub meet yesterday somebody suggested rendering the polygons and comparing it to a known good rendering. If there are more than 1% pixels different or so, the result could be rejected. Maybe that would be a good way to go.

I am already detecting lots of problems and writing data to the spatialite output file that helps in fixing those. I might add a view to the OSM Inspector with that data so that everybody can help fixing those. Lately it seems there are more errors in the coastline than there used to be, probably because of all those people editing it to prevent problems after the ODbL changeover.

OSMCoastline is still a bit rough around the edges and the documentation also needs some work, but it I encourage everybody to check it out and send me bug reports. Once the software stabilizes a bit I plan to set up a service somewhere so that users can just download the data and don’t have to run OSMCoastline themselves.

Tags: openstreetmap · osmcoastline · osmium