Helllo,
I am trying to use the InterpolatePoints service and I have a problem with the boundingPolygonLayer parameter.
I am loading a layer with the border of Germany from ArcGIS Living ATLAS: url
I know that I can pass the url directly and that works fine. For flexibility reasons I want to use the feature set option. My code for preparing the feature set looks like this:
// Germany test for filtering the interpolated predictions
var germanyLayer = new FeatureLayer({
url: "https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/DEU_Boundaries_2022/FeatureServer"
});
var germanyQuery = germanyLayer.createQuery();
germanyQuery.returnGeometry = true;
germanyQuery.outFields = ["*"]; // Specify the fields you need
const germanyResult = await germanyLayer.queryFeatures(germanyQuery);
console.log('germanyResult: ', germanyResult);
const germanyDict = {
layerDefinition: {
geometryType: "esriGeometryPolygon",
fields: [
{
name: "Id",
type: "esriFieldTypeOID",
alias: "Id"
},
{
name: "Name",
type: "esriFieldTypeString",
alias: "Name"
}
// Add other fields as necessary
]
},
featureSet: {
geometryType: "esriGeometryPolygon",
spatialReference: {
wkid: 102100
},
features: [
{
geometry: germanyResult.features[0].geometry,
attributes: {
Id: 1,
Name: "Germany"
}
},
]
}
}
Then I construct the parameters in the following way:
const apiUrl = `https://analysis3.arcgis.com/arcgis/rest/services/tasks/GPServer/InterpolatePoints/submitJob`;
const parameters = {
f: "json",
token: token,
inputLayer: JSON.stringify(temp_feature_layer),
field: fieldName,
//outputName: JSON.stringify({ serviceProperties: { name: outputName } }),
interpolateOption: interpolateOption,
classificationType: classificationType,
numClasses: 32,
// boundingPolygonLayer: JSON.stringify({ url: 'https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/DEU_Boundaries_2022/FeatureServer/0' }),
boundingPolygonLayer: JSON.stringify(germanyDict),
};