Select to view content in your preferred language

Editing - move point to XY coordinate...

3395
2
08-15-2013 02:14 PM
KenMorefield
Regular Contributor
Can anyone post a code sample that would allow editing of point data by moving existing (selected) point and moving it to user specified coordinates?  The workflow would basically allow the user to "correct" the point location by specifying lat/long coordinates. 
1.  User selects point
2.  User inputs Latitude and Longitude into text boxes
3.  User clicks a submit button which permanently moves the point using the editor.

I've successfully done something similar by grabbing attributes from existing point layer, drawing a new graphic based on user defined Lat/Long, appending point attributes to graphic, and then execute a geoprocessing service creating a new layer.  I'm hoping to streamline the workflow by just using the editor widget directly...

Thanks a bunch,
Ken
0 Kudos
2 Replies
JasonZou
Frequent Contributor
To my understanding, Editor dijit and Edit toolbar are mainly designed to allow the users to interact with the edit, meaning user click to add a new feature or click on an existing feature and drag to move a new location. In your case, the user needs not to change the location manually. I don't think using Editor dijit and/or Edit toolbar is needed.

What you can do is to create a feature layer that will be edited. Then as you mentioned in the workflow, select an existing feature, then in the callback function. Below code is using dojo/on event. To use dojo.connect, follow the legacy way mentioned in the api.

featLayer.on("click", function(response) {
[INDENT]var geom = response.graphic.geometry;
geom.setLatitude(lat);
geom.setLongitude(lon);

featLayer.applyEdits(null, [response.graphic], null);[/INDENT]
});
0 Kudos
KenMorefield
Regular Contributor
Thanks Jason!  I'll give that a try tomorrow and post back with the results...

Ken
0 Kudos