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);
给定点,绘制路径,点击point,弹出infoTemplate
最新推荐文章于 2024-04-27 11:46:25 发布