arcgis for javascript加载地区行政边界代码

map = new Map(“map”, {
    center : [ 120.160338, 32.325512 ],
    zoom : 9,
    logo : false,
    slider : false,
    sliderPosition : ‘bottom-right’
//  infoWindow : popup
});
map.addLayer(baseMap);
 
$.map.layer = new esri.layers.GraphicsLayer();
$.map.txtLayer = new esri.layers.GraphicsLayer();
 
var layer = $.map.layer;
var symbol = new esri.symbol.SimpleFillSymbol(
        esri.symbol.SimpleFillSymbol.STYLE_NULL,
        new esri.symbol.SimpleLineSymbol(
                esri.symbol.SimpleLineSymbol.STYLE_SOLID,
                new esri.Color([255, 0, 51, 0.45]),
                5
        ));
$.get(‘../gis/AjaxUserAreaInfo.json?method=info’,//获取经纬度信息如”points”:”121.107678, 31.768678;121.16355, 31.8022;121.209973……
 
        function(data){
 
    var graphics = [];
    var points = data.points.split(‘;’);
    var dataIntArr = [];
    dojo.forEach(points,function(data){
        var point = [];
        dojo.forEach(data.split(‘,’),function(data){
            point.push(data);
        });
        dataIntArr.push(point);
    });
    var polygon = new esri.geometry.Polygon();
    polygon.addRing(dataIntArr);
    var graphic = new esri.Graphic(polygon,symbol);
    layer.add(graphic);
    graphics.push(graphic);
    map.addLayer(layer,0);
});

你可能感兴趣的:(JavaScript,arcgis)