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

2010-12-28 Thread ahmet temiz
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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


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

2010-12-28 Thread Chaitanya kumar CH
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 

> 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@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
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] PCIDSK .pix feature attribute information not visible in geomatica.

2010-12-28 Thread shashishaw

Hi,
I am using the current trunk of GDAL/OGR 
version(v1.7.3, revision 21324) to convert a .shp file 
to .pix file. The steps used  are taken from 
the online tutorial and are as below.

1.  // Open the datasource.
OGRDataSource* pSrc = OGRSFDriverRegistrar::Open("input.shp",FALSE);

2.  // Read the source layer.
OGRLayer* pSrcLayer = pSrc->GetLayer(0);

3.  // Initialise the output driver.
const char* pszDriverName = "PCIDSK";
OGRSFDriver* pDriver = NULL;
pDriver = OGRSFDriverRegistrar::GetRegistrar()
 ->GetDriverByName(pszDriverName);

4.  // Test capability.
int result = pDriver->TestCapability("CreateDataSource");

5.  // Create the data source.
OGRDataSource* pDst = pDriver->CreateDataSource("out.pix", NULL );

6.  // Create the output layer.
OGRLayer* pDstLayer = pDst->CreateLayer("out_layer",
pSrcLayer->GetSpatialRef(),

pSrcLayer->GetLayerDefn()->GetGeomType());

7.  // Create field definitions for output layer.
for( int i = 0; i < pSrcLayer->GetLayerDefn()->GetFieldCount(); i++){
 OGRFieldDefn dstFieldDefn(pSrcLayer->GetLayerDefn()->GetFieldDefn(i));

 // Create the destination field.
 OGRErr err = pDstLayer->CreateField(&dstFieldDefn);

}
   
8.  // Read and set the features.
pSrcLayer->ResetReading();
OGRFeature* pSrcFeature = NULL;
while( NULL != (pSrcFeature = pSrcLayer->GetNextFeature())){
// Create the destination feature.
OGRFeature* pDstFeature =
OGRFeature::CreateFeature(pDstLayer->GetLayerDefn());
err = pDstFeature->SetFrom(pSrcFeature,FALSE);
// Add the feature to the layer.
err = pDstLayer->CreateFeature(pDstFeature);

OGRFeature::DestroyFeature(pDstFeature);
OGRFeature::DestroyFeature(pSrcFeature);
}

9.  // Cleanup
OGRDataSource::DestroyDataSource(pDst);
OGRDataSource::DestroyDataSource(pSrc);

NOTE: Error handling has been ignored.

On viewing the .pix output file in PCI Geomatica(Focus), the geometry
is correctly displayed, however the attribute information(using the
Attribute
Manager) does not show any details(empty fields). The .pix when viewed in a 
text editor does show the attribute information that is present in the .shp
file. 

Lastly, when I read the generated output .pix file using the 
GDAL/OGR apis, I am able to correctly read the feature attribute
information.

Are there some additional steps to be performed in order to correctly set
the attributes for a given file so that they are displayed in PCI Geomatica.

Thanks,
Shashi.
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/PCIDSK-pix-feature-attribute-information-not-visible-in-geomatica-tp5871388p5871388.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


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

2010-12-28 Thread Chaitanya kumar CH
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,  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 
> ş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 ahmettemi...@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@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
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

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

2010-12-28 Thread ahmettemiz88

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   
ş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 ahmettemi...@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@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


___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev