Bryan,<br><br>OGR is reading the layer definition of the source. The problem must be when reading the features.<br><br>Run your commands after setting the environment variable CPL_DEBUG to ON. Report any new messages.<br>What is the output of ogrinfo with the options -al and -so on the database?<br>

<br><div class="gmail_quote">On Sun, Jul 31, 2011 at 6:37 AM, Bryan Hempen <span dir="ltr">&lt;<a href="mailto:bryanhempen@gmx.de">bryanhempen@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi!<br>
<br>
I have a little trouble figuring out how to use ogr2ogr to read spatial data from a postgis table, project it and store it back in the database. I do not want to create a shapefile or something like that and load the data back into the database again.<br>

<br>
Using ogr2ogr for data other than stored in a PostGIS database works perfectly fine, but I can&#39;t even export PostGIS data to a shapefile or GML (always empty) and I don&#39;t know why...<br>
<br>
What worked out well so far is loading the PostGIS data with QGIS, save it as a shapefile, THEN project it to another shapefile and finally load the shapefile into the database. Yet, as I said before, I would like to directly project the data from database to database.<br>

<br>
I know that PostGIS provides a function called st_transform for exactly this purpose, but I need to use ogr2ogr.<br>
<br>
Here is the command which does not work so far, hopefully you guys can give me some help:<br>
<br>
ogr2ogr -f &quot;PostgreSQL&quot; -s_srs &quot;+proj=longlat +a=3396190 +b=3376200 +no_defs&quot; -t_srs &quot;+proj=tmerc +lat_0=0 +lon_0=0 +k=0.9996 +x_0=0 +y_0=0 +a=3396190 +b=3376200 +units=m +no_defs&quot; PG:&quot;dbname=&#39;test4&#39; host=&#39;localhost&#39; port=&#39;5432&#39; user=&#39;postgres&#39; password=&#39;xxx&#39;&quot; PG:&quot;dbname=&#39;test3&#39; host=&#39;localhost&#39; port=&#39;5432&#39; user=&#39;postgres&#39; password=&#39;xxx&#39;&quot; alldata<br>

<br>
Notes:<br>
<br>
- the table containing the geometry column is called alldata<br>
- the_geom is added with AddGeometryColumns<br>
- alldata contains some more non-spatial columns<br>
- I need the results to be stored in the database. In this command above I try to store the results in a different database on the same server. The database is empty so far. What would be even better is to add an additional column in the same database as the original data like the_geom_projected and store the projected geometries in there.<br>

<br>
I am using the last FWTools, PostGIS 2.0, PostgreSQL 8.4.<br>
<br>
When I run the command above I get the following message:<br>
<br>
Warning 1: Multi-column primary key in &#39;raster_columns&#39; detected but not supported.<br>
Warning 1: Multi-column primary key in &#39;raster_columns&#39; detected but not supported.<br>
ERROR 1: AddGeometryColumn failed for layer alldata, layer creation has failed.<br>
ERROR 1: Terminating translation prematurely after failed<br>
translation of layer alldata (use -skipfailures to skip errors)<br>
<br>
I have tried a lot of the examples on the website and some tutorials, but nothing worked. Even simple simple exports like<br>
<br>
ogr2ogr &quot;C:\Documents and Settings\user\Deskto<br>
p\new1.shp&quot;  PG:&quot;dbname=&#39;test3&#39; host=&#39;localhost&#39; port=&#39;5432&#39; user=&#39;postgres&#39; password=&#39;xxx&#39;&quot; alldata<br>
<br>
produce an empty shapefile. What am I doing wrong? Thanks for your help.<br>
<br>
Kind regards,<br>
Bryan<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Chaitanya kumar CH.<br><br>+91-9494447584<br>17.2416N 80.1426E<br>