see http://www.gdal.org/ogr/drv_mitab.html
MapInfo datasets in native (TAB) format and in interchange (MIF/MID) format are supported for reading and writing. Update of existing files is not currently supported. On Feb 22, 2014, at 7:51 AM, HappyFrasse <[email protected]> wrote: > > Hi > > I am trying to use the latest ogr/gdal library in my dotnet projekt. I do > ref. to ogr_csharp, gdal_csharp. > My problem is that I can read my Mapinfo tab-file but I can’t write (append) > features to it and I don’t understand why? > > If I open the mapinfo file with Ogr.Open(_FileName, 0) I got write access > error when using “CreateFeature”. > If I change the second parameter to 1 (in open) then I won’t get any > datasource. Why? Does ogr/gdal not support write /append to some existing > mapinfo file? > > My code goes like: > > *****Code start *** > Ogr.RegisterAll() > > 'Open data source. > Dim dsTab As DataSource = Ogr.Open(_FileName, 0) > 'Dim dsTab As DataSource = Ogr.Open(_FileName, 1) > If dsTab Is Nothing Then > System.Diagnostics.Debug.WriteLine("Can't open " + _FileName) > End If > > 'Get driver > Dim drvTab As Driver = dsTab.GetDriver() > If drvTab Is Nothing Then > System.Diagnostics.Debug.WriteLine("Can't get driver.") > End If > System.Diagnostics.Debug.WriteLine("Using driver " + drvTab.name) > > Dim layerTab As Layer = Nothing > Dim i As Integer = 0 > Dim iLayers As Integer = dsTab.GetLayerCount > > layerTab = dsTab.GetLayerByIndex(0) > Dim layerName As String = layerTab.GetName > System.Diagnostics.Debug.WriteLine("Layername " + layerName) > > Dim feature As Feature = New Feature(layerTab.GetLayerDefn()) > feature.SetFID(Ogr.OGRNullFID) > > feature.SetField("TraktId", "Mytest_TraktId") > > Dim geom As Geometry = Geometry.CreateFromWkt("POINT(47.0 19.2)") > If feature.SetGeometry(geom) <> 0 Then > System.Diagnostics.Debug.WriteLine("Failed add geometry to the > feature.") > End If > > If layerTab.CreateFeature(feature) <> 0 Then > System.Diagnostics.Debug.WriteLine("Failed to create feature in file.") > End If > *** code end *** > > Is my code wrong or do I missunderstood something? > > Regards/Frasse > > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/Gdal-Mapinfo-driver-write-access-tp5105252.html > Sent from the GDAL - Dev mailing list archive at Nabble.com. > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
