[Gdal-dev] ogr2ogr -sql output lost geometry

Thomas Windholz thomw00 at yahoo.com
Tue Sep 13 11:32:05 EDT 2005


All,
 
I used ogr2ogr to export a point layer from postgres/postgis into a shapefile ... everything worked fine (I can open it and load/view locations). Then I used a basic SQL statement (-sql "SELECT * FROM ksamples WHERE chloroph=108") and all geometry was lost (cannot load locations), yet ksamples.dbf table is returned ok (only the records having chloroph=108 are in the dbf table).

 
Originally I tried to use gdal (ogr), specifically poDS->ExecuteSQL(...) to retrieve spatial locations based on a joined non-spatial table's attribute information.
 
pszSQLStatement = "SELECT * FROM test INNER JOIN ksample ON test.c_id = ksample.chloroph WHERE something = 467";
poResultSet = poDS->ExecuteSQL( pszSQLStatement, NULL, NULL );
 
The poResultSet had not spatial attributes, but all the non-spatial values were ok. First, since I am new to gdal and postgis (I am -was- from the ESRI world) I thought it was just my portion of the code ... but as mentioned above ogr2ogr does the same?
 
I noticed in the archives of April 05 someone posting a similar issue ... but no solutions that I could find.
 
Using: FWTools0.9.8, PostgreSQL 1.2.1, PostGIS 1.0.2
 
Any help/hints are appreciated.
 
Thanks,
Thomas
 


		
---------------------------------
Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20050913/47087cbb/attachment.html


More information about the Gdal-dev mailing list