<DIV>Hi.</DIV>  <DIV>I sae the code and tried to execute it on my own tables.Ther were some problems:</DIV>  <DIV>First when trying to add data types it would give me a warning that the method addDataType has been deprecated.</DIV>  <DIV>Also when I tried to cast to PGeometry&nbsp; it would throw "ClassCastException".Here is my code:</DIV>  <DIV>&nbsp;</DIV>  <DIV><FONT face=courier color=#0000bf size=1>((PGConnection)conn).addDataType("geometry","org.postgis.PGgeometry");<BR></FONT></DIV>  <DIV><FONT face=courier color=#0000bf>Statement s = conn.createStatement();&nbsp;<BR>ResultSet r = s.executeQuery("select center(geometry)as mycenter from land");&nbsp;<BR></FONT></DIV>  <DIV><FONT face=courier color=#0000bf>while( r.next() ) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PGgeometry mycenter = (PGgeometry)r.getObject(1); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(mycenter.toString()); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }</FONT></DIV>  <DIV>&nbsp;</DIV>  <DIV>I have a table called "land" which has an attribute "geometry" of type Circle.I want to retreive the center of the circle which is of type "Point".</DIV>  <DIV>Have I casted wrong? I also tried casting to "Point" but it would give the same exception. What should I do?</DIV>  <DIV>&nbsp;</DIV>  <DIV><BR><BR><B><I>Emily Gouge &lt;egouge@refractions.net&gt;</I></B> wrote:</DIV>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Hi,<BR><BR>There is some documentation and an example on connecting to PostGIS using Java. See:<BR>http://postgis.refractions.net/docs/ch04.html#id2789526<BR><BR>You can add a datatype to the postgres connection and then the getObject() call will return a <BR>PGGeometry object:<BR>((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");<BR><BR>Additionally you can also check out the postgis_jts jar, which provides the ability to return a
 <BR>JtsGeometry object (and subsequently to convert this object to a JTS Geometry object).<BR><BR>Emily<BR><BR><BR><BR>Fatemeh Abbasinejad wrote:<BR>&gt; I am new to PostGIS. Does anyone know how we can retrieve our defined data types <BR>&gt; (like point,circle,...) from a ResultSet in java. I used getObject but it didn't work. <BR>&gt; -fatemeh<BR>&gt; <BR>&gt; <BR>&gt; ---------------------------------<BR>&gt; Bring words and photos together (easily) with<BR>&gt; PhotoMail - it's free and works with Yahoo! Mail.<BR>&gt; <BR>&gt; <BR>&gt; ------------------------------------------------------------------------<BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; postgis-users mailing list<BR>&gt; postgis-users@postgis.refractions.net<BR>&gt; http://postgis.refractions.net/mailman/listinfo/postgis-users<BR><BR>_______________________________________________<BR>postgis-users mailing
 list<BR>postgis-users@postgis.refractions.net<BR>http://postgis.refractions.net/mailman/listinfo/postgis-users<BR></BLOCKQUOTE>  <DIV><BR></DIV><p>
                <hr size=1> <BR> 
What are the most popular cars? Find out at <a href="http://us.rd.yahoo.com/evt=38382/_ylc=X3oDMTEzNWFva2Y2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDMmF1dG9z/*http://autos.yahoo.com/newcars/popular/thisweek.html 
">Yahoo! Autos</a>