Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Speeding up point-in-polygon -- take two

by punkish (Priest)
on Aug 28, 2006 at 04:16 UTC ( #569929=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
        CREATE TABLE polys (
          id   INTEGER PRIMARY KEY,
        CREATE INDEX ix_polys ON polys (xmin, ymin, xmax, ymax)
        CREATE INDEX ix_points ON points (x, y)
  2. or download this
        SELECT, py.n, py.ar_x, py.ar_y,, pt.x, pt.y 
        FROM polys py JOIN points pt ON 
          (py.xmin < pt.x AND py.ymin < pt.y AND py.xmax > pt.x AND py.yma
    +x > pt.y) 
        WHERE = ?
  3. or download this
        UPDATE points SET name = ? WHERE id IN (?)
  4. or download this
    sub _pointIsInPolygon {
      my ($a_point, $n, $a_x, $a_y) = @_;
      return $side ? 1 : 0;
  5. or download this
    processed 100000 polys, updated 2948276 points 
    Total time: 8451 wallclock secs (6340.54 usr + 200.52 sys = 6541.06 CP

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://569929]
Approved by imp
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2015-10-09 05:54 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (233 votes), past polls