[postgis-users] JAVA and post GIS

Gilbert, Antoine AGilbert at korem.com
Mon Jan 30 05:11:04 PST 2006


Hi

 

Here is my example using postgis_1_0_0.jar

 

Connection connection = TestUtils.getTestConnection();

        Statement stmt = connection.createStatement();

        ResultSet rs = stmt.executeQuery("select AsBinary(geom) as geom
from \"rue_test_polyline\"");

        ResultSetMetaData rsmd = rs.getMetaData();

        for(int i=0;rs.next();i++){

            Geometry geometry = new
BinaryParser().parse(rs.getBytes(1));

            if(geometry.getType()==geometry.MULTILINESTRING){

                MultiLineString multiline = ((MultiLineString)geometry);

                System.out.println(multiline.toString());

                System.out.println("ligne "+i+" contient
"+multiline.numLines()+" segment(s)");

                for(int j=0;j<multiline.numLines();j++)

                    System.out.println("    segment
"+j+":"+multiline.getLine(j).numPoints()+" points");

            }

        }

        stmt.close();

        connection.close();

 

  _____  

From: Fatemeh Abbasinejad [mailto:fabbasinejad at yahoo.com] 
Sent: January 30, 2006 3:43 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] JAVA and post GIS

 

I am new to PostGIS. Does anyone know how we can retrieve our defined
data types 
(like point,circle,...) from a ResultSet in java. I used getObject but
it didn't work. 

-fatemeh

  _____  

Bring words and photos together (easily) with
PhotoMail
<http://us.rd.yahoo.com/mail_us/taglines/PMHM3/*http:/photomail.mail.yah
oo.com> - it's free and works with Yahoo! Mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060130/f9c5117b/attachment.html>


More information about the postgis-users mailing list