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>
There's a Place dedicated to the FGDB API -- please use the "Actions" menu on the right to move this question there.
You'll also need to provide a lot more code for context -- at least the previous 20-30 lines. You can edit the question (and format it as code for readability). You should also always use existing tags, since no one will have been searching on one you only just created.
- V
MultiPartShapeBuffer lineGeometry;
ShapeType sType;
row.GetGeometry(lineGeometry); \\ Have you read a row?
lineGeometry.GetShapeType(sType);
wcout << sType << endl;
Yes, I have read the row.
1) open geodatabase
2) search the table for Geometry filed and other attributes.
3) loop through the EnumRows.
4) get shapeType.
The same works just fine for all the samples that come with API.
For one file geodatabase, created by ArcGIS 10, it does give huge number of for shapeType.
You still need to provide the actual code before we can help you, and it's 90% likely you'll need to provide the data as well.
- V
Hi Vince,
Thanks. I will provide code snippet as well as the file geodatabase sample.
Thanks.
Hi Vince,
I have provided code sample and data sample.
Thanks
I took the liberty of editing the code in the Advanced Editor, and using appropriate syntax highlighting.
Please make one more pass to specify the exact "huge" number that was returned.
- V
Hi Vince,
Thanks:). I am so sorry I didn't have it as it should be. This is my first time to use this. Hopefully next time will be more readable and well formatted.
I have just run it again here it is the shapeType for "//Tree" feature class. "shapeType -1879048140"
As I said if I just assume the shapeType as ShapeType::shapePoint then all is working fine.
Thanks again:)
Salah.
Once you know the shape type there is no reason to keep checking. Only one type us allowed in each feature class.
The -1879048140 "type" looks like an error code. I'm looking in to it.