@tcgis/gtc-common v1.0.0
GTC-SDK
GTC-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 technologyRun examples
yarn run build
yarn run serverInstallation
NPM / YARN (Recommend)
Installing with NPM or YARN is recommended and it works seamlessly with webpack.
yarn add @tcgis/gtc-sdk
-------------------------
npm install @tcgis/gtc-sdkimport * as GTC from '@tcgis/gtc-sdk'
import '@tcgis/gtc-sdk/dist/gtc.min.css'Configuration
The configuration is mainly used in the
NPM / YARNway
Since the GTC framework sets CESIUM_BASE_URL to ./libs/gtc-sdk/resources/ , you need to copy Cesium related static resources files: Assets , Workers , ThirdPartyto libs/gtc-sdk/resources directory of the project to ensure that the 3D scene can be rendered properly. You can also use GTC.config.baseUrl to set the static resource base related to Cesium .
Webpack
// webpack.config.js
const path = require('path')
const CopywebpackPlugin = require('copy-webpack-plugin')
const tcgisDist = './node_modules/@tcgis'
module.exports = {
plugins: [
new CopyWebpackPlugin([
{
from: path.join(tcgisDist, 'gtc-sdk/dist/resources'),
to: 'libs/gtc-sdk/resources',
},
]),
],
}Vue2.x
// vue.config.js
const path = require('path')
const CopywebpackPlugin = require('copy-webpack-plugin')
const tcgisDist = './node_modules/@tcgis'
module.exports = {
chainWebpack: (config) => {
config.plugin('copy').use(CopywebpackPlugin, [
[
{
from: path.join(tcgisDist, 'gtc-sdk/dist/resources'),
to: 'libs/gtc-sdk/resources',
},
],
])
},
}Vue3.x
// vue.config.js
const path = require('path')
const CopywebpackPlugin = require('copy-webpack-plugin')
const tcgisDist = './node_modules/@tcgis'
module.exports = {
chainWebpack: (config) => {
config.plugin('copy').use(CopywebpackPlugin, [
{
patterns: [
{
from: path.join(tcgisDist, 'gtc-sdk/dist/resources'),
to: path.join(__dirname, 'dist', 'libs/gtc-sdk/resources'),
},
],
},
])
},
}vite
// vite.config.js
import { defineConfig } from 'vite'
import GTC from '@tcgis/vite-plugin-gtc'
export default defineConfig({
plugins: [GTC()],
})Start
global.GTC = GTC
GTC.ready({}).then(()=>{
let viewer = new GTC.Viewer()
})Thanks
8 months ago