给定点,绘制路径,点击point,弹出infoTemplate

var pt1=new Point( {"x":2262826.1689284374, "y": 548956.7494148497, "spatialReference": {"wkid": 102021 } });
var pt2=new Point( {"x":2261863.0518302172, "y": 548038.0813060887, "spatialReference": {"wkid": 102021 } });

var points = [pt1, pt2];
//create polyline
var line = new esri.geometry.Polyline(map.spatialReference);
line.addPath(points);

var pointSym = new esri.symbol.SimpleMarkerSymbol();
var lineSym = new esri.symbol.SimpleLineSymbol().setColor(new dojo.Color("blue"));
var infoTemplate = new esri.InfoTemplate("title","content");
var gLayer = new GraphicsLayer({
    "id" : "scratch"
});
// create a graphic
var pt1Graphic = new esri.Graphic(pt1, pointSym);
var pt2Graphic = new esri.Graphic(pt2, pointSym);
pt1Graphic.setInfoTemplate(infoTemplate);
pt2Graphic.setInfoTemplate(infoTemplate);
var lineGraphic = new esri.Graphic(line, lineSym);
// add it to the graphics layer
gLayer.add(lineGraphic);
gLayer.add(pt1Graphic);
gLayer.add(pt2Graphic);
// add the graphics layer to the map
map.addLayer(gLayer);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值