OSM coastline musings
Sep. 7th, 2009 05:56 pmJust thinking aloud here. My OSM Garmin maps have ugly coastlines that are useless for detail stuff. Those coastlines are blockwise shapes that come with both the basemap and the SMC's topo. Mkgmap only generates a line for natural=coastline ways, with 'the sea is on the right, land on the left' as a usage convention. So to get perfect coastlines I need to:
In the short term, though, I can recompile the topo so it doesn't include coast. That'll help.
Update: actually, the shaded-on-one-side coastline works better than I thought it would:

- Be opaque so the basemap doesn't show through.
- Replace the SMC contours with some that don't have a coastline on them. That means using Groundtruth to get SRTM (or the new high-res) dataset then building a set of transparent IMG tiles from it for subsequent use (doing it this way means you can turn off the contours as a layer).
- Sort out Mkgmap's coastline render. Ah. Right.
- A cheesy way around it would be to style a line that's hashed on one side, but that's not attractive. We want an expanse of blue for the briny. Plus, to work the line would have to be thick and that'd break badly when exposed to the fractal horror that is real coast.
- Not quite so cheesy would be to do a special shapefile export at multiple zoom levels from the OSM planet file, which is how the main slippymap does it; it runs once a month or so to catch updates in what is a very slowly-updating data type. You could then incorporate that as an IMG using Sendmap.
- Mkgmap would ideally do a coastline processing run at some point early in its run (the land/sea divide being a fundamental type of landuse, after all)). Land should be left alone. Sea should be painted in. Sea is limited to 250-point polygons by the Garmin format. So we could start at the beginning of each natural=coastline way, scrobble along it for N points, then come away from the coast by a distance and scrobble back, effectively painting a fat blue worm around the coast, the same way a child would colour it in. That brings two new issues:
- The 'by a distance' value (the worm's fatness) cannot cross another coastline way. Ideally it would be, say, 55% of the distance, so that the opposing fat worm and it overlapped nicely.
- We need to then block in the gaps between worms, ad infinitum to the edge of the map. But the worms are not real objects! Aiee...
- Perhaps slice the map into strips. Each strip is a rectangle with one complicated side, so 240-odd points plus the regular corners. From the edge of the map, scan along coastline ... and get caught out with islands and hooky bits creating shadows. No, that's not going to work.
- What less human approaches might work?
In the short term, though, I can recompile the topo so it doesn't include coast. That'll help.
Update: actually, the shaded-on-one-side coastline works better than I thought it would:
