I am using C++ geodatabase API 1.4 to read File geodatabase. It works great for the all samples that comes with the API.
However, I tried a File geodatabase created in ArcGIS V10 and seems whenever I retrieve the shape type for a geometry polygon or polyline I get invalid shaptype value (huge number). If I assume the default shape type all good.
ShapeType shapeType; if (multiPartShapeBuffer.GetShapeType(shapeType) != S_OK) { return false; ; }
Any ideas?
shapeType is huge number and return value IS S_OK.
Here is a code snippet
// Import feature class point bool ImportGeodatabaseImpl::ImportFeatureClassPoint(EnumRows &featureClass, const Dbms::LayerPtr layer) { // featureClass is the rows. Row row; PointShapeBuffer pointShapeBuffer; ShapeType shapeType = ShapeType::shapeNull; while (featureClass.Next(row) == S_OK) { // Update the progress IncrementProgress(1); // Check if the operation has been cancelled if (IsCancelled()) { return false; } if (row.GetGeometry(pointShapeBuffer) != S_OK) { return false; } if (pointShapeBuffer.GetShapeType(shapeType) != S_OK) { return false; } // Here shapeType is big number bool isShapeValid = true; switch (shapeType) { case ShapeType::shapePoint: case ShapeType::shapePointZ: break; case ShapeType::shapeNull: case ShapeType::shapePointM: case ShapeType::shapePointZM: // Shape type not supported m_report.AddWarning(Utils::FormatString(GetString(ConvertStringId::UnsupportedGeometry), static_cast<uint32_lt>(shapeType))); isShapeValid = false; break; default: // The Geodatabase file sample used for the unit test does not have a valid shape type value hence we use the default to shapePoint. shapeType = ShapeType::shapePoint; } // Do other stuff for baseed on the shape type }
The sample file goedatabas is attached.
Also, on a related matter the C++ Geodatabse API 1.4 VS2013 has a dependency on VS 2008. If you open up "bin\FileGDBAPI.dll" in text editor and search for the manifest you will find the below, relying on CRT version 9 (VS 2008).
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level='asInvoker' uiAccess='false' /> </requestedPrivileges> </security> </trustInfo> <dependency> <dependentAssembly> <assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> </dependentAssembly> </dependency> </assembly>
Well it's not an error number that we create.
Hi Lance,
Thanks.
It could be an error code or just overflow.
I thought each feature class allowed to have one geometry type but could have different shape types of the given geometry type. Like for instance geometry type point, could have those shape types : point, pointZ, point M, pointMZ?
Then why shape type is associated with a each row while geometry type is associated with the table.
Also, as a kind reminder could we have the C++ file geodatabase API 1.4 (VS2013) without the reliance on VS 2008(CRT 9) as mentioned my above in my question
Thanks again.
Salah.
It is best practice to place one question in each question. Generally, one of two things happens when you post an "and" query:
The CRT issue should be branched into a separate question (in this same Place)
- V
Hi Vince,
Thanks .
I will post another question then in the same place.
Thanks
Salah.
Each feature class can contain only one shape type. You cannit have pointM, pointZ and pointMZ types in the same feature class.The only exception in shapeNull which can be in any feature class.
Hi Lance,
Thanks .
Good to know.
so, if the first encounter shape type, in a feature class table, that is no ShapeNull, it will be the same for all rows.
Thanks again,
Salah.