MaxRev-Dev / gdal.netcore

GDAL 3.x C#/F# bindings for .NET apps
MIT License
161 stars 36 forks source link

Hi,MaxRev, Does GDAL support multithreading? for example Task.Run() #74

Closed hechenglongfell closed 2 years ago

hechenglongfell commented 2 years ago

Task.Run(() => { GdalBase.ConfigureAll(); using (var drv = Ogr.GetDriverByName("ESRI Shapefile")) { var ds = drv.Open(shapefilepath, 0);
var drvJson = Ogr.GetDriverByName("GeoJSON"))
drvJson.CopyDataSource(ds, geojsonfilepath, null);
drvJson.Register(); drvJson.Dispose();
ds.Dispose(); drv.Dispose(); Gdal.GDALDestroyDriverManager(); return geojsonfilepath; } }); error: MaxRev.Gdal.Core.dll Message: "The GeoJSON driver does not overwrite existing files"

MaxRev-Dev commented 2 years ago

Yes. It does. But you are confusing multithreading with I/O operations. You can read file by multiple threads, but that error says you can't create a file or write into one file using multiple threads.