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>