[Gdal-dev] Problem creating MapInfo tab files using C# (via the C API)

Richard Matsunaga richard.matsunaga at waypointinfo.com
Tue Mar 21 16:08:10 EST 2006


Hi all,
 
I've been building a C# wrapper for OGR (following on the good work on a
GDAL wrapper by Sy Perkins) and am very new to OGR development.
 
Everything was going swimmingly until I tried to write to a MapInfo tab
file. Basically, I am trying to write multiple layers, each with some number
of polygon objects. All my fields are being written correctly. But for some
reason, only the 2nd layer that I create is good. If I create only one
layer, it is corrupt. All layers other than the 2nd layer are corrupt.
 
How do I define corrupt? The files open in MapInfo, but the polygons have
invalid coordinates and certain actions within MapInfo cause crashes (such
as Export). The fields are all correct. If you check the projection in table
maintenance, MapInfo cannot find the projection for all layers except the
2nd.
 
After beating my head against the wall for a day or so, I started to explore
other data source types. ESRI shape files open correctly in MapInfo. I then
noticed that the MapInfo driver can be used to create MID/MIF files instead
of tab files. Using this option gave me correct results once imported into
MapInfo.
 
Is there anything that I could be doing wrong to cause this type of
behaviour? If not, then there must be something wrong with the C API, since
the exact same program was built using C++ and it was able to create MapInfo
tab files correctly.
 
I have noticed some strange behaviour with the Spatial Reference methods. If
I create a single Spatial Reference object (handle in the C API) and use it
to create all the layers in the same program as above, none of the layers
are valid. If I create a new Spatial Reference object for each new layer, I
get the above behaviour (where only the 2nd layer is valid). Since the OSR
methods in the C API are not properly documented that I could find, are
there any known issues with this area that might be causing these problems?
 
Thanks,
Richard
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060321/f6ad705c/attachment.html


More information about the Gdal-dev mailing list