Select to view content in your preferred language

merge/append temporary featurelayer in Javascript

1085
5
11-10-2021 01:46 AM
NehaKshirsagar
Emerging Contributor

@RobertScheitlin__GISP 

Hi I wanted (to create widget) to make temporary featurelayer with same records as existing Polyline featurelayer with >>featureForm(to feed attributes by users)+ geometry(default to be feed in code) and append/merge this record to existing featurelayer.. Basically I wanted to skip editor and add default geometry with records in code and then in featurelayer. How could I achieve this ?

0 Kudos
5 Replies
KarenRobine1
Regular Contributor

Just create a graphicsLayer and add in your features.  From there you can essentially create your own editor widget to add in users attributes, and use the Feature Service Editor REST endpoint to upload the changes or additions to the actual feature service.   Alternatively, you can have the user select the feature(s) to be edited and then create your own editor to edit the original features.  Again,  send your edits directly to the REST endpoint. You can modify, delete, add features just using the endpoint (no need for a Graphics layer).

0 Kudos
NehaKshirsagar
Emerging Contributor

Hello @KarenRobine1 ,

I could able to understand your first point. i.e. creating graphic layer..

Can you please explain me how it should be done i.e. creating temporary featurelayer(same schema/fields data as original one for merging/ appending) with attribute from user + geometry as default(static) and appending to existing featurelayer using code.

 

 

0 Kudos
KarenRobine1
Regular Contributor

Use a graphics layer to copy the edit features into and make the changes on the client.  The geometry Service, https://developers.arcgis.com/javascript/3/jsapi/geometryservice-amd.html or Geometry Engine, https://developers.arcgis.com/javascript/3/jsapi/esri.geometry.geometryengine-amd.html  all offer routines that can be used to append or merge graphics together. Once you get the graphic(s) you've changed, then you can use the REST API, ApplyEdits,  https://developers.arcgis.com/rest/services-reference/enterprise/apply-edits-feature-service-.htm  or https://developers.arcgis.com/rest/services-reference/enterprise/apply-edits-feature-service-layer-.... to make the changes to the actual features. There's also the ability to snap lines together (etc etc).... You can create a whole edit workflow using this methodology.

CourtneyMenikheim
Frequent Contributor

Have the user select the geometries they want to merge.


Use the Geometry Service or Geometry Engine (referenced by @KarenRobine1 ) to union the geometries.

Prompt the user to provide the values for the attributes.

Create a new graphic with the geometry from the union. At the same time, you can set the attribute values. You do not need to have a value for every attribute. Any attributes not included will be set to the default value for that field by the service when the graphic is added.

Make an applyEdits call to the feature layer and include the new graphic as an add. If you want to remove the features you used for the union, you can include them in the call as deletes.

Courtney Menikheim | Application Developer | @thecmenikheim
0 Kudos
NehaKshirsagar
Emerging Contributor

user should only able to input attribute data & not allowed to add geometry(It should be given by default geometry i.e.  onclick selected feature it should not(skipping/bypassing) take geometry to draw in map ). It should directly open attribute table to feed attribute>> after submitting, data should update with featurelayer. 

0 Kudos