1、新增—— //新Graphic需要几何geometry和属性attributes
//可以是newGraphics ,也可以是newGraphic
var newGraphics = [];
dojo.forEach(map.graphics.graphics, function (graphic) {
var newGraphic = new esri.Graphic(graphic.geometry, null, newAttributes);
newGraphics.push(newGraphic);
});
//featureLayer= new esri.layers.FeatureLayer("http://192.168.30.28/ArcGIS/rest/services/shopSecond/FeatureServer/1");
featureLayer.applyEdits(newGraphics, null, null); //增加 applyEdits(<Graphic[]> adds, null, null);
2、 var landusePointLayer = new esri.layers.FeatureLayer("http://192.168.30.28/ArcGIS/rest/services/shopSecond/FeatureServer/1", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
// opacity: 0.5,
id: "HotspotLayer"
});
map.addLayers([landusePointLayer]);
dojo.connect(map, "onLayersAddResult", initEditing);
3、删除—— featureLayer.applyEdits(null, null, [evt.graphic]); //删除 applyEdits(null, null ,<Graphic[]> deletes );
4、修改—— featureLayer.applyEdits(null, [evt.graphic], null); //修改 applyEdits(null, <Graphic[]> updates, null);
5、有三层数据得到地理数据
photoInfoData的创建……
popupTemplate的创建……
var pt = new esri.geometry.Point(photoInfoData[i].x, photoInfoData[i].y, map.spatialReference); //问题第一部分主要出在这里
var evtSymbol = new esri.symbol.SimpleMarkerSymbol().setColor("red");
var graphic = new esri.Graphic(pt, evtSymbol, photoInfoData[i].attributes);
graphic.setInfoTemplate(popupTemplate);
countiesGraphicsLayer.add(graphic);