Dear Esri community
I'd like to do Line Of Sight Queries from ArcGIS Runtime via a Geoprocessing Tool on a local server. I'm using ArcGISQtSDK 200.2.0.1 and rcGISPro 3.1.3. In ArcGIS Pro I use this tool Line Of Sight (3D Analyst)—ArcGIS Pro | Documentation to do a Line Of Sight query. From the result I created a .gpkx for the local server.
The local server reports following error when I use the Line Of Sight tool from ArcGIS Runtime:
Server job has failed. ERROR 000811: The value is not a feature class.
ERROR 000732: Input Line Features: Dataset [...] does not exist or is not supported.
The input causing the error is named "in_line_feature_class" (see Line Of Sight documentation mentioned above). It expects a datatype GPFeatureLayer.
The dataset mentioned in the error looks like:
{
"features": [
{
"attributes": {
"ObjectID": 1
},
"geometry": {
"paths": [
[
[
912464.4710000008,
5948732.0405
],
[
935803.3581999987,
5958361.371600002
]
]
],
"spatialReference": {
"latestWkid": 3857,
"wkid": 102100
}
}
}
],
"fields": [
{
"editable": false,
"length": 0,
"name": "ObjectID",
"nullable": false,
"type": "esriFieldTypeOID"
}
],
"geometryType": "esriGeometryPolyline",
"hasM": false,
"hasZ": false,
"spatialReference": {
"latestWkid": 3857,
"wkid": 102100
}
}
I create this input this way:
FeatureCollectionTable* inputFeatures =
new FeatureCollectionTable(QList<Field>(), GeometryType::Polyline, SpatialReference::webMercator(), this);
Feature* lineFeature = inputFeatures->createFeature(this);
auto observerPoint = static_cast<Point>(m_observerGraphic->geometry());
auto targetPoint = static_cast<Point>(m_targetGraphic->geometry());
auto polylineBuilder = new PolylineBuilder(SpatialReference::webMercator(), this);
polylineBuilder->addPoint(observerPoint);
polylineBuilder->addPoint(targetPoint);
auto polyLine = polylineBuilder->toPolyline();
lineFeature->setGeometry(polyLine);
inputFeatures->addFeatureAsync(lineFeature).then(this, [this, inputFeatures]() {
onAddFeatureCompleted_(inputFeatures);
});
Then in onAddFeatureCompleted_:
GeoprocessingParameters geoprocessParams = GeoprocessingParameters(GeoprocessingExecutionType::AsynchronousSubmit);
geoprocessParams.setOutputSpatialReference(SpatialReference::webMercator());
QMap<QString, GeoprocessingParameter*> inputs;
inputs["in_line_feature_class"] =
new GeoprocessingFeatures(inputFeatures, this);
QString dataPath = QDir::homePath() + "/ArcGIS/Runtime/Data";
inputs["in_surface"] =
new GeoprocessingRaster(QUrl(dataPath + "/raster/SwissElevation/Elevation.tif"), ".tif", this);
geoprocessParams.setInputs(inputs);
GeoprocessingJob* geoprocessJob = m_gpTask->createJob(geoprocessParams);
geoprocessJob->start();
How can I figure out what is missing from the input? What data format is exactly expected? How can I create a correct GPFeatureLayer input?
Many thanks!