EditUpdateShape problem


I’ve developed an ms access based application. In this application i create a new shapefile with “handmade” polygon objects, via three routines: one creates the shapefile on disk, - Shapefiletype POLYGON, one creates the polygon objects and one that loops through a table, gathers all affected records, and adds new records to the shapefile with the objects of routine 2.
This works perfectly, - i can load that shapefile in MapWinGis-OCX and in QGis, - no problem here.

Now i want to add a routine to update the shape-Object of specific Shapefile-Records.
For this i open the previously generated shapefile from disk, startEdtingShapes(true) → returns true, create a new polygon object with the same routine used to create the shapefile and use the .EditUpdateShape-Method to update the shape-object.

The EditUpdateShape-Method does not throw an error when updating the shape-object, and in this routine there is already a buildin check if the shapetypes of file and new object match, - but when i call shapefile.save() or .stopeditngshapes(true,true) to save the changes this way the error message i get is:
Shape type is incompatible with the shapefile type.

i took the source code of the current release version, created my own debug version and debuged this behaviour in vs 2019.
When .EditUpdateShape is entered the newShape-object gets passed correctly and is of type POLYGON with parts, points and a boundary, but when stopeditingshapes is called the routine VerifyMemShapes tells me for this updated shapeindex, that the object stored there is not present any
longer (no parts, no points, no extend, random numbers vor _shapeType) and so that routine fails.
The shapefile is disk based, and since the application can write / create that file, it’s obviously no rights-problem.
I tried it with fastmode on and off, no changes here.

I’m a bit lost here and happy about any idea that might help.


Hello Stefan.

I may or may not be able to reproduce this without your specific code, but we can start with a question.

Here’s the code leading up to the specific error you are seeing:

	// MWGIS-91
	bool areEqualTypes = shapetype == _shpfiletype;
	if (!areEqualTypes){
		areEqualTypes = ShapeUtility::Convert2D(shapetype) == ShapeUtility::Convert2D(_shpfiletype);

	if (shapetype != SHP_NULLSHAPE && !areEqualTypes)
		return FALSE;

So, presuming that you are falling into the error where areEqualTypes = false, what type is showing for your shapeType following the call to get_ShapeType?

And it sounds like you’re also saying that numPoints and numParts are zero?

Could you post the code that creates the shape?

Thank you.