VueCLI使用ArcGIS API for JavaScript(七)

it2026-03-03  5

Arcgis地图添加文字标注

还是直接上代码 按需引入文件

esri.loadModules([ "esri/graphic", "esri/symbols/TextSymbol", "esri/geometry/Point", 'dojo/domReady!', ]) .then(([ Graphic, TextSymbol, Point ]) => { // 设置中心点添加样式 const showPoint = data.geometry.getExtent().getCenter(); // 文字添加的位置,多边形中心点 const pointLocation = new Point(showPoint); // 要添加的文字 const textsymbol = new TextSymbol('测试'); // 文字的颜色 textsymbol.setColor('white'); // 生成对应图形 let graphic = new Graphic(pointLocation, textsymbol); // 添加进地图中 this.map.graphics.add(graphic); })

更多样式自己摸索吧,就说个最简单的添加标注

最新回复(0)