[postgis-users] Re: geos based spatial queries

Thomas, Cord cthomas at rand.org
Mon Nov 24 20:36:05 PST 2003


I have seen this discussed in previous posts, so maybe i am repeating the obvious, but isnt/shouldnt there be a way to do a first-level filter on the mbr of the country border which should be a much quicker spatial comparison?  

unless this is a wildly contorted country boundary (which the us is not), then i would imagine this first-level filter would also be very helpful.  The only way it would not be is if all the points represent near-coastal features.

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net]On Behalf Of
Martin Davis
Sent: Monday, November 24, 2003 4:40 PM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] Re: geos based spatial queries


When we get JTS (& GEOS) spatial predicates properly optimized this might speed up substantially.  The goal is to cache topological information for the test geometry involved in comparisons.  JTS contains code that is specially designed to perform point-in-polygon tests efficiently (better than the GIST index would).  The trick is to get it in place so it can be invoked appropriately.  

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040 - Local 308      Fax: (250) 385 6046



> -----Original Message-----
> From: David Blasby [mailto:dblasby at refractions.net]
> Sent: Monday, November 24, 2003 3:02 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Re: geos based spatial queries
> 
> 
> Peter Aberline wrote:
> > I'm currently trying to do a selection using the Query 2 
> syntax from the
> > points table that fall within the US coastline, represented 
> by a 950000
> > vertex polygon. The query is selecting from the same points 
> table (1.6
> > million records). There are GIST indexes on both table's 
> geometry cols, and
> > I'm expecting only a couple of hundred points to fall 
> outside the border.
> > This query is performing very, very slowly - it's been 
> going for over 48
> > hours now! Does anyone have any idea of why this is taking 
> so long? Is
> > query time using "distance" a factor of both the area and number of
> > vertices in the containing polygon?
> 
> This is taking long because its probably doing 1.6 million 
> point-in-polygon operations.
> 
> 
> Your polygon is also very large (1 million vertexes).
> 
> So, its doing 1.6 million * 1 million operations!
> 
> 
> The easiest way to fix this is to break your "continent" in 
> to a large 
> number of smaller polygons.
> 
> 
> But, you are still going to be doing about 1.6 million 
> point-in-polygons.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list