Custom Editor widget to copy/paste geometry between feature services?

3315
19
03-18-2016 09:32 AM
CoryCampbell1
New Contributor III

DOES IT EXIST

Has anyone already developed a custom Editor widget that includes functionality (GUI tools) to select one or more features (geometries) from one map/feature service and paste it into another feature service? For example, I don't want users to digitize polygon boundaries if those boundaries are available from another hosted service. Preferably the widget could be used with Web AppBuilder. Ideally, attributes would also copy over provided the field names/types are identical.

IF NOT, WHY NOT

This seems like functionality that would be in high demand, but it doesn't already exist in the Web AppBuilder Editor widget - so what are the limitations/constraints to including this kind of functionality? I've read several older posts for people customizing this functionality, and the API4JS docs seem to indicate that it's doable via cloning. Is it too difficult to allow configuration with template pickers, graphics and/or event layers, projection problems, client memory limits, read permissions limits, or something else?

19 Replies
AmberKelly
New Contributor III

Hi Ahna,

That would be great! Thank you kindly ☺

Cheers

Amber

0 Kudos
AhnaMiller2
Occasional Contributor

See commented script sample attached. Let me know if you have any questions! 

0 Kudos
AmberKelly
New Contributor III

Thanks Ahna, Ill get tinkering!

0 Kudos
JulieK
by
New Contributor III

Do the fields in both inlayer and outLayer have to match? as in does the schema have to match?

0 Kudos
GordonTyler
New Contributor II

Hi Amber,

Sorry for the misunderstanding. The script can be used to copy geometry and attribute values from one feature class to another provided it handles the any field mappings for attributes within the script. The 'featset' input variable gets its value from the feature that has been clicked on (regardless of which feature class it is part of - so long as geometry types match). The Featset then gives access to attributes and geometry so you can copy them to the output feature.

Hope that helps,

Gordon

AmberKelly
New Contributor III

Got it! It’s a steep learning curve I’m on it seems ☺. Thanks for your explanation!

0 Kudos
ChelseyAiton2
New Contributor III

I am working on something very similar but must not have something correct in my python tool. What I am trying to do is have the user add a csv file to the web map using the Add Data widget. This widget will geocode some addresses and add the data as an operational point layer to the map. I would then like a geoprocessing service to copy this operational layer into an existing feature service. To simplify my process, I am currently trying to insert one sample feature layer into another (same schema), with no luck. My gp service was created from a simple python script, added as a script tool and the results published to ArcGIS Server from ArcMap 10.7. The tool runs perfectly from Arcmap, there are no errors when I publish, and there are no errors when I add the service to the gp widget in Web AppBuilder. Message level is set to "Info."

I based my script off of the one ahna.miller posted in December. This script uses a search and insert cursor. (I have also tried using the append tool) The tool parameter data type is Feature Set. This tool has two inputs with no outputs. Maybe the gp service could be having an issue with this as there is no output layer?

My source data is registered with the Data Store. Anyone have other suggestions?

JulieK
by
New Contributor III

Did you get this to work? Will this take the features selected by the Select widget in WAB? 

0 Kudos
ChelseyAiton2
New Contributor III

No, I did not get this to work. I receive no error messages when publishing or running the tool with the GP widget in WAB. It does take the features selected by the Select widget and the GP widget. However, no output is added to an existing feature service. It makes me wonder if the edits are getting saved.

0 Kudos
AmberKelly
New Contributor III

Hey everyone,

I found an AGOL widget that will do this process for me - hopefully will help most of you as well. The Smart Editor widget in web app builder allows you to copy polygons from one layer and copy to another, while copying over attributes (provided schemas are matching).

Tick:

Allow user to create new features from existing features option

and

Copied feature values override defaults

Then click on New Feature, then from the drop down "Select features to copy" option in the tool and drag select the polygons you'd like to copy. 

0 Kudos