I am designing a workflow for my company which would include connecting to a PostGIS database from AutoCAD Map3D. This is done via the FDO API, included in Map3D.
A key functionality I want to use is the New Feature from Geometry
command of the Map3D, which takes an existing drawing object (a closed polyline for example) as input, and creates a new PostGIS feature with its geometry. This essentially allows users to utilize all AutoCAD drawing functions and commands for PostGIS geometry creation.
However, when attempting to Check-in (commit) such a feature to the database, it fails with the following error message:
Feature was not saved in the target feature source
2=Shape type mismatch on geometric property 'geom' of the feature class 'work_area'.
1=Failed to execute Fdo command.
Failed to insert feature.
postgis:munkater (), Rev# <0>
Message code: 200.
Message #0: Failed to save edit set.
Message code: 1.
Message #1: Failed to insert feature.
Message code: 1.
Message #2: Failed to execute Fdo command.
Message code: 1.
Message #3: Shape type mismatch on geometric property 'geom' of the feature class 'work_area'.
Message code: 1.
Message #4: Failed to save edit set.
Message code: 1
Researching the issue led me to this Autodesk help article, which includes a hotfix that supposedly fixes the problem, at least for the 2022 version of AutoCAD Map3D. I executed the hotfix according to the instructions (replace a certain file), but the issue persists.
Additionally, I ran a search on my system drive to see if there are copies of the problematic file in other locations than the one specified in the hotfix. I found 2 more occurences, and replaced these as well, but this didn't solve the problem either.
I also contacted Autodesk support regarding the same issue in the 2024 version, for which not even a hotfix exist; but I only received a generic reply like "… we'll look into it, maybe even fix it, but can't say when …"
I spent quite some time googling, looking through Autodesk articles and GIS.SE, to no avail. Does anyone know more about this issue, how to fix or work around it, or if it can be fixed at all?
I did some further testing after J.R's comment, and it seems that there is indeed a geometry type mismatch. Apparently, Map3D or FDO handles GIS geometry types in a way that makes Polygon and MultiPolygon types 100% incompatible, and if a feature is created with Polygon geometry type, then it cannot be saved to a MultiPolygon table.
The question still stands though, because New Feature from Geometry
should create geometries matching the type of the selected table; especially when called from table context menu.