<DIV>Hi</DIV> <DIV> I tried what you did but the program wouln't even compile. I have a table named "land" which has an attribute"geometry" of type "circle". I want to retrieve the center of the circle which is of type "point" as defined by postGIS.Here is my Program</DIV> <DIV> </DIV> <DIV><FONT face=courier color=#0000bf>import java.sql.*;<BR>import org.postgis.*;</FONT></DIV> <DIV><FONT face=courier color=#0000bf>public class JavaGIS3 { <BR> public static void main(String[] args) <BR> { <BR> java.sql.Connection conn; <BR> try <BR> { <BR> Class.forName("org.postgresql.Driver"); <BR> String url = "jdbc:postgresql://localhost:5432/dcmms"; <BR> conn = DriverManager.getConnection(url, "postgres", "abcde"); <BR> Statement s = conn.createStatement(); <BR>
ResultSet rs = s.executeQuery("select (center(geometry))as mycenter from land"); <BR> ResultSetMetaData rsmd = rs.getMetaData();<BR> for(int i=0;rs.next();i++){<BR> Geometry geometry = new BinaryParser().parse(rs.getBytes(1));<BR> if(geometry.getType()==geometry.POINT){<BR> System.out.println("Finally retrieved geometry object!")<BR> }<BR> }<BR> s.close(); <BR> conn.close(); <BR> } <BR> catch( Exception e ) <BR> { <BR> e.printStackTrace(); <BR> }<BR> }<BR>}</FONT></DIV> <div><FONT face=courier color=#0000bf></FONT> </div> <div><FONT
face=courier color=#0000bf><FONT size=2></FONT></FONT> </div> <div><FONT><FONT face=arial size=2>I did what you had said in your email but it would give an error:</FONT></FONT></div><FONT color=#ff0000 size=2> <div>BinaryParser cannot be resolved to a type</div></FONT> <div><FONT face=courier color=#0000bf><FONT size=2></FONT></FONT> </div> <div><FONT face=courier color=#0000bf><FONT face=Arial color=#000000 size=2>What should I do? Did you compile your program?</FONT></div> <DIV><BR></FONT><B><I>"Gilbert, Antoine" <AGilbert@korem.com></I></B> wrote:</DIV> <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"> <META content="Microsoft Word 11 (filtered)" name=Generator> <STYLE> <!-- /* Font Definitions */ @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:12.0pt;
font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:blue; text-decoration:underline;} p {margin-right:0cm; margin-left:0cm; font-size:12.0pt; font-family:"Times New Roman";} span.EmailStyle18 {font-family:Arial; color:navy;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </STYLE> <DIV class=Section1> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hi</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Here is my example using postgis_1_0_0.jar</SPAN></FONT></div> <div class=MsoNormal><FONT
face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Connection connection = TestUtils.getTestConnection();</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> Statement stmt = connection.createStatement();</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> ResultSet rs = stmt.executeQuery("select AsBinary(geom) as geom from \"rue_test_polyline\"");</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">
ResultSetMetaData rsmd = rs.getMetaData();</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> for(int i=0;rs.next();i++){</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> Geometry geometry = new BinaryParser().parse(rs.getBytes(1));</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> if(geometry.getType()==geometry.MULTILINESTRING){</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY:
Arial"> MultiLineString multiline = ((MultiLineString)geometry);</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> System.out.println(multiline.toString());</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> System.out.println("ligne "+i+" contient "+multiline.numLines()+" segment(s)");</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> for(int
j=0;j<multiline.numLines();j++)</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> System.out.println(" segment "+j+":"+multiline.getLine(j).numPoints()+" points");</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> }</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> }</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">
stmt.close();</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"> connection.close();</SPAN></FONT></div> <div class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </div> <DIV> <DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> <HR tabIndex=-1 align=center width="100%" SIZE=2> </SPAN></FONT></DIV> <div class=MsoNormal><B><FONT face=Tahoma size=2><SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Fatemeh Abbasinejad [mailto:fabbasinejad@yahoo.com] <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> January 30, 2006 3:43 AM<BR><B><SPAN style="FONT-WEIGHT:
bold">To:</SPAN></B> postgis-users@postgis.refractions.net<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> [postgis-users] JAVA and post GIS</SPAN></FONT></div></DIV> <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </div> <DIV id=RTEContent> <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">I am new to PostGIS. Does anyone know how we can retrieve our defined data types <BR>(like point,circle,...) from a ResultSet in java. I used getObject but it didn't work. </SPAN></FONT></div></DIV> <DIV> <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">-fatemeh</SPAN></FONT></div></DIV> <DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt"> <HR align=center width="100%" SIZE=1> </SPAN></FONT></DIV> <div class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Bring words and photos together (easily) with<BR><A href="http://us.rd.yahoo.com/mail_us/taglines/PMHM3/*http:/photomail.mail.yahoo.com">PhotoMail </A>- it's free and works with Yahoo! Mail.</SPAN></FONT></div></DIV>_______________________________________________<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> <a href="http://us.rd.yahoo.com/evt=38381/ ylc=X3oDMTEzcGlrdGY5BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDMWF1dG9z/*http://autos.yahoo.com/index.html ">Yahoo! Autos</a>. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.