[gdal-dev] Issues when exporting from PostGIS to shape
Frank Warmerdam
warmerdam at pobox.com
Wed Mar 10 11:57:49 EST 2010
Peter Hopfgartner wrote:
>> 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?
Peter,
You can use the -nln (new layer name) switch to set the name of the
created layer.
ogr2ogr /tmp/ut_table_with_geom/points PG:... \
-nln out_points -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.
>>
> 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.
Some work would need to be done within shapelib's dbfopen.c code to
read and write the encoding indicators. Some work would need to be
done in the OGR shapefile driver to translate to UTF-8 when reading
and to translate to the target encoding on output with a creation
option to control encoding.
I am very concerned about compatability issues, so some care would
be necessary.
There are tickets on the issue that may have some information.
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