Thank you for the answer. When I execute this code:<br><br>&nbsp;&nbsp;&nbsp; public static void main(String[] args) throws Throwable {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Class.forName(&quot;org.postgresql.Driver&quot;).newInstance();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String sql = &quot;CREATE TABLE test (pk_0 int4 NOT NULL);&quot;;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sql += &quot;select AddGeometryColumn(&#39;test&#39;,&#39;the_geom&#39;,&#39;-1&#39;,&#39;GEOMETRY&#39;,&#39;2&#39;);&quot;;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sql += &quot;insert into test &quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; + &quot;values(3, &quot;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; + &quot;GeomFromText(&#39;LINESTRING(191232 243118,191108 243242)&#39;,-1));&quot;;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Connection c = DriverManager<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .getConnection(&quot;jdbc:postgresql://127.0.0.1/gdms/test&quot;,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;postgres&quot;, &quot;postgres&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ((PGConnection) c)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .addDataType(&quot;geometry&quot;, org.postgis.PGgeometry.class);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ((PGConnection) c).addDataType(&quot;box3d&quot;, org.postgis.PGbox3d.class);<br>
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Statement st = c.createStatement();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; st.execute(&quot;drop table test&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (SQLException e) {<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; st.execute(sql);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ResultSet rs = st.executeQuery(&quot;select * from test&quot;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rs.next();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String geom = rs.getString(2);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; JtsBinaryParser parser = new JtsBinaryParser();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Geometry g = parser.parse(geom);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Coordinate[] coords = g.getCoordinates();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (Coordinate coordinate : coords) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println(coordinate);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><br>I obtain this output:<br>(191232.0, 243118.0, 0.0)<br>(191108.0, 243242.0, 0.0)<br><br>I think I should obtain <br>(191232.0, 243118.0, NaN)<br>(191108.0, 243242.0, NaN)<br>
<br>am I wrong?<br><br><br>Fernando.<br><br><div class="gmail_quote">On Wed, Mar 5, 2008 at 12:14 PM, Mark Cave-Ayland &lt;<a href="mailto:mark.cave-ayland@siriusit.co.uk">mark.cave-ayland@siriusit.co.uk</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">On Wednesday 05 March 2008 10:13:26 Fernando González wrote:<br>

&gt; Hi,<br>
&gt;<br>
&gt; I&#39;m storing and reading some geometries from a postgis table. The table is<br>
&gt; 2D. I&#39;m using a jar I have compiled with the &quot;make postgis_jts&quot; command. It<br>
&gt; works very well except for one thing. I write 2D JTS geometries, this is<br>
&gt; with the z component equal to NaN, into a postgis table but when I read<br>
&gt; them the Z coordinate is no longer equal to NaN but equal to 0. is this a<br>
&gt; feature? a bug?<br>
&gt;<br>
&gt; I&#39;m using this code to read the geometry. To store them I use GeomFromText<br>
&gt; function and I specify only X-Y components for each coordinate (I&#39;m not<br>
&gt; specifying the Z coordinate):<br>
&gt;<br>
&gt; JtsBinaryParser parser = new JtsBinaryParser();<br>
&gt; String bytes = rs.getString(fieldId);<br>
&gt; Geometry geom = parser.parse(bytes);<br>
&gt;<br>
&gt; is it clear? I can write some code to reproduce the problem if anyone is<br>
&gt; interested.<br>
&gt;<br>
&gt; Thanks in advance,<br>
&gt; Fernando<br>
<br>
<br>
</div></div>Hi Fernando,<br>
<br>
Yes please. I may not be the person that eventually looks at this, however a<br>
reproducible test case is enormously helpful in cases like these.<br>
<br>
<br>
ATB,<br>
<br>
Mark.<br>
<br>
--<br>
<font color="#888888">Mark Cave-Ayland<br>
Sirius Corporation - The Open Source Experts<br>
<a href="http://www.siriusit.co.uk" target="_blank">http://www.siriusit.co.uk</a><br>
T: +44 870 608 0063<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</font></blockquote></div><br>