<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=556583214-14052007><FONT face=Arial size=2>I just noticed a 
couple of minor things in the jdbc documentation in the postgis manual.  
I'm a bit rusty on my java programming so I will just pose these as 
possible errors.</FONT></SPAN></DIV>
<DIV><SPAN class=556583214-14052007><FONT face=Arial 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=556583214-14052007><FONT face=Arial size=2><A 
href="http://postgis.refractions.net/docs/ch04.html#id3032239">http://postgis.refractions.net/docs/ch04.html#id3032239</A></FONT></SPAN></DIV>
<DIV><SPAN class=556583214-14052007><FONT face=Arial 
size=2>------------------------------------</FONT></SPAN></DIV>
<DIV><SPAN class=556583214-14052007><PRE class=programlisting>Potential issue/error</PRE><PRE class=programlisting>ResultSet r = s.executeQuery("select
      <STRONG>AsText(geom)</STRONG> as geom,id from geomtable"); while( r.next() ) { /* *
      Retrieve the geometry as an object then cast it to the geometry type. *
      Print things out. */ PGgeometry geom = (PGgeometry)r.getObject(1);</PRE><PRE class=programlisting>----</PRE><PRE class=programlisting>Wouldn't it have been more efficient to just not bother casting this as text before you pull it and does the above really work?</PRE><PRE class=programlisting>Shouldn't it be.</PRE><PRE class=programlisting>ResultSet r = s.executeQuery("select
      <STRONG>geom</STRONG>,id from geomtable"); while( r.next() ) { /* *
      Retrieve the geometry as an object then cast it to the geometry type. *
      Print things out. */ PGgeometry geom = (PGgeometry)r.getObject(1);</PRE><PRE class=programlisting>rather than first converting it to text and then converting back to an object?</PRE><PRE class=programlisting>---</PRE><PRE class=programlisting>Potential issue/error 2</PRE><PRE class=programlisting><PRE class=programlisting>PGgeometry geom = (PGgeometry)r.getObject(1); if(
      geom.getType() = Geometry.POLYGON ) { Polygon pl =
      (Polygon)geom.getGeometry(); for( int r = 0; r < pl.numRings(); r++
      ) { LinearRing rng = pl.getRing(r); System.out.println("Ring: "
      + r); for( int p = 0; p < rng.numPoints(); p++ ) { Point pt =
      rng.getPoint(p); System.out.println("Point: " + p);
      System.out.println(pt.toString()); } } }</PRE><PRE class=programlisting> </PRE><PRE class=programlisting>--</PRE><PRE class=programlisting> </PRE><PRE class=programlisting>Shouldn't that be ==</PRE><PRE class=programlisting> </PRE><PRE class=programlisting>PGgeometry geom = (PGgeometry)r.getObject(1); if(
      geom.getType() == Geometry.POLYGON ) { Polygon pl =
      (Polygon)geom.getGeometry(); for( int r = 0; r < pl.numRings(); r++
      ) { LinearRing rng = pl.getRing(r); System.out.println("Ring: "
      + r); for( int p = 0; p < rng.numPoints(); p++ ) { Point pt =
      rng.getPoint(p); System.out.println("Point: " + p);
      System.out.println(pt.toString()); } } }</PRE></PRE><PRE class=programlisting> </PRE></SPAN></DIV>
<DIV><SPAN class=556583214-14052007><FONT face=Arial 
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=556583214-14052007><FONT face=Arial 
size=2></FONT></SPAN> </DIV></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>