[gdal-dev] Issues when exporting from PostGIS to shape

Frank Warmerdam warmerdam at pobox.com
Wed Mar 10 10:08:46 EST 2010


Peter Hopfgartner wrote:
> i) The .dbf in this shape file does not contain the column "id".

Peter,

I believe the "id" field is being treated as the feature id, and
thus is not exposed as a regular column.  This results in it being
lost in the translation.

I can see that in some circumstances it would be desirable to preserve
this as a regular attribute but currently there is no mechanism within
the postgres driver itself to accomplish this.

One workaround is to do the translation as an explicit user sql command
to avoid the automatic handling.

eg.
ogr2ogr /tmp/ut_table_with_geom/points PG:... \
   -sql "select * from impexpshp.points"

> ii) the resulting shape file has a language identifier set to 57 (ANSI), 
> but it really is UTF-8 [1][2].

That is correct.   The Shapefile driver is currently unaware of
encoding issues and always marks the generated dbf files with the default
(ANSI) setting.  Internally OGR attempts to manage text attributes
in UTF-8, and the postgres driver does honour that.

The Shapefile driver really needs to be upgraded to be encoding aware;
however, there are manpower and technical issues around how to do that
properly.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list