我有一个要使用用户输入和几何服务进行缓冲的功能层。ESRI JS API - 缓冲区FeatureLayer
FeatureLayer:
var texasPipeline = new FeatureLayer(pipeURL, {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
definitionExpression:texasPipeQuery
});
的BufferParameters:
var params = new BufferParameters();
params.distances = [distance];
params.unit = units;
params.outSpatialReference = map.spatialReference;
params.geometries = texasPipeline;
map.graphics.clear();
geomSvc.buffer(params, showBuffer);
服务器返回一个错误,指出几何必须提供。我的猜测是我需要传递FeatureLayer的几何,而不是FeatureLayer本身。我如何获得FeatureLayer的几何图形并将其适当地传递给BufferParameters?
编辑: 此外,我试图循环,因为你可以看到在代码波纹管。将几何图形数组传递给BufferParameters仍然不能成功返回。
var texasPipelineGeom = [];
var graphics = texasPipeline.graphics;
for (var G in graphics) {
var g = graphics[G]["geometry"];
console.log(g);
texasPipelineGeom.push(g);
}
其400错误..无法完成操作。 – LCaraway
得到爱Esri的有用的错误消息:(。我添加了一个适用于我的例子,尽量匹配最好的,如果你这样做,并且stlil看到一个400错误,可能是有一个几何问题您的要素图层,请尝试使用简单点发送它,或者先使用几何服务简化方法来简化它,在此函数中,我传入ArcGIS Point和50作为我的半径。 –