[postgis-users] a long time calculate distance between point and polygon

Francisco Salas fsalas at pinar.geocuba.cu
Mon Dec 10 06:46:44 PST 2012


Hi, Nicklas , I used this 
select * from pozos p,suelos s where ST_DWithin(p.the_geom,s.the_geom,1000)

but in the output panel Messages of the pgAdmin III , appear only this
around 22011 ms 
********** Error **********

How  I can determinate what's is the problems ?

Regards,
Francisco Salas 

-----Mensaje original-----
De: postgis-users-bounces at lists.osgeo.org
[mailto:postgis-users-bounces at lists.osgeo.org] En nombre de Nicklas Avén
Enviado el: miércoles, 05 de diciembre de 2012 04:45 p.m.
Para: PostGIS Users Discussion
Asunto: Re: [postgis-users] a long time calculate distance between point and
polygon

Hallo

You should use ST_DWithin instead with gist index on your gometry/geography
column:

select * from pozos p,suelos s where
ST_DWithin(p.the_geom,s.the_geom,1000)


HTH

Nicklas



On Wed, 2012-12-05 at 16:32 -0500, Francisco Salas wrote:
> Hi,
> 
> I have test in two database one with SRID 2085 an other 4326 use this 
> sql
> 
> pozos : 2339 rows
> 
> suelos:1526 rows
> 
> for 2085 :   
> 
> select * from pozos p,suelos s where
> st_distance(p.the_geom,s.the_geom)
> 
> <=1000
> 
> time of result : 3 minutes aprox    
> 
>  
> 
> for 4326 :   
> 
> select * from pozos p,suelos s where
> st_distance(p.the_geom,s.the_geom,true)
> 
> <=1000
> 
> time of result : not determined   
> 
> Why happen this problem?  
> 
> How I can optimize this?  
> 
> I am using PostGis 1.5.2
> 
>  
> 
> Regards,
> 
>  
> 
> Francisco Salas
> 
>  
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



More information about the postgis-users mailing list