[gdal-dev] MapInfo File vs ESRI Shapefile attribute value encoding

Max Demars burton449geo at gmail.com
Wed Apr 30 06:40:39 PDT 2014


Hi,

I am sorry about the noise. The only thing I was correct in the first post
was that I was confuse. My problem was not related to encodings, but to the
field types width and precision limitation that are different in MapInfo
software and FME and QGIS. That was what made MapInfo crashing.

Thank you Even for your reply anyway that confirms the encoding process is
correct.




On Wed, Apr 30, 2014 at 9:31 AM, Even Rouault
<even.rouault at mines-paris.org>wrote:

> Le mardi 29 avril 2014 21:32:11, Max Demars a écrit :
> > Hi,
> >
> > I am a bit confused right now about a possible difference in encoding
> > attribute value that I have noticed between those two drivers (MapInfo
> File
> > vs ESRI Shapefile).
> >
> > I have a script that allow user to export some features from database to
> > shapefile or MapInfo TAB format. However, in MapInfo TAB the attributes
> are
> > not encoded correctly in utf-8, contrary than shapefiles.
> >
> > The same data and the same code is used, and I am starting to think that
> > the difference is coming from inside the OGR drivers.
> >
> > OGRFeature.SetField("FiedlName", value.encode('utf-8')) #value is unicode
> >
> > Anybody have information about this issue? I dont really know where to
> > look.
>
> Works for me :
>
> $ cat foo.csv
> id,text,WKT
> 1,éven,"POINT(0 0)"
>
> $ file foo.csv
> foo.csv: UTF-8 Unicode text
>
> $ ogr2ogr -f "mapinfo file" foo.tab foo.csv
>
> $ ogrinfo foo.tab -al
> Had to open data source read-only.
> INFO: Open of `foo.tab'
>       using driver `MapInfo File' successful.
>
> Layer name: foo
> Geometry: Point
> Feature Count: 1
> Extent: (0.000000, 0.000000) - (0.000000, 0.000000)
> Layer SRS WKT:
> LOCAL_CS["Nonearth",
>     UNIT["Meter",1.0]]
> id: String (254.0)
> text: String (254.0)
> WKT: String (254.0)
> OGRFeature(foo):1
>   id (String) = 1
>   text (String) = éven
>   WKT (String) = POINT(0 0)
>   Style = SYMBOL(a:0,c:#000000,s:12pt,id:"mapinfo-sym-35,ogr-sym-10")
>   POINT (0 0)
>
>
> >
> > -Max Demars
>
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html
>



-- 
Stack Overflow: http://stackoverflow.com/users/1914034/burton449
GIS Overflow: http://gis.stackexchange.com/users/14426/burton449
LastFm: http://www.lastfm.fr/user/burton449
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140430/96ec69ec/attachment.html>


More information about the gdal-dev mailing list