[gdal-dev] to get postgis-polygon object using resultset in Java

Chaitanya kumar CH chaitanya.ch at gmail.com
Tue Dec 28 04:44:21 EST 2010


Ahmet,

You might want to work with WKT while debugging and switch to WKB later.
Did you use ST_AsBinary(geometry column) in the SQL query string?

On Tue, Dec 28, 2010 at 3:08 PM, <ahmettemiz88 at gmail.com> wrote:

> thank you
>
> while (rs.next()) {
> //g1 =
> com.vividsolutions.jts.geom.Geometry.wkbReader.read(WKBReader.hexToBytes(rs.getString(1)));
> g1 = org.gdal.ogr.Geometry.CreateFromWkb(rs.getBytes(1));
> if (g1 != null) {
> System.out.println( g1.GetGeometryType());
> }
>
> }
>
> g1 returns null.
> can you tell me what the wrong is ?
>
> regards
>
> 28 Ara 2010 10:49 tarihinde, Chaitanya kumar CH <chaitanya.ch at gmail.com>
> şunu yazdı:
>
> > Ahmet,
> >
> > If you are querying the postgis database directly, you can use
> ST_AsText() or ST_AsBinary() to get the geometry in the WKT or the WKB
> format and use OGRGeometry::importFromWkt()
> > or OGRGeometry::importFromWkb() respectively to load them into the OGR
> objects. This question is actually for the postgis list.
> >
> > 2010/12/28 ahmet temiz ahmettemiz88 at gmail.com>
> >
> > hello
> >
> >
> >
> > how can I get postgis-polygon object using Resultset in Java ?
> >
> >
> >
> > like this way :
> >
> >
> >
> > ResultSet rs = stmt.executeQuery(qstr);
> >
> >  while (rs.next()) {
> >
> >    gdal.Geometry  geo=????
> >
> >  }
> >
> >
> >
> > regards
> >
> > --
> >
> > Ahmet Temiz
> >
> > Jeoloji Müh.
> >
> > Planlama ve Zarar Azaltma Dairesi Başkanlığı
> >
> > Bilgi ve CBS grubu
> >
> > Eskişehir Yolu 10. km.
> >
> > Lodumlu / Ankara
> >
> > Tel : 0 312 2872680 / 1535
> >
> > _______________________________________________
> >
> > gdal-dev mailing list
> >
> > gdal-dev at lists.osgeo.org
> >
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
> >
> >
> >
> > --
> > Best regards,
> > Chaitanya kumar CH.
> > /tʃaɪθənjə/ /kʊmɑr/
> > +91-9494447584
> > 17.2416N 80.1426E
> >
>



-- 
Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20101228/af5bdb0f/attachment.html


More information about the gdal-dev mailing list