[postgis-devel] I want to add an algorithem into postgis

xschen xschen at clustertech.com
Fri Jul 31 16:19:15 PDT 2015


hello, every one.
I am a user of postgis, and  found postgis is very slow when running 
st_intersects, st_within st_contains functions on a polygon which 
contents many vertex , even has gist index on geometry.
for example: polygon A,B has ten thousands points, A is very big, B is 
very small, and B is in the center of A. that is very easy to know B 
inside A, but postgis spends sevel seconds to calculate the 
st_intersects(A,B).

I found the intersects algorithem like this:

bool intersects(geometry g1, geometry g2){
     if(!g1.getEnvelope().intersects(g2.getEnvelope())){
         return false;
     }else{
         //calculate its details
          ...
          ...
     }
}

I have an ideal to improve its performance, by calculating the 
intersects between the biggest inner circle of two geometry:

bool intersects(geometry g1, geometry g2){
     if( !g1.getEnvelope().intersects(g2.getEnvelope() ){
         return false;
     }else{
         if(g1.getInnerCircle().intersects(g2.getInnerCircle() ){  // 
"getInnerCircle()" returns the biggest circle inside the polygon
             return true;
         }else{
             //calculate its details
               ...
               ...
         }
     }
}

  each point belong to inner cricle, also belong to polygon. if inner 
circles intersect , polygons will intersect
  to judge circles intersect is very fast, so that, my algorithem can 
improve its performance.

besides, I have an amazing method to calculate the "biggest inner 
circle" of an polygon very fast , by using a complex function "magic".
the method is too diffcult to explain in email.



I am just begining to develop the postgis. I dont know its architecture, 
and I am solo.
would someone please guide me? introduce the architecture of postgis.





More information about the postgis-devel mailing list