AnsweredAssumed Answered

query polygon with negative distance, error with geometry service buffer

Question asked by Stahly on May 18, 2017
Latest reply on May 18, 2017 by Stahly

Hello all,

In a widget routine I want to perform a spatial query (intersect) with a negative distance buffer: create an effective search geometry that is smaller than the selected input.

Currently I am attempting to create a buffer using a geometry service with a negative distance:

var BP = new BufferParameters();
var gsvc = new GeometryService("");
BP.bufferSpatialReference = featureSet.features[0].spatialReference;
BP.unit = GeometryService.UNIT_METER;
BP.distances = -5;
BP.geometries = featureSet.features[0].geometry;
//Define a Query: get all features from the target feature layer that intersect the geometry of the input featureset.feature[0]
Q = new Query();
//Q.geometry = featureSet.features[0].geometry;
Q.geometry = PBuffer.geometry;
Q.outFields = [ "*" ];
Q.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
Q.returnGeometry = true;
//Q.distance = -5;
//Q.units = "meters";

In the browser console this throws the following error (line 39 is line 7 above):

TypeError: a.join is not a function
at Object.toJson (BufferParameters.js:5)
at Object.buffer (init.js:2274)
at SelectParcelsAction.js?wab_dv=2.3:39

I've previously attempted to simply define a query distance, commented out in the code block, but that did not appear to have an affect.


What am I doing wrong and how to best achieve what I'm trying to do?