<br><font size=2><tt>> SELECT * FROM <points table><br>
> WHERE the_geom && <polygon><br>
> AND PointInPolygon(prepareForPIP(<polygon>),
the_geom);<br>
> <br>
> Basically, you need to write two functions:<br>
> <br>
> 1. something that takes a postgis (or WKB) polygon and returns<br>
> a structure thats makes it very easy to do Point-In-Polygon
tests.<br>
> Typically this builds a spatial index on the vertex-to-vertex
edges<br>
> that makes up the polygon. The hard part is that
the structure has<br>
> to be in its 'serializable' form [This means (1) dont
use true<br>
> pointers - you have to use offsets and (2) the structure
has to be<br>
> continuous in memory].</tt></font>
<br>
<br><font size=2><tt>I don't understand all of your caveats here, but I
assume PointInPolygon(box2d(<polygon>), the_geom doesn't cut it.</tt></font>