<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.28.3">
</HEAD>
<BODY>
It seems like m and z snapping is implemented  at the "version 4" (in doc) of the function, when a point is used to define the origin of the grid cell. Bu tin the more common ST_Snaptogrid(geometry, size_of_grid) there is no snapping to m and z.<BR>
<BR>
In lwgeom_functions_analytic.c there is a comment on line 790<BR>
<BR>
        /* Do not support gridding Z and M values for now */<BR>
        grid.ipz=grid.ipm=grid.zsize=grid.msize=0;<BR>
<BR>
<BR>
The problem now if we want those other version to also snap z and m is that we will have to mess up the order of arguments in some way.<BR>
<BR>
In the documentation<BR>
<A HREF="http://postgis.org/documentation/manual-1.5/ST_SnapToGrid.html">http://postgis.org/documentation/manual-1.5/ST_SnapToGrid.html</A><BR>
<BR>
The version of the ordinary snaptogrid function with all arguments <BR>
have this form:<BR>
<B><TT>ST_SnapToGrid</TT></B><TT>(</TT>geometry <TT>geomA</TT>, float <TT>originX</TT>, float <TT>originY</TT>, float <TT>sizeX</TT>, float <TT>sizeY)</TT>;<BR>
<BR>
so, where to put z and m arguments?<BR>
to not change the old ones we have to put them in the end. But to follow the form from before we out to have the originZ and originM before, sizeX<BR>
<BR>
Any ideas?<BR>
<BR>
/Nicklas<BR>
<BR>
<BR>
<BR>
<BR>
On Mon, 2010-10-18 at 17:39 +0200, strk wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On Mon, Oct 18, 2010 at 03:42:58PM +0200, Nicklas Avén wrote:
> Hallo Sandro

> I was about to do the same a few weeks ago when I realized that
> snaptogrid is only workin in 2 dimensions now. 

> I think we said then we should open up for the third dimension in
> snaptogrid to. As I understand it it is all prepared (you are the author
> aren't you :-)  ). I have not looked at it since the discussion on the
> list a few weeks ago, but maybe it is easier and faster for you to open
> up for 3D snapping. 

Seems like done already, from postgis.sql.in.c:

-- SnapToGrid(input, point_offsets, xsize, ysize, zsize, msize)
-- Availability: 1.2.2                                                          CREATE OR REPLACE FUNCTION ST_SnapToGrid(geometry, geometry, float8, float8, float8, float8) AS 'MODULE_PATHNAME', 'LWGEOM_snaptogrid_pointoff'
        LANGUAGE 'C' IMMUTABLE STRICT;

Does up to 4d..

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   <A HREF="http://strk.keybit.net/services.html">http://strk.keybit.net/services.html</A>
_______________________________________________
postgis-devel mailing list
<A HREF="mailto:postgis-devel@postgis.refractions.net">postgis-devel@postgis.refractions.net</A>
<A HREF="http://postgis.refractions.net/mailman/listinfo/postgis-devel">http://postgis.refractions.net/mailman/listinfo/postgis-devel</A>

</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>