Closed hechenglongfell closed 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"
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.
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"