1.0.1 • Published 4 years ago

sp-gis5 v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

文档管理 jsduck

1、集成 DCSDK

安装

   npm install xxx

webpack配置

const path = require('path'); //引入node.js的path模块,用于处理文件路径
const CopyWebpackPlugin = require('copy-webpack-plugin');
const spgisDist = './node_modules/sp-gis2'
plugins: [
        new CopyWebpackPlugin({
            patterns: [
                {
                    from: path.join(path.resolve(__dirname, spgisDist), '/dist/libs/dc-sdk/resources'),
                    to: __dirname+'/dist/libs/dc-sdk/resources',
                },
            ],
        })
    ],

使用

import  'sp-gis2'

const mapid = "viewer-container"
let div = document.createElement("div")
div.id = mapid
div.style.width = "100%"
div.style.height = "100%"
document.body.appendChild(div)

SP.init(mapid,()=>{
  let baselayer = SP.DC.ImageryLayerFactory.createGoogleImageryLayer({
    style: 'img'
  })
  SP.dcviewer.addBaseLayer(baselayer)
})