POST
|
Hi Lance, I am have exactly the same problem mentioned here. I can send you sample application where the problem can be reproduced. I realized that Geodatabase API C++ is not multi-thread. But as mentioned here if is called from a working thread, the second time for me it would crash. I always make sure that I close the database before starting the second call. Interestingly, it does NOT crash if I used std:::async() but it does crash if I use AfxBeginThread(). Here is a code snippet. struct data
{
Geodatabase m_geodatabase;
std::wstring m_name;
};
UINT create(LPVOID param)
{
data *pObject = reinterpret_cast<data*>(param);
if (pObject == nullptr)
{
return 0;
}
// Create a new geodatabase in the current directory.
fgdbError hr;
std::wstring errorText;
{
try
{
if ((hr = CreateGeodatabase(pObject->m_name, pObject->m_geodatabase)) != S_OK)
{
ErrorInfo::GetErrorDescription(hr, errorText);
return -1;
}
}
catch (...)
{
}
}
CloseGeodatabase(pObject->m_geodatabase);
delete pObject;
pObject = nullptr;
return 0;
}
void CTestGeoDlg::OnBnClickedButton1()
{
data *d = new data;
d->m_name = m_name1;
// TODO: Add your control notification handler code here
// create( d);
std::async(create, d);
// AfxBeginThread(create, d);
}
void CTestGeoDlg::OnBnClickedButton2()
{
data *d = new data;
d->m_name = m_name2;
// TODO: Add your control notification handler code here
// create( d);
std::async(create, d);
//AfxBeginThread(create, d);
}
{
m_name1 and m_name2 are different. The files get created but then crash.
... View more
04-30-2015
09:18 PM
|
0
|
0
|
683
|
POST
|
Hi V, I have read the answer you are referring to. In the README-windows_VS2013.txt there is NO mentioning of the CRTV90. I think, it is always better to have the CRT version same as the one used for the build. Thanks, Salah.
... View more
04-26-2015
07:49 PM
|
0
|
0
|
307
|
POST
|
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.
... View more
04-24-2015
11:27 PM
|
0
|
0
|
627
|
POST
|
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). The same for the 64bits <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>
... View more
04-24-2015
04:40 PM
|
0
|
2
|
4043
|
POST
|
Hi Vince, Thanks . I will post another question then in the same place. Thanks Salah.
... View more
04-24-2015
04:30 PM
|
0
|
0
|
627
|
POST
|
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.
... View more
04-24-2015
03:51 PM
|
0
|
4
|
627
|
POST
|
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.
... View more
04-23-2015
08:34 PM
|
0
|
7
|
1374
|
POST
|
Hi Vince, I have provided code sample and data sample. Thanks
... View more
04-23-2015
04:42 PM
|
0
|
9
|
1374
|
POST
|
Hi Vince, Thanks. I will provide code snippet as well as the file geodatabase sample. Thanks.
... View more
04-21-2015
10:17 PM
|
0
|
0
|
1374
|
POST
|
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.
... View more
04-20-2015
02:36 PM
|
0
|
12
|
1374
|
POST
|
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>
... View more
04-15-2015
04:53 PM
|
0
|
15
|
5930
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|