I'm trying to add a point to a featureLayer. The user clicks on a point on the map, it is added to the featureLayer. It works but when the point is displayed it is shifted down and to the left of where the point was originally put on the map. When I step through the code I can see that the point going into newGraphic is the same as where the pointer is on the map, but when it is then redisplayed on the map it is shifted down and to the left. The pointer is an arrow and the point that is added ends up on the lower left portion of the head of the arrow instead of at the tip. I have compared my code to every piece I can find that works correctly but cannot find a setting or something that I may have missed.
drawToolbar.on("draw-end", function(evt) {
var scale = scaleUtils.getScale(map);
if(scale>24000.1){
alert("Please zoom in. Editing is not allowed at Map Scales less than 1:24,000.");
}else{
DisplayUtil.showLoading();
drawToolbar.deactivate();
editToolbar.deactivate();
var newAttributes = lang.mixin({}, selectedTemplate.template.prototype.attributes);
newAttributes.BUSINESSID = document.gisStartForm.businessId.value;
newAttributes.GIS_LOC_ID = document.gisStartForm.gisLocationId.value;
newAttributes.CREATEDBY = document.gisStartForm.userId.value;
newAttributes.DATECREATE = getTime();
var newGraphic = new Graphic(evt.geometry, null, newAttributes);
selectedTemplate.featureLayer.applyEdits([newGraphic], null, null
, function(addResults){
result = addResults[0];
if(result.success){
sketchExists = true;
pointExists = true;
pointModified = false;
pausejs(3000);
DisplayUtil.showTools();
selectPoint(newGraphic);
pointFeature = newGraphic;
document.gisStartForm.systemMessages.value = "null";
DisplayUtil.showMessages();
} else {
DisplayUtil.showTools();
applyEditsErrorHandler(result);
}
DisplayUtil.hideLoading();
}
, defaultErrorHandler);
}
//determine if point is within state boundaries
withinStateBoundary(newGraphic);
});
Laura,
What coordinate system is your feature layer that you are adding the feature to?
IM Renderer Page
UTM NAD 83 Zone 15 |
Laura,
Then you need to re-project your evt.geometry, if your base map is not in UTM NAD 83 Zone 15 (as most esri basemaps are in Web Mercator).
We have our own base map that was built in UTM NAD 83 Zone 15.
Laura,
Ok, that is strange then. Have you tried to compare the XY data from the evt.geometry to what is actually recorded in the Feature service after the apply edits?
Yes, we have compared them. The accuracy is dependent on the scale at which you are zoomed to when the point is placed. There is a difference.
Laura,
Sounds like you need to give esri tech support a call on this.
Do you also have a problem with the map not zooming in and out to where the mouse is? Use "map.reposition()" and/or "map.resize()" after it's loaded.
Not that I have noticed.