[postgis-users] simplify() on lat/lon data

David Blasby dblasby at refractions.net
Fri May 21 10:20:51 PDT 2004


Tyler Mitchell wrote:

>>Theres distance-on-ellipse calculations already available in postgis - 
>>see postgis_proj.c.
>>You can call distance_ellipse() to give the distance-on-ellipse or you
> 
> 
> Do you mean distance_ellipsoid which is available in pg through 
> distance_spheroid?
> 
> 
>>can call distance_sphere_method() which is much faster but less 
>>accurate.  For distances in the "few meters" range, I recommend the 
>>distance_sphere_method() - see the documentation for how it works.
> 
> 


Tyler,

I'm talking about changing the actual "C" code for the simplify function 
that strk wrote.  I miss-read strk's email and thought he was talking 
about the "distance_pt_pt()" function instead of "distance_pt_seg()" - 
the distance_ellipsoid() isnt going to help you.  Sorry for the 
confusion - ignore everything I said.

 > What's a valid value for "spheroid"?

Just create one - the definition is in postgis.h.

 >>REMEMBER: the lat/lot number have to be in radians (i.e. *M_PI/180.0).
 >
 >
 > *M_PI ?

To convert a "normal" degrees number (like -120.4 degrees) to radians, 
you multiply by PI and divide by 180:

     -120.4  * PI / 180

In "C" this looks like this:

    -120.4   * M_PI/180.0

M_PI is defined in math.h to be the value of PI - 3.14...

dave




More information about the postgis-users mailing list