logo separator

[mkgmap-dev] Algorithm for rendering sea

From Christian Gawron christian.gawron at googlemail.com on Wed Aug 26 15:23:16 BST 2009

Dear Clifford,

in the standard case, the algorithm does the following:
- Generate a background sea rectangle which covers the bounding box of 
the map
- Connect the coastline segments wherever possible. The resulting 
segments should be either closed (= islands) or hit the boundary.
- Build a multipolygon relation with
    - the background as outer element,
    - the islands as inner elements,
    - additional inner elements which are built from the coastline 
segments hitting the boundary by connecting them along the boundary.

The multipolygon relation then describes the sea with "holes" for the land.

Unfortunately, sometimes there are non-closed coastline segments not 
hitting the boundary (e.g. in the country extracts from geofabrik the 
shore ends at the country border which usually does not coincide with 
the bounding box).

Best wishes

Clifford Nolan schrieb:
> I was wondering how the sea is generated in those recent sea polygon 
> patches.  Since I don't understand Java I haven't a clue!   Even so, I 
> was thinking of what might be a reasonable way to do it.
> If there is coastline present within the bounding box then rapidly 
> "grow" the coastline from the bounding box until you are close to 
> coastline.  Then grow the coastline more slowly (smaller overlapping 
> polygons).  At this  point maybe a test could be done to see if a closed 
> coastline way will end up completely inside a proposed polygon and if it 
> will it's time to make the polygons (temporarily) smaller.  In this way 
> the sea should end up "shrink wrapping" itself around land.
> Maybe it's already done in a way like this  but as I say I wouldn't know.
> I also thought it might be an idea to build a "convex hull" of the 
> coastline whereby a a rough outline of the coast is built first so that 
> all land lies on one side of this outline.  This could be done by 
> sampling the coast and checking no lines joining pairs of coastline 
> points intersect with another coastline point (which would mean the 
> possibility of coastline on both sides of the line segment).  That could 
> be a way to rapidly fill in most of the sea area.
> All the best,
> Cliff
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

More information about the mkgmap-dev mailing list