in reply to Re: Speeding up ... (O(N) determination of point in polygon regardless of complexity)
in thread Speeding up point-in-polygon -- take two
Well, I have been thinking about it, and there are a few quibbles, and possible mods --
As noted in the solution, a single image to cover the entire country would be simply too big, and would have to be chopped up. That creates problem of juggling images in memory, as there is really no easy way to sort the points and process them in image-based batches.
The pixels in the image can be mapped to the smallest unit of the coordinate, but fractional units for a point like 1.24435, 455.22452 get all fudged up.
If I could figure out how to generate all the pixel coords for a polygon, I wouldn't even need GD. I could simply store each pixel (something akin to an INTEGER UNIQUE NOT NULL would work just fine) and its associated attribute in a Berkeley Db hash. The advantage of Bdb would be that I wouldn't have to worry about image file sizes and chunking up images as in the GD approach.
So, does anyone know of a way to generate all the coord pairs for a given polygon and a resolution?
By the way, I tested my approach posted in the OP that started this thread. Not including the data prep, it took me about 3.25 hours to update 5.25 million points against 210k polys. Nevertheless, compliments to BrowserUk for a truly innovative solution.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Speeding up ... (O(N) determination of point in polygon regardless of complexity)
by BrowserUk (Patriarch) on Aug 29, 2006 at 04:14 UTC | |
Re^3: Speeding up ... (O(N) determination of point in polygon regardless of complexity) (Bresenham)
by tye (Sage) on Aug 29, 2006 at 03:44 UTC |