GM-SDK
is based on the open source project Cesium
for the second development of two three-dimensional WebGis
application framework , the framework optimizes the use of Cesium
and adds some additional features , designed for developers to quickly build WebGis
application.
Tips:This SDK is JS+GIS framework package. Developers need to have some front-end technology and GIS related technology
yarn run build
yarn run server
NPM / YARN
(Recommend)
Installing with NPM or YARN is recommended and it works seamlessly with webpack.
yarn add @gmgis/gm-sdk
-------------------------
npm install @gmgis/gm-sdk
import * as GM from '@gmgis/gm-sdk'
import '@gmgis/gm-sdk/dist/gm.min.css'
The configuration is mainly used in the
NPM / YARN
way
Since the GM
framework sets CESIUM_BASE_URL
to ./libs/gm-sdk/resources/
, you need to copy Cesium
related static resources files: Assets
, Workers
, ThirdParty
to libs/gm-sdk/resources
directory of the project to ensure that the 3D scene can be rendered properly. You can also use GM.config.baseUrl
to set the static resource base related to Cesium
.
Vue3.x
// vue.config.js
const path = require('path')
const CopywebpackPlugin = require('copy-webpack-plugin')
const gmgisDist = './node_modules/@gmgis'
module.exports = {
chainWebpack: (config) => {
config.plugin('copy').use(CopywebpackPlugin, [
{
patterns: [
{
from: path.join(gmgisDist, 'gm-sdk/dist/resources'),
to: path.join(__dirname, 'dist', 'libs/gm-sdk/resources'),
},
],
},
])
},
}
vite
// vite.config.js
import { defineConfig } from 'vite'
import GM from '@gmgis/vite-plugin-gm'
export default defineConfig({
plugins: [GM()],
})
global.GM = GM
GM.ready({}).then(()=>{
let viewer = new GM.Viewer()
})
if gm-sdk can bring benefits to you, please support it ~