[postgis-users] snaptogrid() function

Kevin Neufeld kneufeld at refractions.net
Wed Jun 25 15:13:09 PDT 2008


An example query using ST_SnapToGrid() would be:

UPDATE mytable
   SET the_geom = ST_SnapToGrid(the_geom, 0.001);

This query will "snap" your geometries to a precision grid of 10^-3.

The other variants are the same thing, but allow you to specify an 
offset origin other than the default of 0,0.

Ie.
The above query is the same as doing:

UPDATE mytable
   SET the_geom = ST_SnapToGrid(the_geom, 0, 0, 0.001, 0.001);

Because this function employs this "offset to origin" concept, care 
should be taken if you actually want to use this function to reduce the 
precision of your geometries.

Refer to this thread:
http://postgis.refractions.net/pipermail/postgis-users/2008-May/019651.html

In the future, I see us leaving this method, but adding an 
ST_PrecisionReducer() method.

Cheers,
Kevin


muhammad imran wrote:
> Dear All,
> Can any body share any helping material e.g manual documents, notes, code , exampls etc  for snapttogrid()function for postGIS. concepts of snaping, limitations etc things to do for next version regarding snaping.
> Kind Regards
> imran
> 
> 
>       
> _______________________________________________
> 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