Frederik<br>This is great work.  The results really look good, and the approach taken appears to be the right one.<br><br>The colour used for the sea is slightly lighter blue than that used for rivers.  At the mouth of large rivers there is a clear boundary between sea and river.  Is this desirable or should one or the other be changed so that all water is the same colour everywhere?
<br><br>80n<br><br><div><span class="gmail_quote">On 4/23/07, <b class="gmail_sendername">Frederik Ramm</b> <<a href="mailto:frederik@remote.org">frederik@remote.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>    I have just committed a t@h extension (new version name "Glencoe")<br>that creates blue sea tiles.<br><br>The algorithm is a bit complex (over 700 lines of Perl code), and if<br>anyone finds a simpler way to do it, please step forward and submit
<br>patches or redo it.<br><br>It works like this:<br><br>* If the tile being rendered has no "natural=coastline" ways, then<br>   look up the tile coordinates in a table (which is supplied as a<br>   4 MB binary file covering every single level-12 tile in the world,
<br>   thanks to Martijn for providing it!).<br><br>   o If the table says there should be water at this location, then<br>     draw an artificial "coastline" rectangle so that the tile gets<br>     rendered blue.
<br><br>   o Otherwise don't change anything. Martijn said his index is not<br>     100% complete for non-Europe parts of the world so in some cases<br>     there may be no water where there should be, but that can be
<br>     fixed by improving the index.<br><br>* If the tile being rendered has any coastline segments at all, then<br>   throw away the coastline ways, and re-arrange all the segments into<br>   one big way, connecting the loose ends coming into the visible area
<br>   from the outside or leaving the visible area, so that closed ways<br>   are formed.<br><br>   o This method requires us to know which side of a segment the water<br>     is on. We assume it is always on the right.<br>
<br>I have rendered the whole of the UK coastline with this algorithm, at<br>zoom levels 12 and smaller only, and you can inspect the results here:<br><br><a href="http://openstreetmap.gryph.de/slippymap/ukcoast.html">http://openstreetmap.gryph.de/slippymap/ukcoast.html
</a><br><br>Typical problems, which we'll have to fix over the course of the next<br>few days and weeks, are:<br><br>a) coastline drawn so that water is on the left - will show islands in<br>blue on a white background; most of the Scottish Isles suffer from that
<br>problem (shown here is Eigg):<br><br><a href="http://openstreetmap.gryph.de/slippymap/tiles/osmarender4/10/494/314.png">http://openstreetmap.gryph.de/slippymap/tiles/osmarender4/10/494/314.png</a><br><br>b) broken coastline or, especially devious, a single segment turned
<br>"against the flow", will cause unpredictable results (shown here is<br>Chepstow, where the coastline contained one single segment in the<br>wrong direction - meanwhile fixed):<br><br><a href="http://openstreetmap.gryph.de/slippymap/tiles/osmarender4/11/1008/679.png">
http://openstreetmap.gryph.de/slippymap/tiles/osmarender4/11/1008/679.png</a><br><br>c) no coastline at all will create a rough coastline (with "pixels" of<br>level-12 tile size) like this example near Norwich:<br>
<br><a href="http://openstreetmap.gryph.de/slippymap/tiles/osmarender4/9/258/167.png">http://openstreetmap.gryph.de/slippymap/tiles/osmarender4/9/258/167.png</a><br><br>I realise that in some areas this makes the slippymap uglier than it
<br>was before, but I believe the quality gain for those areas which have<br>a proper coastline outweighs that (by a lot). It should not be too<br>difficult to at least sketch a coastline from landsat where no<br>imported one exists.
<br><br>This mechanism is mainly intended for coastal or near-coastal tiles;<br>the high-level tiles are still created from the level-12 tiles using<br>bitmap operations, and thus level-7 tiles somewhere in the Atlantic<br>
will not turn blue.<br><br>We could fix that by running t@h for every ocean tile, but that would<br>add roughly 16 billion tiles to the repository (down to zoom level 17<br>for everywhere on the ocean). We do not want that. We should probably
<br>instead modify lowzoom.pl to use level 12 tiles where they exist and<br>otherwise use the same table lookup used by tilesGen.pl to determine<br>wheter an area should be blue or not. That would mean that we would<br>not normally create level 12 tiles for all-blue areas, and that
<br>zooming in from an all-blue level-11 tile will land you in nothingness<br>rather than in water, but this approach would only mean 1 million<br>extra tiles.<br><br>More on coastline here:<br><br><a href="http://wiki.openstreetmap.org/index.php/Tiles@home/Dev/Interim%20Coastline%20Sup">
http://wiki.openstreetmap.org/index.php/Tiles@home/Dev/Interim%20Coastline%20Sup</a><br>port<br><br>It is called "interim" because in the long run we might be better off<br>merging pre-created coastal tiles (which seldom change) with our OSM
<br>data. But that would require infrastructure for the ocean tile<br>repository and would also make it difficult to actually change a<br>coastline in your editor, <godmode>something that I personally find<br>important</godmode>.
<br><br>Bye<br>Frederik<br><br>--<br>Frederik Ramm  ##  eMail <a href="mailto:frederik@remote.org">frederik@remote.org</a>  ##  N49°00.09' E008°23.33'<br><br>_______________________________________________<br>dev mailing list
<br><a href="mailto:dev@openstreetmap.org">dev@openstreetmap.org</a><br><a href="http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev">http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev</a><br></blockquote>
</div><br>