一段加载地图并且设置点符号样式代码

dojo.declare("PThemeData",null,{
map:null,//地图对象
json:null,//点图层数据json格式
defualtSym:null,//默认点符号样式
graphicLayer:null,
constructor:function(_json,_map){
this.map=_map;
this.json=_json;
//构造默认点符号样式
this.defualtSym= new esri.symbol.PictureMarkerSymbol('http://static.arcgis.com/images/Symbols/Basic/RedFlag.png', 40, 40);


},
//构造graphicLayer
markRenderer:function(layerName)
{
this.graphicLayer=new esri.layers.GraphicsLayer();//定义一个专题图层
this.graphicLayer.name=layerName;
this.map.addLayer(this.graphicLayer,layerMumFlag);
layerMumFlag=layerMumFlag+1;
for(var i=0;i {
var xloc=this.json[i].st_x;//x坐标
var yloc=this.json[i].st_y;//y坐标
var pt = new esri.geometry.Point(xloc,yloc,this.map.spatialReference);
var attr =this.json[i];
var infoTemplate = new esri.InfoTemplate("专题点信息");
var graphic;
graphic = new esri.Graphic(pt,this.defualtSym,attr,infoTemplate);
this.graphicLayer.add(graphic);
}
},
});

你可能感兴趣的:(arcgis,for,javascript,API)