[postgis-devel] Optimizing contains/within
Chris Hodgson
chodgson at refractions.net
Fri Jul 27 09:22:14 PDT 2007
Robert W. Burgholzer wrote:
> Chris/others,
> Can't you simply use function overloading, such as the following
(don't know if
> geometry[] is really the proper way to indicate and array of geometries):
>
> CREATE FUNCTION contains(geometry[],geometry[])
> RETURNS boolean
> AS 'C:/Program Files/PostgreSQL/8.2/lib/liblwgeom.dll'
> LANGUAGE 'C' IMMUTABLE STRICT; -- WITH (isstrict,iscachable);
>
> to avoid the confusion that would arise from having to create a separate
> function like "points_in_polys"?
>
> r.b.
I suppose you could, but that doesn't solve the problem of dealing with
the 2d array of results that the function would have to return. Ie. for
every pair of geometries in the inputs, does the left contain the right?
Thats a lot of answers out of one function, and you can't use it in a
"normal" query to get other columns of information included in the
result. All in all it isn't really a realistic option, but is the only
alternative I could think of to the somewhat more complicated (and
apparently already implemented) second solution I mentioned.
Chris
More information about the postgis-devel
mailing list