Hello dear community,
I have a program in which I often have to add new shapefiles to an existing one. I do this with Shapefile.Merge. My problem is that I don’t want to have a new file with all the previously merged shapes every time. There should be one shapefile in which everything is contained and I then add one each time with Merge.
Dim BaseShape As Shapefile = New Shapefile
Dim NewShape As Shapefile = New Shapefile
Dim MergedSF As Shapefile = New Shapefile
NewShape.Open(NewShapePath)
BaseShape.Open(BaseShapePath)
MergedSF = BaseShape.Merge(False, NewShape, False)
MergedSF.SaveAs(BaseShapePath)
'Alternativ I tried also:
BaseShape = BaseShape.Merge(False, NewShape, False)
Baseshape.SaveAs(BaseShapePath)
I have also tried save instead of saveas, but nothing works. Only if I choose a new name and thus create a new file does it work.
What do I have to do to overwrite an existing shapefile? Deleting the files before saving does not work either, I get an access error.
I’m happy about any tips and ideas
Andreas