I am trying to call GeometryService.autoComplete which has Polygon[] as the first parameter. In my case, I would put the all of the features of my featureLayer. The only property that would seems to work is featureLayer.graphics which contains geometries. But I haven't been able to convert them to Polygon... Is there any way?

  • Please describe what you hope to accomplish by calling autoComplete. – Kirk Kuykendall May 13 '16 at 16:06
  • I am tracing a new polygon with the Draw class. Then I want it to be autocompleted if another polygon is underneath. Just like the autocomplete icon in the Editor widget. – Math May 13 '16 at 18:38

I ended up doing it manually since I haven't found how to do it...

            var polygons = [];
            var i;
            for (i = 0; i < featureLayerSelection.graphics.length; i++) {
                polygons[i] = new Polygon(new SpatialReference(featureLayerSelection.graphics[i].geometry.spatialReference.wkid));
                polygons[i].rings = featureLayerSelection.graphics[i].geometry.rings;
                polygons[i].type = featureLayerSelection.graphics[i].geometry.type;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.