[OSM-dev] coastline

Martijn van Oosterhout kleptog at gmail.com
Fri Aug 15 18:07:50 BST 2008


On Fri, Aug 15, 2008 at 6:33 AM, Rogier Wolff <R.E.Wolff at bitwizard.nl> wrote:
> If there is no theoretical limit, I often use something like:

<snip growing array code>

That concept is used already for MAX_SUBAREAS, which started out at
100 but it soon become clear that it was insufficient, I think there
are tiles >10000 subareas for example. So I added the dynamic thing
for that, and fixed some O(N^2) loops at the same time.

MAX_SEGS > 100 means that it found that the coastlines cross the edge
of the box 200 times. While not impossible it's certainly quite a bit
higher that I thought would happen in real life. Then again, as the
number of divisions gets smaller the edges get longer and so perhaps
its possible. It could be increased but I wonder how the performance
will be affected.

What is missing is an abort when it happens. Not expanding the array
and not checking for overflow is the worst of all possible ways.

Have a nice day,
-- 
Martijn van Oosterhout <kleptog at gmail.com> http://svana.org/kleptog/




More information about the dev mailing list