npm install --save @types/arcgis-js-api@3
使用方法:
loadModules(['esri/layers/GraphicsLayer', 'esri/geometry/Polygon', 'esri/graphic', 'esri/symbols/SimpleFillSymbol', 'esri/symbols/SimpleLineSymbol', 'esri/Color']).then(res => { const [GraphicsLayer, Polygon, Graphic, SimpleFillSymbol, SimpleLineSymbol, Color] = res as MapModules; const layer = new GraphicsLayer({ id: 'townsLayer' }); var polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([39, 209, 155, 0.8]), 3), new Color([151, 249, 0, 0])); townsData.features.forEach(item => { const { properties, geometry } = item; const { coordinates } = geometry; var polygonJson = { rings: coordinates, spatialReference: { wkid: 4490 }, }; var polygon = new Polygon(polygonJson); const graphic = new Graphic(polygon, polygonSymbol, properties); layer.add(graphic); }); map.addLayer(layer);
发表评论
侧栏公告
寄语
譬如朝露博客是一个分享前端知识的网站,联系方式11523518。
热评文章
标签列表
热门文章
友情链接