giscore
v1.1.3
Published
A funtional encapsulation package for 3H GIS applications.
Downloads
2
Readme
使用手册
使用NPM命令获取giscore:
npm install giscore
以Vue2.0框架为例,搭建框架后,在vue.config.js添加如下配置:
const { defineConfig } = require('@vue/cli-service')
const path = require("path")
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
const CopyWebpackPlugin = require("copy-webpack-plugin")
const cesiumSource = 'node_modules/cesium/Source';
const cesiumWorkers = '../Build/Cesium/Workers';
module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: {
plugins: [new NodePolyfillPlugin()],
resolve: {
fallback: {
"url": false,
"http": false,
"https": false,
"zlib": false
}
},
plugins: [
// Copy Cesium Assets, Widgets, and Workers to a static directory
new CopyWebpackPlugin({
patterns: [
{ from: path.join(cesiumSource, cesiumWorkers), to: 'Workers' },
{ from: path.join(cesiumSource, 'Assets'), to: 'Assets' },
{ from: path.join(cesiumSource, 'Widgets'), to: 'Widgets' },
{ from: path.join(cesiumSource, 'ThirdParty'), to: 'ThirdParty' }
]
}),
],
module: {
unknownContextRegExp: /^('|')\.\/.*?\1$/,
unknownContextCritical: false
}
}
})
在Vue入口文件引入GisCore SDK及GisCore配置文件:
import { GisCore } from 'giscore'
import { config } from 'giscore/giscore.config'
在初始化方法调用(accessToken可联系开发者获取Token获取方法):
测试Token:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhZjNjZjBlNC03NmFiLTQ2YjgtYmZhZC0wY2QwY2IxNmUxYWMiLCJpZCI6MTc1NzkyLCJpYXQiOjE3MDQ0MzU4OTB9.wphDRUr7J7LRUHRxsYaPk7mbz-0Ct9czww9lsbRGi_E
// 初始化giscore
let gisCore = new GisCore(config, accessToken);
gisCore.init("giscoreContainer");
let viewer = window.viewer;
在前端界面新增一段用于存放GIS显示区域的div(通过css样式修改可以将GIS显示区域调整为全屏,这里展示未作修改的样式):
<div id="giscoreContainer"></div>
运行命令npm run serve,即可看到GisCore SDK已初始化完毕。关于SDK相关开发文档稍后整理。