1. 申明三个包
- esri/layers/GraphicsLayer
- esri/Graphic
-
esri/geometry/Point
2. 申明 GraphicsLayer 并且 add 到 map 外面
3. 初始化图片标记点并且 add 到 GraphicsLayerasync ShowLocation() { let that = this const Graphic = await arcgisPackage.Graphic const GraphicsLayer = await arcgisPackage.GraphicsLayer const Point = await arcgisPackage.Point let layer = new GraphicsLayer() that.map.add(layer) var symbol = { type: "picture-marker", url: require('../../../assets/img/onepicture/ta.png'),// 图片地址 width: "64px", height: "64px" }; var point = new Point(103.880812,27.802255); var gp = new Graphic(point,symbol); layer.graphics.add(gp); },