Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking to build a new application that allows staff to edit a service/layer. They will be inputting new survey benchmark data based on lat/long.

All of the current samples I have seen on the ESRI site show the editing done by clicking a point on a map and then populating the fields in the popup.

My goal would be to input the fields first and then have the app recognize the x,y and draw new point.

This would eliminate the error of the spot being clicked not actually being the correct coordinates.

Also, they will be doing the input at the office, so enabling GPS or similar in the app won't be helpful.

Does anybody know of a sample or way to do this?

share|improve this question
up vote 4 down vote accepted

Basically, set up your own textboxes, select boxes, etc. Put an onclick event handler on the submit button (dojo.connect()). Get the values from the entry boxes. Then use the long/lat and other attributes that you collect, create a geometry and attribute object, create a graphic from them and then send it to your editable feature layer using editableFeatureLayer.applyEdits

//create a graphic
var pt = new esri.geometry.Point(-118.15, 33.80, new esri.SpatialReference({ wkid: 4326 }));
var attr = {"Xcoord":evt.mapPoint.x,"Ycoord":evt.mapPoint.y,"Plant":"Mesa Mint"};
var addGraphic = new esri.Graphic(pt,null,attr,null);

//you can add more attributes to the graphic
var d = new Date();
addGraphic.attributes.Updated_By = loginName;
addGraphic.attributes.Updated_Date = d.getTime();

//Using your editable feature layer add the graphic
editableFeatureLayer.applyEdits([addGraphic], null, null, function (adds, updates, deletes) {
    var query = new esri.tasks.Query();
    query.objectIds = [adds[0].objectId];
    //highlight on the map after adding if you want
    editableFeatureLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function () {
    dojo.byId('infoPane').innerHTML = "Added feature successfully<br />OBJECTID: " + adds[0].objectId + "<br />";
{   // if errors
    dojo.byId('infoPane').innerHTML = "Error during add operation";
share|improve this answer
thanks for the answer. any chance you have a fiddle that would show this? – Craig Apr 11 '13 at 12:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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