<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7653.38">
<TITLE>RE: [geos-devel] C API coordinate sequence dimensions</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>I looked at the GEOS code a while back and compared to JTS and<BR>
was shocked that I saw GEOS z (as I call it smurf code and did not see<BR>
this smurf code in JTS).<BR>
<BR>
This was when I was testing the PostGIS functions for 3D support assuming all GEOS functions should be 2D and to my shock they seemed to do something with Z.<BR>
<BR>
I'm pretty sure at the very least that ST_ConvexHull, ST_Union Z support<BR>
is coming straight from GEOS.&nbsp; Haven't verified ST_Difference.<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: geos-devel-bounces@lists.osgeo.org on behalf of Sean Gillies<BR>
Sent: Mon 1/12/2009 2:37 PM<BR>
To: GEOS Development List<BR>
Subject: Re: [geos-devel] C API coordinate sequence dimensions<BR>
<BR>
Thanks, Regina, that hints that the supporting GEOS C API functions&nbsp;<BR>
might be considering z, but then again, the 3D might be implemented in&nbsp;<BR>
the PostGIS lib.<BR>
<BR>
On Jan 12, 2009, at 12:18 PM, Obe, Regina wrote:<BR>
<BR>
&gt; A lot of these are catalogued here<BR>
&gt;<BR>
&gt; <A HREF="http://postgis.refractions.net/documentation/manual-svn/ch08.html#id2671967">http://postgis.refractions.net/documentation/manual-svn/ch08.html#id2671967</A><BR>
&gt;<BR>
&gt; and<BR>
&gt;&nbsp; ST_Union and I just discovered even ST_BuildArea.<BR>
&gt;<BR>
&gt; ST_ConvexHull (but that in my opinion gives goofy results).<BR>
&gt;<BR>
&gt;<BR>
&gt; Though still debating how to describe that their results are&nbsp;<BR>
&gt; debateable.<BR>
&gt;<BR>
&gt; Also ST_BuildArea seems to hmm do a 2D and then tack on the Z so I&nbsp;<BR>
&gt; guess I should add that to the list.&nbsp; Simon tested this out when he&nbsp;<BR>
&gt; was doing this write up and to my shock it sort of preserved 3D&nbsp;<BR>
&gt; though I would say incorrectly.&nbsp; Any rate I don't think he has that&nbsp;<BR>
&gt; here, but still an interesting read<BR>
&gt;<BR>
&gt; <A HREF="http://www.spatialdbadvisor.com/postgis_tips_tricks">http://www.spatialdbadvisor.com/postgis_tips_tricks</A><BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; -----Original Message-----<BR>
&gt; From: geos-devel-bounces@lists.osgeo.org on behalf of Sean Gillies<BR>
&gt; Sent: Mon 1/12/2009 2:00 PM<BR>
&gt; To: GEOS Development List<BR>
&gt; Subject: Re: [geos-devel] C API coordinate sequence dimensions<BR>
&gt;<BR>
&gt; Ah, I didn't know this. Which ones?<BR>
&gt;<BR>
&gt; On Jan 12, 2009, at 11:40 AM, Paul Ramsey wrote:<BR>
&gt;<BR>
&gt; &gt; Not all operations are 2D, just 99% of them. Some of the overlay ops<BR>
&gt; &gt; try to compute &quot;correct&quot; derived Z-values.<BR>
&gt; &gt;<BR>
&gt; &gt; P<BR>
&gt; &gt;<BR>
&gt; &gt; On Jan 12, 2009, at 10:04 AM, Sean Gillies wrote:<BR>
&gt; &gt;<BR>
&gt; &gt;&gt; So, the dimension argument in GEOSCoordSeq_create is ignored unless<BR>
&gt; &gt;&gt; the active sequence implementation takes dimensions other than 3?<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Why is GEOS's default sequence 3D when all operations are 2D?<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; Sean<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; On Jan 12, 2009, at 10:56 AM, Martin Davis wrote:<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt;&gt; Actually JTS implements this correctly.&nbsp; The return value from<BR>
&gt; &gt;&gt;&gt; getDimension is computed by the implementation of<BR>
&gt; &gt;&gt;&gt; CoordinateSequence.&nbsp; In the case of DefaultCoordinateSequence<BR>
&gt; &gt;&gt;&gt; (which by the way is deprecated and replaced by<BR>
&gt; &gt;&gt;&gt; CoordinateArraySequence) the value is alway 3, since the<BR>
&gt; &gt;&gt;&gt; Coordinate representation used by these sequences always allows<BR>
&gt; &gt;&gt;&gt; for 3 ordinates.<BR>
&gt; &gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt; In the case of PackedCoordinateSequence the dimension can be<BR>
&gt; &gt;&gt;&gt; selected on creation, and this is the value that is returned by<BR>
&gt; &gt;&gt;&gt; getDimension.<BR>
&gt; &gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt; Sanak wrote:<BR>
&gt; &gt;&gt;&gt;&gt; Hi list,<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt; I don't know that this is a known bug, but<BR>
&gt; &gt;&gt;&gt;&gt; CoordinateArraySequence.getDimension() method always return 3.<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt; [trunk/source/headers/geos/geom/CoordinateArraySequence.h - line<BR>
&gt; &gt;&gt;&gt;&gt; 88]<BR>
&gt; &gt;&gt;&gt;&gt; size_t getDimension() const { return 3; }<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt; JTS(JTS Topology Suite) seems to be also the same.<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt; [jts/src/com/vividsolutions/jts/geom/<BR>
&gt; &gt;&gt;&gt;&gt; DefaultCoordinateSequence.java - line 95]<BR>
&gt; &gt;&gt;&gt;&gt; public int getDimension() { return 3; }<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt; I don't know that this is a specification or not...<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt; Regards,<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt; Sanak.<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt; 2009/1/12 Sean Gillies &lt;sgillies@frii.com<BR>
&gt; &gt;&gt;&gt;&gt; &lt;<A HREF="mailto:sgillies@frii.com">mailto:sgillies@frii.com</A>&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; I'm finding that GEOSCoordSeq_getDimensions returns 3 no matter<BR>
&gt; &gt;&gt;&gt;&gt; what<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp;&nbsp; # Accessing libgeos_c via Python ctypes<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp;&nbsp; &gt;&gt;&gt; s = lgeos.GEOSCoordSeq_create(2, 2)<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp;&nbsp; &gt;&gt;&gt; ndim = c_int()<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp;&nbsp; &gt;&gt;&gt; lgeos.GEOSCoordSeq_getDimensions(s, byref(ndim))<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp;&nbsp; 1<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp;&nbsp; &gt;&gt;&gt; ndim<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp;&nbsp; c_long(3)<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; Is this a known bug? Looks like we're only testing creation of&nbsp;<BR>
&gt; 3D<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; coordinate sequences in<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; <A HREF="http://trac.osgeo.org/geos/browser/trunk/tests/unit/capi/GEOSCoordSeqTest.cpp">http://trac.osgeo.org/geos/browser/trunk/tests/unit/capi/GEOSCoordSeqTest.cpp</A><BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; --<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; Sean Gillies<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; <A HREF="http://sgillies.net">http://sgillies.net</A><BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; _______________________________________________<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; geos-devel mailing list<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; geos-devel@lists.osgeo.org &lt;<A HREF="mailto:geos-devel@lists.osgeo.org">mailto:geos-devel@lists.osgeo.org</A>&gt;<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp; <A HREF="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</A><BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt;&nbsp;<BR>
&gt; ------------------------------------------------------------------------<BR>
&gt; &gt;&gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt;&gt; _______________________________________________<BR>
&gt; &gt;&gt;&gt;&gt; geos-devel mailing list<BR>
&gt; &gt;&gt;&gt;&gt; geos-devel@lists.osgeo.org<BR>
&gt; &gt;&gt;&gt;&gt; <A HREF="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</A><BR>
&gt; &gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt; --<BR>
&gt; &gt;&gt;&gt; Martin Davis<BR>
&gt; &gt;&gt;&gt; Senior Technical Architect<BR>
&gt; &gt;&gt;&gt; Refractions Research, Inc.<BR>
&gt; &gt;&gt;&gt; (250) 383-3022<BR>
&gt; &gt;&gt;&gt;<BR>
&gt; &gt;&gt;&gt; _______________________________________________<BR>
&gt; &gt;&gt;&gt; geos-devel mailing list<BR>
&gt; &gt;&gt;&gt; geos-devel@lists.osgeo.org<BR>
&gt; &gt;&gt;&gt; <A HREF="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</A><BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; --<BR>
&gt; &gt;&gt; Sean Gillies<BR>
&gt; &gt;&gt; sean.gillies@gmail.com<BR>
&gt; &gt;&gt; <A HREF="http://sgillies.net">http://sgillies.net</A><BR>
&gt; &gt;&gt;<BR>
&gt; &gt;&gt; _______________________________________________<BR>
&gt; &gt;&gt; geos-devel mailing list<BR>
&gt; &gt;&gt; geos-devel@lists.osgeo.org<BR>
&gt; &gt;&gt; <A HREF="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</A><BR>
&gt; &gt;<BR>
&gt; &gt;<BR>
&gt; &gt; --<BR>
&gt; &gt; Paul Ramsey<BR>
&gt; &gt; pramsey@cleverelephant.ca<BR>
&gt; &gt; +1 250 885 0632<BR>
&gt; &gt;<BR>
&gt; &gt; _______________________________________________<BR>
&gt; &gt; geos-devel mailing list<BR>
&gt; &gt; geos-devel@lists.osgeo.org<BR>
&gt; &gt; <A HREF="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</A><BR>
&gt;<BR>
&gt; _______________________________________________<BR>
&gt; geos-devel mailing list<BR>
&gt; geos-devel@lists.osgeo.org<BR>
&gt; <A HREF="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</A><BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; The substance of this message, including any attachments, may be&nbsp;<BR>
&gt; confidential, legally privileged and/or exempt from disclosure&nbsp;<BR>
&gt; pursuant to Massachusetts law. It is intended solely for the&nbsp;<BR>
&gt; addressee. If you received this in error, please contact the sender&nbsp;<BR>
&gt; and delete the material from any computer.<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; Help make the earth a greener place. If at all possible resist&nbsp;<BR>
&gt; printing this email and join us in saving paper.<BR>
&gt;<BR>
&gt; _______________________________________________<BR>
&gt; geos-devel mailing list<BR>
&gt; geos-devel@lists.osgeo.org<BR>
&gt; <A HREF="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</A><BR>
<BR>
_______________________________________________<BR>
geos-devel mailing list<BR>
geos-devel@lists.osgeo.org<BR>
<A HREF="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</A><BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>

<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>