Hi all,
I am trying to dissolve features using geometry serveice union then buffer the dissolve features 200' but I am getting errors. Any idea why?
Here is my code:
featureLayer.selectFeatures(selectQuery, FeatureLayer.SELECTION_NEW, function (targetGeometry) {
map.setExtent(graphicsUtils.graphicsExtent(featureLayer.getSelectedFeatures()), true);
targetGeometry = graphicsUtils.getGeometries(featureLayer.getSelectedFeatures());
console.log(targetGeometry);
geometryService.union(targetGeometry, function (geometry) {
geom = geometry;
featureLayer.clearSelection();
//Graphics to be shown on web map
var symbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([180, 50, 250]), 4);
graphic = new Graphic(geometry, symbol);
map.graphics.add(graphic);
//feature set to feed the geoprocessing service
var features = [];
FeaturesetGraphs = new FeatureSet();
FeaturesetGraphs.features = features;
features.push(graphic);
//Make a buffer from the features
//setup the buffer parameters
var params = new BufferParameters();
params.distances = [200];
params.outSpatialReference = map.spatialReference;
params.unit = geometryService.UNIT_FOOT;
params.geometries = [geometry];
geometryService.buffer(params, function (bufferedGeometries) {
var symbol2 = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 0, 0]), 4), new Color([247, 242, 89, 0.6]));
var graphic2 = new Graphic(bufferedGeometries, symbol2);
map.graphics.add(graphic2);
});
//Area calculations for the project definition
var areasAndLengthParams = new AreasAndLengthsParameters();
areasAndLengthParams.areaUnit = GeometryService.UNIT_ACRES;
areasAndLengthParams.calculationType = "geodesic";
geometryService.simplify([geometry], function (simplifiedGeometries) {
areasAndLengthParams.polygons = simplifiedGeometries;
geometryService.areasAndLengths(areasAndLengthParams);
});
}, function (err) {
console.log(err);
});
});
});
}
Solved! Go to Solution.
Alex,
I would try simplifying the geometry before you buffer it (just like you are doing before you do the area calculations).
Alex,
I would try simplifying the geometry before you buffer it (just like you are doing before you do the area calculations).
That was it thanks Robert!