Hi,
I have an editable mobile geodatabase (simulation.geodatabase, generated from a feature service) which has a table "Result" with a field "Value" (float64/double) and a Geometry (a polyline).
I want to add some features to this table, but I only succeed in adding empty features (with null for Value and SHAPE).
Below is the relevant code:
...
Esri::ArcGISRuntime::Geodatabase* geodatabase = new Esri::ArcGISRuntime::Geodatabase(QString::fromStdString(_simulationGeodatabasePath));
geodatabase->load();
Esri::ArcGISRuntime::LoadStatus ls = geodatabase->loadStatus();
while (ls != Esri::ArcGISRuntime::LoadStatus::Loaded)
{
boost::interprocess::winapi::sleep(100);
ls = geodatabase->loadStatus();
}
_simTable = EsriContext::getInstance()->getSimulationGeodatabase()->geodatabaseFeatureTable("Result");
if (_simTable)
{
_simTable->load();
while (_simTable->loadStatus() != Esri::ArcGISRuntime::LoadStatus::Loaded)
{
boost::interprocess::winapi::sleep(100);
}
QList<Esri::ArcGISRuntime::Feature*> simResults;
std::vector<std::shared_ptr<Esri::ArcGISRuntime::PolylineBuilder> >::iterator it = _polylineBuilders.begin();
int i = 1;
for (it; it != _polylineBuilders.end(); ++it, ++i)
{
std::string index = boost::lexical_cast<std::string>(i);
QMap<QString, QVariant> featureAttributes;
featureAttributes.insert("Value", 1.0);
Esri::ArcGISRuntime::Feature* feature = _simTable->createFeature(featureAttributes, (*it)->toGeometry(), geodatabase);
simResults.append(feature);
}
if (_simTable->canAdd())
{
Esri::ArcGISRuntime::TaskWatcher& taskWatcher = _simTable->addFeatures(simResults);
while (!(taskWatcher.isDone()))
{
boost::interprocess::winapi::sleep(100);
}
}
}
...The wkid of the polylines from the polylinebuilders is the same as the one of the .geodatabase.
When I just create an empty feature (_simTable->createFeature(_geodatabase);) and add them, they are added to the geodatabase (I check it with "db browser for sqlite"). When I try to assign an attribute and geometry like in the code above, nothing is added. Anybody has any idea what I'm doing wrong?
Kind regards,
Jan