[postgis-users] Read file encoding from from shape file

Paul Ramsey pramsey at cleverelephant.ca
Sat Mar 20 17:28:16 PDT 2010


Yes, there's patches to our shapelib that don't exist in the mainline.
The process needs to identify our changes to feed back to mainline,
update mainline, then bring that in.

P.

On Sat, Mar 20, 2010 at 3:41 PM, Peter Hopfgartner
<peter.hopfgartner at r3-gis.com> wrote:
> Paul Ramsey wrote:
>>
>> I was never certain that ESRI software actually respected the DBF code
>> page flags, but your reference indicates they do, so this seems
>> reasonable. Some investigation of the current state of shapelib WRT
>> encoding would be wise, as I think we should update our shapelib to
>> the current version when we release 2.0.
>>
>> P.
>>
>>
>
> I had a look if it was quick deal to upgrade to current shapelib. I copied
> dbfopen.c, shpopen.c and shapefil.h from a currrent the shapelib checkout.
> Unfortunatly, it seems to me that date handling has disappeared from
> shapelib. At least FTDate is not defined anymore and in DBFOpen no 'D' is
> assigned as field type.
>
> Am I missing something obvious here?
>
> Regards,
>
> Peter
>>
>> On Fri, Feb 26, 2010 at 5:55 AM, Peter Hopfgartner
>> <peter.hopfgartner at r3-gis.com> wrote:
>>
>>>
>>> Hi
>>>
>>> Looking into the sources of shp2pgsql, [0], it seems that the loader
>>> assumes
>>> that the encoding of the dbf file is  "WINDOWS-1252", if not specified
>>> differently by the -W command line option.
>>>
>>> From [1], shape files carry some information about their encoding, either
>>> in
>>> the dbf file header at byte position 29, [2], or in a separate file with
>>> extension CPG.
>>>
>>> Would it make sense to change the default behaviour of shp2pgsql into:
>>>
>>> 1) try to get file encoding from dbf file or cpg file
>>> 2) if 1) fails, take WINDOWS-1252 as default
>>> 3) if -W is given, take this option
>>>
>>> And then, is the information about the encoding set by pgsql2shp? It
>>> would
>>> be smooth, if shapes generated by pgsql2shp could be imported by
>>> shp2pgsql
>>> without specifying any encoding during import ("just works").
>>>
>>> Regards,
>>>
>>> Peter
>>>
>>> [0] http://trac.osgeo.org/postgis/browser/trunk/loader/
>>> [1]
>>>
>>> http://support.esri.com/index.cfm?fa=knowledgebase.techArticles.articleShow&d=21106
>>> [2] http://www.dbase.com/knowledgebase/int/db7_file_fmt.htm
>>>
>>> --
>>>
>>> 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
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
>
> --
>
> 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list