Multipoint [esri.toolbars.Edit::activate] Unable to activate the tool. Check if the tool is valid for the given geometry type.

530
6
02-19-2019 01:22 PM
MarioEstevez
New Contributor II

Hello,

I'm having a problem editing multipoint features using JSAPI 3.27. This is the error I get:

[esri.toolbars.Edit::activate] Unable to activate the tool. Check if the tool is valid for the given geometry type.

Thanks in advance for your help.

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Mario,

   What options are you specifying for the activate method on your multipoint geometry?

0 Kudos
MarioEstevez
New Contributor II

Robert,

I have a few questions for you:

  1. The editor can’t handle multipoint features, is that correct?
  2. I was reading the Editor documentation and it says that it has a default editToolbar. I’m thinking that I need to manipulate the default editToolbar in order to address the edit issue ("Error: [esri.toolbars.Edit::activate] Unable to activate the tool. Check if the tool is valid for the given geometry type.) that I’m having, would that be correct or am I going in the wrong direction?
  3. Also, I need to add new multipoint features, which I already have working. But I also need to modify existing multipoint features. Since they need to share the same OBJECTID, do you know if I can provide an OBJECTID when adding a new feature? Or does the OBJECTID in the feature service needs to be set to editable: true in order to be able to do that?

Anyway, I really appreciate your help.

Thanks!

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor
  1. Correct the Editor widget is Not capable of multipoint.
  2. Yes the editor widget does have a edit toolbar that does support multipoint. Manipulating the editor widget may be a significant task though.
  3. No you can not provide an object id when editing. The FeatureServer Service does that for you. You will not get control of the ObjectId field.

You are likely better off forgetting the Editor widget (It just combines the out-of-the-box TemplatePicker,  AttachmentEditor, AttributeInspector and GeometryService to provide feature and attribute editing.) but because you need multipoint ability you are better off using the Edit toolbar and AttributeInspector.

Here is a sample you have likely seen for adding multipoint.

https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=toolbar_draw 

Editing multipoint is not anything I have a sample for or experience with.

0 Kudos
MarioEstevez
New Contributor II

Robert,

Thanks again for your help and advice. I was afraid that was going to be the case. I'll try to find a way to edit multipoints. I'll report back once I have a working solution or if I have any other questions.

Thanks!

0 Kudos
MarioEstevez
New Contributor II

Robert,

Thanks so much for your prompt reply.

This is the code that I'm working with. I just use the startup method of the editor.


        var layers = arrayUtils.map(evt.layers, function (result) {
            return { featureLayer: result.layer };
        });
        var settings = {
            map: map,
            templatePicker: templatePicker,
            layerInfos: layers,
            toolbarVisible: true,
            createOptions: {
                polylineDrawTools: [Editor.CREATE_TOOL_FREEHAND_POLYLINE],
                polygonDrawTools: [Editor.CREATE_TOOL_FREEHAND_POLYGON,
                  Editor.CREATE_TOOL_CIRCLE,
                  Editor.CREATE_TOOL_TRIANGLE,
                  Editor.CREATE_TOOL_RECTANGLE
                ],               
            },
            toolbarOptions: {
                reshapeVisible: true
            }
        };
        var params = { settings: settings };
        var myEditor = new Editor(params, 'editorDiv');
        //define snapping options
        var symbol = new SimpleMarkerSymbol(
          SimpleMarkerSymbol.STYLE_CROSS,
          15,
          new SimpleLineSymbol(
            SimpleLineSymbol.STYLE_SOLID,
            new Color([255, 0, 0, 0.5]),
            5
          ),
          null
        );
        map.enableSnapping({
            snapPointSymbol: symbol,
            tolerance: 20,
            snapKey: keys.ALT
        });

        myEditor.startup();
Thanks,
Mario E.
0 Kudos
BirajaNayak
Esri Contributor

Hi Mario,

Have you checked the method "setPoint" in multipoint class. You can update a point from multipoint created using this method.

Here is the web help link:

Multipoint | API Reference | ArcGIS API for JavaScript 3.27 

setPoint(index, point)

Updates the point at the specified index. (Added at v2.0)
Return type: Multipoint
Thanks,
Biraja
0 Kudos