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

Peter Hopfgartner peter.hopfgartner at r3-gis.com
Wed Mar 10 11:03:04 EST 2010

Frank Warmerdam wrote:
> 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"
This works. Thank you. One minor issue: The resulting shape file is 
names sql_statement. Can I change this name?
>> 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.
Where could one start to work on this issue? Is this in the realm of 
shapelib? We did some analysis on this in our company and maybe we can 
help with this.
> Best regards,

Thank you,


Dott. Peter Hopfgartner
R3 GIS Srl - GmbH
Via Johann Kravogl-Str. 2
I-39012 Meran/Merano (BZ)
Email: peter.hopfgartner at r3-gis.com
Tel. : +39 0473 494949
Fax  : +39 0473 069902
www  : http://www.r3-gis.com

XING : http://www.xing.com/go/invita/8917535 

More information about the gdal-dev mailing list