600653b5 by unknown

'init'

0 parents
Showing 53 changed files with 3407 additions and 0 deletions
1 {
2 "presets": [
3 ["env", {
4 "modules": false,
5 "targets": {
6 "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7 }
8 }],
9 "stage-2"
10 ],
11 "plugins": ["transform-vue-jsx", "transform-runtime"]
12 }
1 root = true
2
3 [*]
4 charset = utf-8
5 indent_style = space
6 indent_size = 2
7 end_of_line = lf
8 insert_final_newline = true
9 trim_trailing_whitespace = true
1 .DS_Store
2 node_modules/
3 /dist/
4 npm-debug.log*
5 yarn-debug.log*
6 yarn-error.log*
7
8 # Editor directories and files
9 .idea
10 .vscode
11 *.suo
12 *.ntvs*
13 *.njsproj
14 *.sln
1 // https://github.com/michael-ciniawsky/postcss-load-config
2
3 module.exports = {
4 "plugins": {
5 "postcss-import": {},
6 "postcss-url": {},
7 // to edit target browsers: use "browserslist" field in package.json
8 "autoprefixer": {}
9 }
10 }
1 # mybox
2
3 > A Vue.js project
4
5 ## Build Setup
6
7 ``` bash
8 # install dependencies
9 npm install
10
11 # serve with hot reload at localhost:8080
12 npm run dev
13
14 # build for production with minification
15 npm run build
16
17 # build for production and view the bundle analyzer report
18 npm run build --report
19 ```
20
21 For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
1 'use strict'
2 require('./check-versions')()
3
4 process.env.NODE_ENV = 'production'
5
6 const ora = require('ora')
7 const rm = require('rimraf')
8 const path = require('path')
9 const chalk = require('chalk')
10 const webpack = require('webpack')
11 const config = require('../config')
12 const webpackConfig = require('./webpack.prod.conf')
13
14 const spinner = ora('building for production...')
15 spinner.start()
16
17 rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18 if (err) throw err
19 webpack(webpackConfig, (err, stats) => {
20 spinner.stop()
21 if (err) throw err
22 process.stdout.write(stats.toString({
23 colors: true,
24 modules: false,
25 children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
26 chunks: false,
27 chunkModules: false
28 }) + '\n\n')
29
30 if (stats.hasErrors()) {
31 console.log(chalk.red(' Build failed with errors.\n'))
32 process.exit(1)
33 }
34
35 console.log(chalk.cyan(' Build complete.\n'))
36 console.log(chalk.yellow(
37 ' Tip: built files are meant to be served over an HTTP server.\n' +
38 ' Opening index.html over file:// won\'t work.\n'
39 ))
40 })
41 })
1 'use strict'
2 const chalk = require('chalk')
3 const semver = require('semver')
4 const packageConfig = require('../package.json')
5 const shell = require('shelljs')
6
7 function exec (cmd) {
8 return require('child_process').execSync(cmd).toString().trim()
9 }
10
11 const versionRequirements = [
12 {
13 name: 'node',
14 currentVersion: semver.clean(process.version),
15 versionRequirement: packageConfig.engines.node
16 }
17 ]
18
19 if (shell.which('npm')) {
20 versionRequirements.push({
21 name: 'npm',
22 currentVersion: exec('npm --version'),
23 versionRequirement: packageConfig.engines.npm
24 })
25 }
26
27 module.exports = function () {
28 const warnings = []
29
30 for (let i = 0; i < versionRequirements.length; i++) {
31 const mod = versionRequirements[i]
32
33 if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
34 warnings.push(mod.name + ': ' +
35 chalk.red(mod.currentVersion) + ' should be ' +
36 chalk.green(mod.versionRequirement)
37 )
38 }
39 }
40
41 if (warnings.length) {
42 console.log('')
43 console.log(chalk.yellow('To use this template, you must update following to modules:'))
44 console.log()
45
46 for (let i = 0; i < warnings.length; i++) {
47 const warning = warnings[i]
48 console.log(' ' + warning)
49 }
50
51 console.log()
52 process.exit(1)
53 }
54 }
1 'use strict'
2 const path = require('path')
3 const config = require('../config')
4 const ExtractTextPlugin = require('extract-text-webpack-plugin')
5 const packageConfig = require('../package.json')
6
7 exports.assetsPath = function (_path) {
8 const assetsSubDirectory = process.env.NODE_ENV === 'production'
9 ? config.build.assetsSubDirectory
10 : config.dev.assetsSubDirectory
11
12 return path.posix.join(assetsSubDirectory, _path)
13 }
14
15 exports.cssLoaders = function (options) {
16 options = options || {}
17
18 const cssLoader = {
19 loader: 'css-loader',
20 options: {
21 sourceMap: options.sourceMap
22 }
23 }
24
25 const postcssLoader = {
26 loader: 'postcss-loader',
27 options: {
28 sourceMap: options.sourceMap
29 }
30 }
31
32 // generate loader string to be used with extract text plugin
33 function generateLoaders (loader, loaderOptions) {
34 const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
35
36 if (loader) {
37 loaders.push({
38 loader: loader + '-loader',
39 options: Object.assign({}, loaderOptions, {
40 sourceMap: options.sourceMap
41 })
42 })
43 }
44
45 // Extract CSS when that option is specified
46 // (which is the case during production build)
47 if (options.extract) {
48 return ExtractTextPlugin.extract({
49 use: loaders,
50 fallback: 'vue-style-loader'
51 })
52 } else {
53 return ['vue-style-loader'].concat(loaders)
54 }
55 }
56
57 // https://vue-loader.vuejs.org/en/configurations/extract-css.html
58 return {
59 css: generateLoaders(),
60 postcss: generateLoaders(),
61 less: generateLoaders('less'),
62 sass: generateLoaders('sass', { indentedSyntax: true }),
63 scss: generateLoaders('sass'),
64 stylus: generateLoaders('stylus'),
65 styl: generateLoaders('stylus')
66 }
67 }
68
69 // Generate loaders for standalone style files (outside of .vue)
70 exports.styleLoaders = function (options) {
71 const output = []
72 const loaders = exports.cssLoaders(options)
73
74 for (const extension in loaders) {
75 const loader = loaders[extension]
76 output.push({
77 test: new RegExp('\\.' + extension + '$'),
78 use: loader
79 })
80 }
81
82 return output
83 }
84
85 exports.createNotifierCallback = () => {
86 const notifier = require('node-notifier')
87
88 return (severity, errors) => {
89 if (severity !== 'error') return
90
91 const error = errors[0]
92 const filename = error.file && error.file.split('!').pop()
93
94 notifier.notify({
95 title: packageConfig.name,
96 message: severity + ': ' + error.name,
97 subtitle: filename || '',
98 icon: path.join(__dirname, 'logo.png')
99 })
100 }
101 }
1 'use strict'
2 const utils = require('./utils')
3 const config = require('../config')
4 const isProduction = process.env.NODE_ENV === 'production'
5 const sourceMapEnabled = isProduction
6 ? config.build.productionSourceMap
7 : config.dev.cssSourceMap
8
9 module.exports = {
10 loaders: utils.cssLoaders({
11 sourceMap: sourceMapEnabled,
12 extract: isProduction
13 }),
14 cssSourceMap: sourceMapEnabled,
15 cacheBusting: config.dev.cacheBusting,
16 transformToRequire: {
17 video: ['src', 'poster'],
18 source: 'src',
19 img: 'src',
20 image: 'xlink:href'
21 }
22 }
1 'use strict'
2 const path = require('path')
3 const utils = require('./utils')
4 const config = require('../config')
5 const vueLoaderConfig = require('./vue-loader.conf')
6
7 function resolve (dir) {
8 return path.join(__dirname, '..', dir)
9 }
10
11
12
13 module.exports = {
14 context: path.resolve(__dirname, '../'),
15 entry: {
16 app: './src/main.js'
17 },
18 externals: {
19 'mapbox-gl': 'mapboxgl',
20 },
21 output: {
22 path: config.build.assetsRoot,
23 filename: '[name].js',
24 publicPath: process.env.NODE_ENV === 'production'
25 ? config.build.assetsPublicPath
26 : config.dev.assetsPublicPath
27 },
28 resolve: {
29 extensions: ['.js', '.vue', '.json'],
30 alias: {
31 'vue$': 'vue/dist/vue.esm.js',
32 '@': resolve('src'),
33 }
34 },
35 module: {
36 rules: [
37 {
38 test: /\.vue$/,
39 loader: 'vue-loader',
40 options: vueLoaderConfig
41 },
42 {
43 test: /\.js$/,
44 loader: 'babel-loader',
45 include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
46 },
47 {
48 test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
49 loader: 'url-loader',
50 options: {
51 limit: 10000,
52 name: utils.assetsPath('img/[name].[hash:7].[ext]')
53 }
54 },
55 {
56 test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
57 loader: 'url-loader',
58 options: {
59 limit: 10000,
60 name: utils.assetsPath('media/[name].[hash:7].[ext]')
61 }
62 },
63 {
64 test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
65 loader: 'url-loader',
66 options: {
67 limit: 10000,
68 name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
69 }
70 }
71 ]
72 },
73 node: {
74 // prevent webpack from injecting useless setImmediate polyfill because Vue
75 // source contains it (although only uses it if it's native).
76 setImmediate: false,
77 // prevent webpack from injecting mocks to Node native modules
78 // that does not make sense for the client
79 dgram: 'empty',
80 fs: 'empty',
81 net: 'empty',
82 tls: 'empty',
83 child_process: 'empty'
84 }
85 }
1 'use strict'
2 const utils = require('./utils')
3 const webpack = require('webpack')
4 const config = require('../config')
5 const merge = require('webpack-merge')
6 const path = require('path')
7 const baseWebpackConfig = require('./webpack.base.conf')
8 const CopyWebpackPlugin = require('copy-webpack-plugin')
9 const HtmlWebpackPlugin = require('html-webpack-plugin')
10 const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
11 const portfinder = require('portfinder')
12
13 const HOST = process.env.HOST
14 const PORT = process.env.PORT && Number(process.env.PORT)
15
16 const devWebpackConfig = merge(baseWebpackConfig, {
17 module: {
18 rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
19 },
20 // cheap-module-eval-source-map is faster for development
21 devtool: config.dev.devtool,
22
23 // these devServer options should be customized in /config/index.js
24 devServer: {
25 clientLogLevel: 'warning',
26 historyApiFallback: {
27 rewrites: [
28 { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
29 ],
30 },
31 hot: true,
32 contentBase: false, // since we use CopyWebpackPlugin.
33 compress: true,
34 host: HOST || config.dev.host,
35 port: PORT || config.dev.port,
36 open: config.dev.autoOpenBrowser,
37 overlay: config.dev.errorOverlay
38 ? { warnings: false, errors: true }
39 : false,
40 publicPath: config.dev.assetsPublicPath,
41 proxy: config.dev.proxyTable,
42 quiet: true, // necessary for FriendlyErrorsPlugin
43 watchOptions: {
44 poll: config.dev.poll,
45 }
46 },
47 plugins: [
48 new webpack.DefinePlugin({
49 'process.env': require('../config/dev.env')
50 }),
51 new webpack.HotModuleReplacementPlugin(),
52 new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
53 new webpack.NoEmitOnErrorsPlugin(),
54 // https://github.com/ampedandwired/html-webpack-plugin
55 new HtmlWebpackPlugin({
56 filename: 'index.html',
57 template: 'index.html',
58 inject: true
59 }),
60 // copy custom static assets
61 new CopyWebpackPlugin([
62 {
63 from: path.resolve(__dirname, '../static'),
64 to: config.dev.assetsSubDirectory,
65 ignore: ['.*']
66 }
67 ])
68 ]
69 })
70
71 module.exports = new Promise((resolve, reject) => {
72 portfinder.basePort = process.env.PORT || config.dev.port
73 portfinder.getPort((err, port) => {
74 if (err) {
75 reject(err)
76 } else {
77 // publish the new Port, necessary for e2e tests
78 process.env.PORT = port
79 // add port to devServer config
80 devWebpackConfig.devServer.port = port
81
82 // Add FriendlyErrorsPlugin
83 devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
84 compilationSuccessInfo: {
85 messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
86 },
87 onErrors: config.dev.notifyOnErrors
88 ? utils.createNotifierCallback()
89 : undefined
90 }))
91
92 resolve(devWebpackConfig)
93 }
94 })
95 })
1 'use strict'
2 const path = require('path')
3 const utils = require('./utils')
4 const webpack = require('webpack')
5 const config = require('../config')
6 const merge = require('webpack-merge')
7 const baseWebpackConfig = require('./webpack.base.conf')
8 const CopyWebpackPlugin = require('copy-webpack-plugin')
9 const HtmlWebpackPlugin = require('html-webpack-plugin')
10 const ExtractTextPlugin = require('extract-text-webpack-plugin')
11 const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
12 const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
13
14 const env = require('../config/prod.env')
15
16 const webpackConfig = merge(baseWebpackConfig, {
17 module: {
18 rules: utils.styleLoaders({
19 sourceMap: config.build.productionSourceMap,
20 extract: true,
21 usePostCSS: true
22 })
23 },
24 devtool: config.build.productionSourceMap ? config.build.devtool : false,
25 output: {
26 path: config.build.assetsRoot,
27 filename: utils.assetsPath('js/[name].[chunkhash].js'),
28 chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
29 },
30 plugins: [
31 // http://vuejs.github.io/vue-loader/en/workflow/production.html
32 new webpack.DefinePlugin({
33 'process.env': env
34 }),
35 new UglifyJsPlugin({
36 uglifyOptions: {
37 compress: {
38 warnings: false
39 }
40 },
41 sourceMap: config.build.productionSourceMap,
42 parallel: true
43 }),
44 // extract css into its own file
45 new ExtractTextPlugin({
46 filename: utils.assetsPath('css/[name].[contenthash].css'),
47 // Setting the following option to `false` will not extract CSS from codesplit chunks.
48 // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
49 // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
50 // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
51 allChunks: true,
52 }),
53 // Compress extracted CSS. We are using this plugin so that possible
54 // duplicated CSS from different components can be deduped.
55 new OptimizeCSSPlugin({
56 cssProcessorOptions: config.build.productionSourceMap
57 ? { safe: true, map: { inline: false } }
58 : { safe: true }
59 }),
60 // generate dist index.html with correct asset hash for caching.
61 // you can customize output by editing /index.html
62 // see https://github.com/ampedandwired/html-webpack-plugin
63 new HtmlWebpackPlugin({
64 filename: config.build.index,
65 template: 'index.html',
66 inject: true,
67 minify: {
68 removeComments: true,
69 collapseWhitespace: true,
70 removeAttributeQuotes: true
71 // more options:
72 // https://github.com/kangax/html-minifier#options-quick-reference
73 },
74 // necessary to consistently work with multiple chunks via CommonsChunkPlugin
75 chunksSortMode: 'dependency'
76 }),
77 // keep module.id stable when vendor modules does not change
78 new webpack.HashedModuleIdsPlugin(),
79 // enable scope hoisting
80 new webpack.optimize.ModuleConcatenationPlugin(),
81 // split vendor js into its own file
82 new webpack.optimize.CommonsChunkPlugin({
83 name: 'vendor',
84 minChunks (module) {
85 // any required modules inside node_modules are extracted to vendor
86 return (
87 module.resource &&
88 /\.js$/.test(module.resource) &&
89 module.resource.indexOf(
90 path.join(__dirname, '../node_modules')
91 ) === 0
92 )
93 }
94 }),
95 // extract webpack runtime and module manifest to its own file in order to
96 // prevent vendor hash from being updated whenever app bundle is updated
97 new webpack.optimize.CommonsChunkPlugin({
98 name: 'manifest',
99 minChunks: Infinity
100 }),
101 // This instance extracts shared chunks from code splitted chunks and bundles them
102 // in a separate chunk, similar to the vendor chunk
103 // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
104 new webpack.optimize.CommonsChunkPlugin({
105 name: 'app',
106 async: 'vendor-async',
107 children: true,
108 minChunks: 3
109 }),
110
111 // copy custom static assets
112 new CopyWebpackPlugin([
113 {
114 from: path.resolve(__dirname, '../static'),
115 to: config.build.assetsSubDirectory,
116 ignore: ['.*']
117 }
118 ])
119 ]
120 })
121
122 if (config.build.productionGzip) {
123 const CompressionWebpackPlugin = require('compression-webpack-plugin')
124
125 webpackConfig.plugins.push(
126 new CompressionWebpackPlugin({
127 asset: '[path].gz[query]',
128 algorithm: 'gzip',
129 test: new RegExp(
130 '\\.(' +
131 config.build.productionGzipExtensions.join('|') +
132 ')$'
133 ),
134 threshold: 10240,
135 minRatio: 0.8
136 })
137 )
138 }
139
140 if (config.build.bundleAnalyzerReport) {
141 const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
142 webpackConfig.plugins.push(new BundleAnalyzerPlugin())
143 }
144
145 module.exports = webpackConfig
1 'use strict'
2 const merge = require('webpack-merge')
3 const prodEnv = require('./prod.env')
4
5 module.exports = merge(prodEnv, {
6 NODE_ENV: '"development"'
7 })
1 'use strict'
2 // Template version: 1.3.1
3 // see http://vuejs-templates.github.io/webpack for documentation.
4
5 const path = require('path')
6
7 module.exports = {
8 dev: {
9
10 // Paths
11 assetsSubDirectory: 'static',
12 assetsPublicPath: '/',
13 proxyTable: {
14 // '/api':{
15 // target: 'http://support.supermap.com.cn:8090', //源地址
16 // changeOrigin: true, //改变源
17 // pathRewrite: {
18 // '^/api': 'http://support.supermap.com.cn:8090' //路径重写
19 // }
20 // }
21 },
22
23 // Various Dev Server settings
24 host: 'localhost', // can be overwritten by process.env.HOST
25 port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
26 autoOpenBrowser: false,
27 errorOverlay: true,
28 notifyOnErrors: true,
29 poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
30
31
32 /**
33 * Source Maps
34 */
35
36 // https://webpack.js.org/configuration/devtool/#development
37 devtool: 'cheap-module-eval-source-map',
38
39 // If you have problems debugging vue-files in devtools,
40 // set this to false - it *may* help
41 // https://vue-loader.vuejs.org/en/options.html#cachebusting
42 cacheBusting: true,
43
44 cssSourceMap: true
45 },
46
47 build: {
48 // Template for index.html
49 index: path.resolve(__dirname, '../dist/index.html'),
50
51 // Paths
52 assetsRoot: path.resolve(__dirname, '../dist'),
53 assetsSubDirectory: 'static',
54 assetsPublicPath: '/',
55
56 /**
57 * Source Maps
58 */
59
60 productionSourceMap: true,
61 // https://webpack.js.org/configuration/devtool/#production
62 devtool: '#source-map',
63
64 // Gzip off by default as many popular static hosts such as
65 // Surge or Netlify already gzip all static assets for you.
66 // Before setting to `true`, make sure to:
67 // npm install --save-dev compression-webpack-plugin
68 productionGzip: false,
69 productionGzipExtensions: ['js', 'css'],
70
71 // Run the build command with an extra argument to
72 // View the bundle analyzer report after build finishes:
73 // `npm run build --report`
74 // Set to `true` or `false` to always turn it on or off
75 bundleAnalyzerReport: process.env.npm_config_report
76 }
77 }
1 'use strict'
2 module.exports = {
3 NODE_ENV: '"production"'
4 }
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width,initial-scale=1.0">
6 <title>SuperMap Mapbox GL VUE示例</title>
7 <script src="./static/js/mapbox-gl-enhance.js"></script>
8 <script src="./static//js/styles.js"></script>
9 <link href='./static/css/mapbox-gl.css' rel='stylesheet' />
10 </head>
11 <body style="padding: 0px; margin: 0px;">
12 <div id="app"></div>
13 <!-- built files will be auto injected -->
14 </body>
15 </html>
This diff could not be displayed because it is too large.
1 {
2 "name": "mybox",
3 "version": "1.0.0",
4 "description": "A Vue.js project",
5 "author": "leone",
6 "private": true,
7 "scripts": {
8 "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
9 "serve": "npm run dev",
10 "build": "node build/build.js"
11 },
12 "dependencies": {
13 "@mapbox/mapbox-gl-draw": "^1.1.2",
14 "@supermap/iclient-mapboxgl": "^10.0.0",
15 "ant-design-vue": "^1.4.10",
16 "jquery": "^3.4.1",
17 "mapbox-gl": "^1.6.0",
18 "mapbox-gl-compare": "^0.3.0",
19 "vue": "^2.5.2",
20 "vue-router": "^3.0.1"
21 },
22 "devDependencies": {
23 "autoprefixer": "^7.1.2",
24 "babel-core": "^6.22.1",
25 "babel-helper-vue-jsx-merge-props": "^2.0.3",
26 "babel-loader": "^7.1.1",
27 "babel-plugin-syntax-jsx": "^6.18.0",
28 "babel-plugin-transform-runtime": "^6.22.0",
29 "babel-plugin-transform-vue-jsx": "^3.5.0",
30 "babel-preset-env": "^1.3.2",
31 "babel-preset-stage-2": "^6.22.0",
32 "chalk": "^2.0.1",
33 "copy-webpack-plugin": "^4.0.1",
34 "css-loader": "^0.28.0",
35 "extract-text-webpack-plugin": "^3.0.0",
36 "file-loader": "^1.1.4",
37 "friendly-errors-webpack-plugin": "^1.6.1",
38 "html-webpack-plugin": "^2.30.1",
39 "node-notifier": "^5.1.2",
40 "optimize-css-assets-webpack-plugin": "^3.2.0",
41 "ora": "^1.2.0",
42 "portfinder": "^1.0.13",
43 "postcss-import": "^11.0.0",
44 "postcss-loader": "^2.0.8",
45 "postcss-url": "^7.2.1",
46 "rimraf": "^2.6.0",
47 "semver": "^5.3.0",
48 "shelljs": "^0.7.6",
49 "uglifyjs-webpack-plugin": "^1.1.1",
50 "url-loader": "^0.5.8",
51 "vue-loader": "^13.3.0",
52 "vue-style-loader": "^3.0.1",
53 "vue-template-compiler": "^2.5.2",
54 "webpack": "^3.6.0",
55 "webpack-bundle-analyzer": "^2.9.0",
56 "webpack-dev-server": "^2.9.1",
57 "webpack-merge": "^4.1.0"
58 },
59 "engines": {
60 "node": ">= 6.0.0",
61 "npm": ">= 3.0.0"
62 },
63 "browserslist": [
64 "> 1%",
65 "last 2 versions",
66 "not ie <= 8"
67 ]
68 }
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-12 17:40:15
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-12 17:51:38
6 * @FilePath: \mymapbox\src\App.vue
7 -->
8 <template>
9 <div id="app">
10 <router-view/>
11 </div>
12 </template>
13
14 <script>
15 export default {
16 name: 'App'
17 }
18 </script>
19
20 <style>
21 #app {
22
23 }
24 </style>
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-09 23:17:48
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 17:42:21
6 * @FilePath: \mymapbox\src\components\Map3857.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import MapboxDraw from '@mapbox/mapbox-gl-draw';
17 import { Logo } from '@supermap/iclient-mapboxgl';
18 import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
19
20 export default {
21 name: 'RasterTiles',
22 data () {
23 return {
24
25 }
26 },
27 mounted(){
28 var iServerUrl = "http://iclient.supermap.io/iserver/services/map-city/rest/maps/city/tileFeature.mvt?_cache=false&returnAttributes=true&compressTolerance=-1&width=512&height=512&viewBounds={bbox-epsg-3857}";
29
30 var buildingLayer, heightField = "floor", ratio = 15, layerId = "buildings",
31 center = [106.540545, 29.531714];
32
33 var map = new mapboxgl.Map({
34 container: 'map',
35 style: mapboxgl.supermap.map.getDefaultVectorTileStyle(iServerUrl),
36 pitch: 60,
37 bearing: 290,
38 center: center,
39 zoom: 12
40 });
41 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
42 }
43 }
44 </script>
45
46 <style scoped>
47 #map {
48 position: absolute;
49 height: 100%;
50 width: 100%;
51 background-color: white
52 }
53 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-09 23:17:48
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-12 16:31:06
6 * @FilePath: \mymapbox\src\components\Map3857.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, MapService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19
20 data () {
21 return {
22
23 }
24 },
25 mounted(){
26 var map, host = "http://support.supermap.com.cn:8090";
27 var url = host + "/iserver/services/map-world/rest/maps/World";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }]
48 },
49 center: [-74.50, 40],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
54
55 map.on('load', function () {
56 mapService();
57 });
58
59 function mapService() {
60 var getMapStatusService = new SuperMap.MapService(url, {
61 serverType: SuperMap.ServerType.ISERVER,
62 eventListeners: {
63 processCompleted: callback
64 },
65 });
66 getMapStatusService.processAsync();
67 }
68
69 function callback(serviceResult) {
70 var result = serviceResult.result;
71 var innerHTML = '';
72 innerHTML += "Bounds:" + JSON.stringify(result.bounds) + "<br>";
73 new mapboxgl.Popup({closeOnClick: false})
74 .setLngLat([-96, 37.8])
75 .setHTML(innerHTML + "</br>")
76 .addTo(map);
77 }
78 }
79 }
80 </script>
81
82 <style scoped>
83 #map {
84 position: absolute;
85 height: 100%;
86 width: 100%;
87 background-color: white
88 }
89 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-09 23:17:48
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-12 18:37:31
6 * @FilePath: \mymapbox\src\components\Map3857.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import Vue from 'vue'
16 import { message } from'ant-design-vue';
17 Vue.use(message)
18
19 import mapboxgl from 'mapbox-gl';
20 import { Logo, MeasureService } from '@supermap/iclient-mapboxgl';
21 import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
22 import MapboxDraw from '@mapbox/mapbox-gl-draw';
23 export default {
24 name: 'HelloWorld',
25 data () {
26 return {
27 msg: 'aaa'
28 }
29 },
30 mounted(){
31 var map, host = "http://support.supermap.com.cn:8090";
32 var url = host + "/iserver/services/map-world/rest/maps/World";
33
34 var map = new mapboxgl.Map({
35 container: 'map',
36 style: {
37 "version": 8,
38 "sources": {
39 "raster-tiles": {
40 "attribution": 'attribution',
41 "type": "raster",
42 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
43 "tileSize": 256,
44 },
45 },
46 "layers": [{
47 "id": "simple-tiles",
48 "type": "raster",
49 "source": "raster-tiles",
50 "minzoom": 0,
51 "maxzoom": 22
52 }]
53 },
54 center: [110.143, 30.236],
55 maxZoom: 18,
56 zoom: 4
57 });
58 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
59
60 var draw = new MapboxDraw({
61 displayControlsDefault: false,
62 controls: {
63 line_string: true,
64 polygon: true,
65 trash: true
66 }
67 });
68 map.addControl(draw, "top-left");
69
70 function measure(e) {
71 const type = e.features[0].geometry.type;
72 var param = new SuperMap.MeasureParameters(e.features[0]);
73 if(type === 'LineString'){
74 new MeasureService(url).measureDistance(param, function (serviceResult) {
75 var distance = serviceResult.result.distance;
76 var unit = serviceResult.result.unit;
77 message.info('当前长度: '+ distance+" "+unit);
78 });
79 }else{
80 new MeasureService(url).measureArea(param, function (serviceResult) {
81 var area = serviceResult.result.area;
82 var unit = serviceResult.result.unit;
83 var rounded_area = Math.round(area * 100) / 100;
84 message.info('当前面积: '+ rounded_area+" 平方"+unit);
85 });
86 }
87 }
88
89 function removeMsg() {
90 }
91
92 map.on('draw.create', measure);
93 map.on('draw.delete', removeMsg);
94 }
95 }
96 </script>
97
98 <style scoped>
99 #map {
100 position: absolute;
101 height: 100%;
102 width: 100%;
103 background-color: white
104 }
105 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-09 23:17:48
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 16:43:29
6 * @FilePath: \mymapbox\src\components\Map3857.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import MapboxDraw from '@mapbox/mapbox-gl-draw';
17 import { Logo } from '@supermap/iclient-mapboxgl';
18 import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
19
20 export default {
21 name: 'MVT',
22 data () {
23 return {
24
25 }
26 },
27 mounted(){
28 var map = new mapboxgl.Map({
29 container: 'map',
30 attributionControl: false,
31 style: 'http://support.supermap.com.cn:8090/iserver/services/map-mvt-China/rest/maps/China/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true',
32 center: [110.143, 30.236], // starting position
33 zoom: 3 // starting zoom
34 });
35 map.addControl(new Logo(), 'bottom-right');
36 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
37 map.addControl(new mapboxgl.ScaleControl({}));
38 map.addControl(new mapboxgl.FullscreenControl(),'top-right');
39 map.addControl(new mapboxgl.GeolocateControl({
40 positionOptions: {
41 enableHighAccuracy: true
42 },
43 trackUserLocation: true
44 }),'top-left');
45 map.addControl(new mapboxgl.AttributionControl({compact: true}));
46 var Draw = new MapboxDraw();
47 map.addControl(Draw,'top-left');
48 }
49 }
50 </script>
51
52 <style scoped>
53 #map {
54 position: absolute;
55 height: 100%;
56 width: 100%;
57 background-color: white
58 }
59 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-09 23:17:48
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 17:42:07
6 * @FilePath: \mymapbox\src\components\Map3857.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import MapboxDraw from '@mapbox/mapbox-gl-draw';
17 import { Logo } from '@supermap/iclient-mapboxgl';
18 import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
19
20 export default {
21 name: 'RasterTiles',
22 data () {
23 return {
24
25 }
26 },
27 mounted(){
28 var map, host = "http://support.supermap.com.cn:8090";
29 var url = host + "/iserver/services/map-world/rest/maps/World";
30 var map = new mapboxgl.Map({
31 container: 'map',
32 attributionControl: false,
33 style: {
34 "version": 8,
35 "sources": {
36 "raster-tiles": {
37 "attribution": 'SuperMap Mapbox GL',
38 "type": "raster",
39 "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}'],
40 "tileSize": 256
41 }
42 },
43 "layers": [{
44 "id": "simple-tiles",
45 "type": "raster",
46 "source": "raster-tiles",
47 "minzoom": 0,
48 "maxzoom": 22
49 }]
50 },
51 center: [110.143, 30.236], // starting position
52 zoom: 3 // starting zoom
53 });
54 map.addControl(new Logo(), 'bottom-right');
55 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
56 map.addControl(new mapboxgl.ScaleControl({}));
57 map.addControl(new mapboxgl.FullscreenControl(),'top-right');
58 map.addControl(new mapboxgl.GeolocateControl({
59 positionOptions: {
60 enableHighAccuracy: true
61 },
62 trackUserLocation: true
63 }),'top-left');
64 map.addControl(new mapboxgl.AttributionControl({compact: true}));
65 var Draw = new MapboxDraw();
66 map.addControl(Draw,'top-left');
67 }
68 }
69 </script>
70
71 <style scoped>
72 #map {
73 position: absolute;
74 height: 100%;
75 width: 100%;
76 background-color: white
77 }
78 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-09 23:17:48
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 16:24:38
6 * @FilePath: \mymapbox\src\components\Map3857.vue
7 -->
8 <template>
9 <div >
10 <div id='before' class='map'></div>
11 <div id='after' class='map'></div>
12 </div>
13 </template>
14
15 <script>
16 import mapboxgl from 'mapbox-gl';
17 import Compare from 'mapbox-gl-compare';
18 import { Logo, MapService } from '@supermap/iclient-mapboxgl';
19 export default {
20 name: 'HelloWorld',
21
22 data () {
23 return {
24
25 }
26 },
27 mounted(){
28 var host = "http://support.supermap.com.cn:8090",
29 chinaUrl = host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}',
30 chinaDarkUrl = host + '/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}',
31 attribution = "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
32 " with <span>© <a href='http://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
33 " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
34 var beforeMap = new mapboxgl.Map({
35 container: 'before',
36 style: {
37 "version": 8,
38 "sources": {
39 "raster-tiles": {
40 "attribution": attribution,
41 "type": "raster",
42 "tiles": [chinaUrl],
43 "tileSize": 256,
44 },
45 },
46 "layers": [{
47 "id": "before",
48 "type": "raster",
49 "source": "raster-tiles",
50 "minzoom": 0,
51 "maxzoom": 22
52 }],
53 },
54 center: [0, 0],
55 zoom: 0
56 });
57 beforeMap.addControl(new mapboxgl.NavigationControl(), 'top-left');
58 var afterMap = new mapboxgl.Map({
59 container: 'after',
60 style: {
61 "version": 8,
62 "sources": {
63 "raster-tiles": {
64 "type": "raster",
65 "tiles": [chinaDarkUrl],
66 "tileSize": 256,
67 },
68 },
69 "layers": [{
70 "id": "after",
71 "type": "raster",
72 "source": "raster-tiles",
73 "minzoom": 0,
74 "maxzoom": 22
75 }],
76 },
77 center: [0, 0],
78 zoom: 0
79 });
80
81 //mapbox 卷帘(对比)控件
82 var map = new mapboxgl.Compare(beforeMap, afterMap, {
83 // Set this to enable comparing two maps by mouse movement:
84 // mousemove: true
85 });
86 }
87 }
88 </script>
89
90 <style scoped>
91 .map {
92 position: absolute;
93 height: 100%;
94 width: 100%;
95 background-color: white
96 }
97 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 16:53:43
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27 var dataUrl = host + "/iserver/services/data-world/rest/data";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }],
48 },
49 center: [110.143, 30.236],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new Logo(), 'bottom-right');
54 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
55 map.on('load', function () {
56 query();
57 });
58
59 function query() {
60 var sw = new mapboxgl.LngLat(0, 0);
61 var ne = new mapboxgl.LngLat(60, 30);
62 var lngLatBounds = new mapboxgl.LngLatBounds(sw, ne);
63
64 var boundsParam = new SuperMap.GetFeaturesByBoundsParameters({
65 datasetNames: ["World:Capitals"],
66 bounds: lngLatBounds
67 });
68
69 new FeatureService(dataUrl).getFeaturesByBounds(boundsParam, function (serviceResult) {
70 map.addSource("queryDatas", {
71 "type": "geojson",
72 "data": serviceResult.result.features
73 });
74 map.addLayer({
75 "id": "queryDatas",
76 "type": "circle",
77 "source": "queryDatas",
78 "paint": {
79 "circle-radius": 6, /* 圆的直径,单位像素 */
80 "circle-color": "blue", /* 圆的颜色 */
81 "circle-opacity": 0.5 /* 圆的颜色 */
82 },
83 });
84 });
85 }
86 }
87 }
88 </script>
89
90 <style scoped>
91 #map {
92 position: absolute;
93 height: 100%;
94 width: 100%;
95 background-color: white
96 }
97 </style>
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-12 18:25:00
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27 var dataUrl = host + "/iserver/services/data-world/rest/data";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }],
48 },
49 center: [0, 0],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new Logo(), 'bottom-right');
54 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
55
56 map.on('load', function () {
57 var queryBufferGeometry = {
58 "type": "Polygon",
59 "coordinates": [[[-20, 20], [-20, -20], [20, -20], [20, 20], [-20, 20]]]
60 };
61 map.addLayer({
62 "id": "queryPolygon",
63 "type": "fill",
64 "source": {
65 "type": "geojson",
66 "data": {
67 "type": "Feature",
68 "geometry": queryBufferGeometry
69 }
70 },
71 "paint": {
72 "fill-color": "rgba(0, 0, 255, 0.1)",
73 'fill-outline-color': "red",
74 },
75 });
76 query(queryBufferGeometry);
77 });
78
79 function query(queryBufferGeometry) {
80 var bufferParam = new SuperMap.GetFeaturesByBufferParameters({
81 datasetNames: ["World:Capitals"],
82 bufferDistance: 30, // 30度
83 geometry: queryBufferGeometry
84 });
85 new mapboxgl.Popup().setText(' = 30').setLngLat([0, 0]).addTo(map);
86 new FeatureService(dataUrl).getFeaturesByBuffer(bufferParam, function (serviceResult) {
87 map.addSource("queryDatas", {
88 "type": "geojson",
89 "data": serviceResult.result.features
90 });
91 map.addLayer({
92 "id": "queryDatas",
93 "type": "circle",
94 "source": "queryDatas",
95 "paint": {
96 "circle-radius": 6, /* 圆的直径,单位像素 */
97 "circle-color": "blue", /* 圆的颜色 */
98 "circle-opacity": 0.5 /* 圆的颜色 */
99 },
100 });
101 });
102 }
103 }
104 }
105 </script>
106
107 <style scoped>
108 #map {
109 position: absolute;
110 height: 100%;
111 width: 100%;
112 background-color: white
113 }
114 </style>
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 17:03:22
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService } from '@supermap/iclient-mapboxgl';
17 import MapboxDraw from '@mapbox/mapbox-gl-draw';
18 import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
19
20 export default {
21 name: 'HelloWorld',
22 data () {
23 return {
24
25 }
26 },
27 mounted(){
28 var map, host = "http://support.supermap.com.cn:8090";
29 var url = host + "/iserver/services/map-world/rest/maps/World";
30 var dataUrl = host + "/iserver/services/data-world/rest/data";
31
32 var map = new mapboxgl.Map({
33 container: 'map',
34 style: {
35 "version": 8,
36 "sources": {
37 "raster-tiles": {
38 "attribution": 'attribution',
39 "type": "raster",
40 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
41 "tileSize": 256,
42 },
43 },
44 "layers": [{
45 "id": "simple-tiles",
46 "type": "raster",
47 "source": "raster-tiles",
48 "minzoom": 0,
49 "maxzoom": 22
50 }],
51 },
52 center: [0, 0],
53 maxZoom: 18,
54 zoom: 2
55 });
56 map.addControl(new Logo(), 'bottom-right');
57 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
58 var draw = new MapboxDraw({
59 displayControlsDefault: false,
60 controls: {
61 polygon: true,
62 trash: true
63 }
64 });
65 map.addControl(draw, "top-left");
66 function measure(e) {
67 console.log(e.features[0].geometry);
68 query(e.features[0].geometry);
69 }
70
71 function removeMsg() {
72 }
73
74 map.on('draw.create', measure);
75 map.on('draw.delete', removeMsg);
76
77 function query(queryPolygonGeometry) {
78 var geometryParam = new SuperMap.GetFeaturesByGeometryParameters({
79 datasetNames: ["World:Countries"],
80 geometry: queryPolygonGeometry,
81 spatialQueryMode: "INTERSECT"
82 });
83 new FeatureService(dataUrl).getFeaturesByGeometry(geometryParam, function (serviceResult) {
84 map.addSource("queryDatas", {
85 "type": "geojson",
86 "data": serviceResult.result.features
87 });
88 map.addLayer({
89 "id": "queryDatas",
90 "type": "fill",
91 "source": "queryDatas",
92 "paint": {
93 "fill-color": "#FF3300", /* 填充的颜色 */
94 "fill-opacity": 0.6 /* 透明度 */
95 },
96 });
97 });
98 }
99 }
100 }
101 </script>
102
103 <style scoped>
104 #map {
105 position: absolute;
106 height: 100%;
107 width: 100%;
108 background-color: white
109 }
110 </style>
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 17:01:03
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27 var dataUrl = host + "/iserver/services/data-world/rest/data";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }],
48 },
49 center: [0, 0],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new Logo(), 'bottom-right');
54 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
55
56 map.on('load', function () {
57 var queryPolygonGeometry = {
58 "type": "Polygon",
59 "coordinates": [[[0, 0], [-10, 30], [-30, 0], [0, 0]]]
60 };
61 map.addLayer({
62 "id": "queryPolygon",
63 "type": "fill",
64 "source": {
65 "type": "geojson",
66 "data": {
67 "type": "Feature",
68 "geometry": queryPolygonGeometry
69 }
70 },
71 "paint": {
72 "fill-color": "rgba(0, 0, 255, 0.1)",
73 "fill-outline-color": "red",
74 },
75 });
76 query(queryPolygonGeometry);
77 });
78
79 function query(queryPolygonGeometry) {
80 var geometryParam = new SuperMap.GetFeaturesByGeometryParameters({
81 datasetNames: ["World:Countries"],
82 geometry: queryPolygonGeometry,
83 spatialQueryMode: "INTERSECT"
84 });
85 new FeatureService(dataUrl).getFeaturesByGeometry(geometryParam, function (serviceResult) {
86 map.addSource("queryDatas", {
87 "type": "geojson",
88 "data": serviceResult.result.features
89 });
90 map.addLayer({
91 "id": "queryDatas",
92 "type": "fill",
93 "source": "queryDatas",
94 "paint": {
95 "fill-color": "#FF3300", /* 填充的颜色 */
96 "fill-opacity": 0.6 /* 透明度 */
97 },
98 });
99 });
100 }
101 }
102 }
103 </script>
104
105 <style scoped>
106 #map {
107 position: absolute;
108 height: 100%;
109 width: 100%;
110 background-color: white
111 }
112 </style>
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 16:59:00
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27 var dataUrl = host + "/iserver/services/data-world/rest/data";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }],
48 },
49 center: [110.143, 30.236],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new Logo(), 'bottom-right');
54 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
55 map.on('load', function () {
56 query();
57 });
58
59 function query() {
60 // 在数据集 “World:Countries” 中查询 ID 为 247 的地理空间要素
61 var idsParam = new SuperMap.GetFeaturesByIDsParameters({
62 IDs: [247],
63 datasetNames: ["World:Countries"]
64 });
65
66 var service = new FeatureService(dataUrl);
67 service.getFeaturesByIDs(idsParam, function (serviceResult) {
68 map.addSource("queryDatas", {
69 "type": "geojson",
70 "data": serviceResult.result.features
71 });
72 map.addLayer({
73 "id": "queryDatas",
74 "type": "fill",
75 "source": "queryDatas",
76 "paint": {
77 "fill-color": "#FF3300", /* 填充的颜色 */
78 "fill-opacity": 0.4 /* 透明度 */
79 },
80 "filter": ["==", "$type", "Polygon"]
81 });
82 map.on('click', 'queryDatas', function (e) {
83 new mapboxgl.Popup()
84 .setLngLat(e.lngLat)
85 .setHTML(e.features[0].properties.SMID + ":" + e.features[0].properties.COUNTRY)
86 .addTo(map);
87 });
88 });
89 }
90 }
91 }
92 </script>
93
94 <style scoped>
95 #map {
96 position: absolute;
97 height: 100%;
98 width: 100%;
99 background-color: white
100 }
101 </style>
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 14:56:09
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27 var dataUrl = host + "/iserver/services/data-world/rest/data";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }],
48 },
49 center: [110.143, 30.236],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new Logo(), 'bottom-right');
54 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
55
56 map.on('load', function () {
57 query();
58 });
59
60 function query() {
61 // 指定 SQL 查询即在指定数据集集合中查找符合 SQL 条件的矢量要素
62 // 并在客户端中展示出来
63 var sqlParam = new SuperMap.GetFeaturesBySQLParameters({
64 queryParameter: {
65 name: "Countries@World",
66 attributeFilter: "SMID = 247"
67 },
68 datasetNames: ["World:Countries"]
69 });
70
71 new FeatureService(dataUrl).getFeaturesBySQL(sqlParam, function (serviceResult) {
72 map.addSource("queryDatas", {
73 "type": "geojson",
74 "data": serviceResult.result.features
75 });
76 map.addLayer({
77 "id": "queryDatas",
78 "type": "fill", /* fill类型一般用来表示一个面,一般较大 */
79 "source": "queryDatas",
80 "paint": {
81 "fill-color": "#FF3300", /* 填充的颜色 */
82 "fill-opacity": 0.6 /* 透明度 */
83 },
84 });
85 map.on('click', 'queryDatas', function (e) {
86 new mapboxgl.Popup()
87 .setLngLat(e.lngLat)
88 .setHTML(e.features[0].properties.SMID + ":" + e.features[0].properties.COUNTRY)
89 .addTo(map);
90 });
91 });
92 }
93 }
94 }
95 </script>
96
97 <style scoped>
98 #map {
99 position: absolute;
100 height: 100%;
101 width: 100%;
102 background-color: white
103 }
104 </style>
1 <template>
2 <div >
3 <div id="map"></div>
4 </div>
5 </template>
6
7 <script>
8 import mapboxgl from 'mapbox-gl';
9 import { Logo, QueryByBoundsParameters, QueryService } from '@supermap/iclient-mapboxgl';
10 export default {
11 name: 'HelloWorld',
12
13 data () {
14 return {
15
16 }
17 },
18 mounted(){
19 var map, host = "http://support.supermap.com.cn:8090";
20 var url = host + "/iserver/services/map-world/rest/maps/World";
21
22 var map = new mapboxgl.Map({
23 container: 'map',
24 style: {
25 "version": 8,
26 "sources": {
27 "raster-tiles": {
28 "attribution": 'attribution',
29 "type": "raster",
30 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
31 "tileSize": 256,
32 },
33 },
34 "layers": [{
35 "id": "simple-tiles",
36 "type": "raster",
37 "source": "raster-tiles",
38 "minzoom": 0,
39 "maxzoom": 22
40 }],
41 },
42 center: [0, 0],
43 maxZoom: 18,
44 zoom: 2
45 });
46 map.addControl(new Logo(), 'bottom-right');
47 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
48
49 map.on('load', function () {
50 query();
51 });
52
53 function query() {
54 map.addLayer({
55 'id': 'polygonLayer',
56 'type': 'fill',
57 'source': {
58 'type': 'geojson',
59 'data': {
60 'type': 'Feature',
61 'geometry': {
62 'type': 'Polygon',
63 'coordinates': [[[0, 0], [60, 0], [60, 39], [0, 39], [0, 0]]],
64 }
65 }
66 },
67 'paint': {
68 'fill-outline-color': 'blue',
69 'fill-color': 'rgba(0, 0, 255, 0.1)'
70
71 }
72 });
73
74 var param = new QueryByBoundsParameters({
75 queryParams: {name: "Capitals@World.1"},
76 bounds: SuperMap.Bounds.fromArray([0, 0, 60, 39])
77 });
78
79 new mapboxgl.supermap.QueryService(url).queryByBounds(param, function (serviceResult) {
80 var recordsets = serviceResult && serviceResult.result && serviceResult.result.recordsets;
81 var features = recordsets && recordsets[0] && recordsets[0].features;
82 map.addLayer({
83 "id": "points",
84 "type": "circle",
85 "paint": {
86 "circle-radius": 6,
87 "circle-color": "#ff0000",
88 "circle-opacity": 0.4,
89 "circle-stroke-width": 2,
90 "circle-stroke-color": "#007cbf",
91 "circle-stroke-opacity": 0.5
92 },
93 "source": {
94 "type": "geojson",
95 "data": features
96 }
97 });
98
99 });
100 }
101 }
102 }
103 </script>
104
105 <style scoped>
106 #map {
107 position: absolute;
108 height: 100%;
109 width: 100%;
110 background-color: white
111 }
112 </style>
1 <template>
2 <div >
3 <div id="map"></div>
4 </div>
5 </template>
6
7 <script>
8 import mapboxgl from 'mapbox-gl';
9 import { Logo, QueryByBoundsParameters, QueryService } from '@supermap/iclient-mapboxgl';
10 export default {
11 name: 'HelloWorld',
12 data () {
13 return {
14
15 }
16 },
17 mounted(){
18 var map, host = "http://support.supermap.com.cn:8090";
19 var url = host + "/iserver/services/map-world/rest/maps/World";
20
21 var map = new mapboxgl.Map({
22 container: 'map',
23 style: {
24 "version": 8,
25 "sources": {
26 "raster-tiles": {
27 "attribution": 'attribution',
28 "type": "raster",
29 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
30 "tileSize": 256,
31 },
32 },
33 "layers": [{
34 "id": "simple-tiles",
35 "type": "raster",
36 "source": "raster-tiles",
37 "minzoom": 0,
38 "maxzoom": 22
39 }],
40 },
41 center: [121, 3],
42 maxZoom: 18,
43 zoom: 2
44 });
45 map.addControl(new Logo(), 'bottom-right');
46 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
47
48 map.on('load', function () {
49 query();
50 });
51
52 var decodeMarkers = [];
53 function query() {
54 //添加查询中心点
55 var img = new Image();
56 img.src = './static/image/markerbig_select.png';
57 var marker = new mapboxgl.Marker(img).setLngLat([121, 30]);
58 decodeMarkers.push(marker);
59
60 var point = new SuperMap.Geometry.Point(104, 30);
61 var param = new SuperMap.QueryByDistanceParameters({
62 queryParams: {name: "Capitals@World.1"},
63 distance: 10, // 100度的距离
64 geometry: point
65 });
66
67 var queryService = new QueryService(url);
68 queryService.queryByDistance(param, callback);
69 }
70
71 map.on('load', function () {
72 query();
73 });
74
75 function callback(serviceResult) {
76 var recordsets = serviceResult && serviceResult.result && serviceResult.result.recordsets;
77 var features = recordsets && recordsets[0] && recordsets[0].features;
78 console.log(features);
79 decodeMarkers[0].addTo(map);
80 map.addLayer({
81 "id": "results",
82 "type": "circle",
83 "paint": {
84 "circle-radius": 6,
85 "circle-color": "#007cbf",
86 "circle-opacity": 0.1,
87 "circle-stroke-width": 2,
88 "circle-stroke-color": "#007cbf",
89 "circle-stroke-opacity": 0.5
90 },
91 "source": {
92 "type": "geojson",
93 "data": features
94 }
95 });
96 }
97 }
98 }
99 </script>
100
101 <style scoped>
102 #map {
103 position: absolute;
104 height: 100%;
105 width: 100%;
106 background-color: white
107 }
108 </style>
1 <template>
2 <div >
3 <div id="map"></div>
4 </div>
5 </template>
6
7 <script>
8 import mapboxgl from 'mapbox-gl';
9 import { Logo, QueryByBoundsParameters, QueryService } from '@supermap/iclient-mapboxgl';
10 export default {
11 name: 'HelloWorld',
12 data () {
13 return {
14
15 }
16 },
17 mounted(){
18 var map, host = "http://support.supermap.com.cn:8090";
19 var url = host + "/iserver/services/map-world/rest/maps/World";
20
21 var map = new mapboxgl.Map({
22 container: 'map',
23 style: {
24 "version": 8,
25 "sources": {
26 "raster-tiles": {
27 "attribution": 'attribution',
28 "type": "raster",
29 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
30 "tileSize": 256,
31 },
32 },
33 "layers": [{
34 "id": "simple-tiles",
35 "type": "raster",
36 "source": "raster-tiles",
37 "minzoom": 0,
38 "maxzoom": 22
39 }],
40 },
41 center: [0, 0],
42 maxZoom: 18,
43 zoom: 2
44 });
45 map.addControl(new Logo(), 'bottom-right');
46 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
47
48 map.on('load', function () {
49 query();
50 });
51
52 function query() {
53 var geo = {
54 'type': 'Feature',
55 'geometry': {
56 'type': 'Polygon',
57 'coordinates': [[[0, 0], [-30, 0], [-10, 30], [0, 0]]],
58 }
59 };
60 map.addLayer({
61 'id': 'polygonLayer',
62 'type': 'fill',
63 'source': {
64 'type': 'geojson',
65 'data': geo
66 },
67 'paint': {
68 'fill-outline-color': 'red',
69 'fill-color': 'rgba(0, 0, 255, 0.1)'
70 }
71 });
72
73 var param = new SuperMap.QueryByGeometryParameters({
74 queryParams: {name: "Capitals@World.1"},
75 geometry: geo
76 });
77
78 var queryService = new QueryService(url).queryByGeometry(param, function (serviceResult) {
79 var recordsets = serviceResult && serviceResult.result && serviceResult.result.recordsets;
80 var features = recordsets && recordsets[0] && recordsets[0].features;
81 map.addLayer({
82 "id": "points",
83 "type": "circle",
84 "paint": {
85 "circle-radius": 6,
86 "circle-color": "#FF0000",
87 "circle-opacity": 0.5,
88 "circle-stroke-width": 2,
89 "circle-stroke-color": "#007cbf",
90 "circle-stroke-opacity": 0.5
91 },
92 "source": {
93 "type": "geojson",
94 "data": features
95 }
96 });
97 });
98 }
99 }
100 }
101 </script>
102
103 <style scoped>
104 #map {
105 position: absolute;
106 height: 100%;
107 width: 100%;
108 background-color: white
109 }
110 </style>
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 14:29:45
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, QueryByBoundsParameters, QueryService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27
28 var map = new mapboxgl.Map({
29 container: 'map',
30 style: {
31 "version": 8,
32 "sources": {
33 "raster-tiles": {
34 "attribution": 'attribution',
35 "type": "raster",
36 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
37 "tileSize": 256,
38 },
39 },
40 "layers": [{
41 "id": "simple-tiles",
42 "type": "raster",
43 "source": "raster-tiles",
44 "minzoom": 0,
45 "maxzoom": 22
46 }],
47 },
48 center: [0, 0],
49 maxZoom: 18,
50 zoom: 2
51 });
52 map.addControl(new Logo(), 'bottom-right');
53 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
54
55 map.on('load', function () {
56 query();
57 });
58
59 function query() {
60 var param = new SuperMap.QueryBySQLParameters({
61 queryParams: {
62 name: "Capitals@World.1",
63 attributeFilter: "SMID > 100"
64 }
65 });
66 var queryService = new QueryService(url).queryBySQL(param, function (serviceResult) {
67 console.log(serviceResult);
68 var recordsets = serviceResult && serviceResult.result && serviceResult.result.recordsets;
69 var features = recordsets && recordsets[0] && recordsets[0].features;
70 map.addLayer({
71 "id": "points",
72 "type": "circle",
73 "paint": {
74 "circle-radius": 6,
75 "circle-color": "#007cbf",
76 "circle-opacity":0.1,
77 "circle-stroke-width":2,
78 "circle-stroke-color":"#007cbf",
79 "circle-stroke-opacity":0.5
80 },
81 "source": {
82 "type": "geojson",
83 "data": features
84 }
85 });
86 });
87 }
88 }
89 }
90 </script>
91
92 <style scoped>
93 #map {
94 position: absolute;
95 height: 100%;
96 width: 100%;
97 background-color: white
98 }
99 </style>
1 <!--
2 * 缓冲区分析
3 * @Author: jiangbotao
4 * @Date: 2019-12-10 14:16:04
5 * @LastEditors: jiangbotao
6 * @LastEditTime: 2019-12-10 19:58:51
7 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
8 -->
9 <template>
10 <div >
11 <div id="map"></div>
12 </div>
13 </template>
14
15 <script>
16 import mapboxgl from 'mapbox-gl';
17 import { Logo, FeatureService, QueryService, SpatialAnalystService } from '@supermap/iclient-mapboxgl';
18 export default {
19 name: 'HelloWorld',
20 data () {
21 return {
22
23 }
24 },
25 mounted(){
26 var map, host = "http://support.supermap.com.cn:8090";
27 var baseUrl = host + "/iserver/services/map-jingjin/rest/maps/京津地区地图/zxyTileImage.png?z={z}&x={x}&y={y}";
28 var serviceUrl = host + "/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
29 var serviceUrl2 = 'http://support.supermap.com.cn:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst/datasets/Road_L@Jingjin/buffer.json?returnContent=true';
30
31 var map = new mapboxgl.Map({
32 container: 'map',
33 style: {
34 "version": 8,
35 "sources": {
36 "raster-tiles": {
37 "attribution": 'attribution',
38 "type": "raster",
39 "tiles": [baseUrl],
40 "tileSize": 256,
41 },
42 },
43 "layers": [{
44 "id": "simple-tiles",
45 "type": "raster",
46 "source": "raster-tiles",
47 "minzoom": 0,
48 "maxzoom": 22
49 }],
50 },
51 center: [116.28094998209556, 39.897168019388474],
52 maxZoom: 18,
53 zoom: 12
54 });
55 map.addControl(new Logo(), 'bottom-right');
56 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
57
58 map.on('load', function () {
59 bufferAnalystProcess();
60 });
61
62 function bufferAnalystProcess() {
63 map.addLayer({
64 "id": "route",
65 "type": "line",
66 "source": {
67 "type": "geojson",
68 "data": {
69 "type": "Feature",
70 "geometry": {
71 "type": "LineString",
72 "coordinates": [
73 [116.2143386597, 39.8959419733],
74 [116.2156351162, 39.8963250173],
75 [116.2182280292, 39.8968111885],
76 [116.2740019864, 39.8970124079],
77 [116.3103285499, 39.8970574832],
78 [116.3321510064, 39.8970392162],
79 [116.3377051439, 39.8973437531],
80 [116.3463089006, 39.8978391816],
81 ]
82 }
83 }
84 },
85 "layout": {
86 "line-join": "round",
87 "line-cap": "round"
88 },
89 "paint": {
90 "line-color": "#888",
91 "line-width": 8
92 }
93 });
94 //缓冲区分析参数
95 var dsBufferAnalystParameters = new SuperMap.DatasetBufferAnalystParameters({
96 dataset: "Road_L@Jingjin",
97 filterQueryParameter: new SuperMap.FilterParameter({
98 attributeFilter: "NAME='莲花池东路'"
99 }),
100 bufferSetting: new SuperMap.BufferSetting({
101 endType: SuperMap.BufferEndType.ROUND,
102 leftDistance: {value: 300},
103 rightDistance: {value: 300},
104 semicircleLineSegment: 10,
105 radiusUnit: 'METER'
106 })
107 });
108 //缓冲区分析服务
109 new SpatialAnalystService(serviceUrl).bufferAnalysis(dsBufferAnalystParameters, function (serviceResult) {
110 console.log(serviceResult.result);
111 map.addLayer({
112 "id": "queryDatas",
113 "type": "fill", /* fill类型一般用来表示一个面,一般较大 */
114 "source": {
115 "type": "geojson",
116 "data": serviceResult.result.recordset.features
117 },
118 "paint": {
119 "fill-color": "red", /* 填充的颜色 */
120 "fill-opacity": 0.4 /* 透明度 */
121 },
122 });
123 })
124 }
125 }
126 }
127 </script>
128
129 <style scoped>
130 #map {
131 position: absolute;
132 height: 100%;
133 width: 100%;
134 background-color: white
135 }
136 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <template>
2 <div >
3 <div id="map"></div>
4 </div>
5 </template>
6
7 <script>
8 import mapboxgl from 'mapbox-gl';
9 import {Logo, QueryByBoundsParameters, QueryService, SuperMap} from '@supermap/iclient-mapboxgl';
10 import $ from 'jquery'
11
12 export default {
13 name: 'HelloWorld',
14 data () {
15 return {
16 }
17 },
18 mounted(){
19 var host = "http://support.supermap.com.cn:8090";
20 var map, heatMapLayer,
21 url = host + "/iserver/services/map-world/rest/maps/World";
22 var map = new mapboxgl.Map({
23 container: 'map',
24 renderWorldCopies:false,
25 style: {
26 "version": 8,
27 "sources": {
28 "raster-tiles": {
29 "attribution": 'attribution',
30 "type": "raster",
31 "tiles": [url + '/zxyTileImage.png?z={z}&x={x}&y={y}'],
32 "tileSize": 256,
33 },
34 },
35 "layers": [{
36 "id": "simple-tiles",
37 "type": "raster",
38 "source": "raster-tiles",
39 "minzoom": 0,
40 "maxzoom": 9
41 }]
42 },
43 center: [0, 0],
44 zoom: 4
45 });
46 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
47 map.addControl(new mapboxgl.supermap.LogoControl(), 'bottom-right');
48
49 heatMapLayer = new mapboxgl.supermap.HeatMapLayer(
50 "heatMap",
51 {
52 "map": map,
53 "id": "heatmap",
54 "radius": 45,
55 // 设置图层透明度:(参数方式)
56 // "opacity": 0.5,
57 //featureWeight指定以哪个属性值为热力权重值创建热力图:
58 "featureWeight": "value",
59 }
60 );
61
62 map.on('load', ()=>{
63 createHeatPoints();
64 });
65
66 function createHeatPoints() {
67 clearHeatPoints();
68 var heatPoints = [];
69 var num = 200
70 var radius = 50
71 var unit = 'px'
72 heatMapLayer.radius = radius;
73 var features = [];
74 for (var i = 0; i < num; i++) {
75 features[i] =
76 {
77 "type": "feature",
78 "geometry": {
79 "type": "Point",
80 "coordinates": [
81 Math.random() * 300 - 180,
82 Math.random() * 100 - 80]
83 },
84 "properties": {
85 "value": Math.random() * 9,
86 }
87 };
88 }
89 var heatPoints = {
90 "type": "FeatureCollection",
91 "features": features
92 };
93 heatMapLayer.addFeatures(heatPoints);
94 // 设置图层透明度:(函数方式)
95 // heatMapLayer.setOpacity(0.5);
96 map.addLayer(heatMapLayer);
97 }
98
99 function clearHeatPoints() {
100 if (map.getLayer("heatmap")) {
101 map.removeLayer("heatmap");
102 }
103 }
104 }
105 }
106 </script>
107
108 <style scoped>
109 #map {
110 height: 100%;
111 width: 100%;
112 position: absolute;
113 background-color: white
114 }
115 </style>
1 <!--
2 * 点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。
3 * 点的多少和所代表的意义由地图的内容决定。
4 * 点密度专题图使用点的数目或者密集程度来反映一个区域或范围所对应的专题值。
5 * @Author: jiangbotao
6 * @Date: 2019-12-10 14:16:04
7 * @LastEditors: jiangbotao
8 * @LastEditTime: 2019-12-10 17:25:54
9 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
10 -->
11 <template>
12 <div >
13 <div id="map"></div>
14 </div>
15 </template>
16
17 <script>
18 import mapboxgl from 'mapbox-gl';
19 import { Logo, FeatureService, QueryService, ThemeService } from '@supermap/iclient-mapboxgl';
20 export default {
21 name: 'HelloWorld',
22 data () {
23 return {
24
25 }
26 },
27 mounted(){
28 var map, host = "http://support.supermap.com.cn:8090";
29 var url = host + "/iserver/services/map-world/rest/maps/World";
30 var dataUrl = host + "/iserver/services/map-world/rest/maps/World";
31
32 var map = new mapboxgl.Map({
33 container: 'map',
34 style: {
35 "version": 8,
36 "sources": {
37 "raster-tiles": {
38 "attribution": 'attribution',
39 "type": "raster",
40 "tiles": [host + '/iserver/services/maps/rest/maps/World/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
41 "tileSize": 256,
42 },
43 },
44 "layers": [{
45 "id": "simple-tiles",
46 "type": "raster",
47 "source": "raster-tiles",
48 "minzoom": 0,
49 "maxzoom": 22
50 }],
51 },
52 center: [108.94, 34.34],
53 maxZoom: 18,
54 zoom: 2
55 });
56 map.addControl(new Logo(), 'bottom-right');
57 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
58
59 map.on('load', function () {
60 createTheme();
61 });
62
63 function createTheme() {
64 var themeDotDensity = new SuperMap.ThemeDotDensity({
65 dotExpression: "Pop_1994",
66 value: 5000000,
67 style: new SuperMap.ServerStyle({
68 markerSize: 3,
69 markerSymbolID: 12
70 })
71 });
72 var themeParameters = new SuperMap.ThemeParameters({
73 themes: [themeDotDensity],
74 datasetNames: ["Countries"],
75 dataSourceNames: ["World"]
76 });
77
78 var themeService = new ThemeService(dataUrl);
79 themeService.getThemeInfo(themeParameters, function (serviceResult) {
80 var result = serviceResult.result;
81 console.log(result);
82 if (result && result.newResourceID) {
83 map.addSource("theme", {
84 "type": 'raster',
85 "tiles": ['http://support.supermap.com.cn:8090/iserver/services/maps/rest/maps/World/zxyTileImage.png?z={z}&x={x}&y={y}&transparent=true&cacheEnabled=false&noWrap=true&layersID=' + result.newResourceID],
86 "tileSize": 256,
87 });
88 map.addLayer({
89 "id": "themeLayer",
90 "type": "raster",
91 "source": "theme",
92 });
93 }
94 })
95 }
96 }
97 }
98 </script>
99
100 <style scoped>
101 #map {
102 position: absolute;
103 height: 100%;
104 width: 100%;
105 background-color: white
106 }
107 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 15:35:38
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService, ThemeService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27 var dataUrl = host + "/iserver/services/map-china400/rest/maps/China";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }],
48 },
49 center: [108.94, 34.34],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new Logo(), 'bottom-right');
54 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
55
56 map.on('load', function () {
57 createTheme();
58 });
59
60 function createTheme() {
61 var themeGraduatedSymbol = new SuperMap.ThemeGraduatedSymbol({
62 expression: "SMAREA",
63 baseValue: 3000000000000,
64 graduatedMode: SuperMap.GraduatedMode.CONSTANT,
65 flow: new SuperMap.ThemeFlow({
66 flowEnabled: true
67 }),
68 style: new SuperMap.ThemeGraduatedSymbolStyle({
69 positiveStyle: new SuperMap.ServerStyle({
70 markerSize: 50,
71 markerSymbolID: 0,
72 lineColor: new SuperMap.ServerColor(255, 165, 0),
73 fillBackColor: new SuperMap.ServerColor(255, 0, 0)
74 })
75 })
76 });
77
78 var themeParameters = new SuperMap.ThemeParameters({
79 themes: [themeGraduatedSymbol],
80 datasetNames: ["China_Province_pg"],
81 dataSourceNames: ["China"]
82 });
83
84 new ThemeService(dataUrl).getThemeInfo(themeParameters, function (serviceResult) {
85 var result = serviceResult.result;
86 if (result && result.newResourceID) {
87 map.addSource("theme", {
88 "type": 'raster',
89 "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}&transparent=true&cacheEnabled=false&layersID=' + result.newResourceID],
90 "tileSize": 256,
91 });
92 map.addLayer({
93 "id": "themeLayer",
94 "type": "raster",
95 "source": "theme",
96 });
97 }
98 })
99 }
100 }
101 }
102 </script>
103
104 <style scoped>
105 #map {
106 position: absolute;
107 height: 100%;
108 width: 100%;
109 background-color: white
110 }
111 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 15:43:09
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService, ThemeService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27 var dataUrl = host + "/iserver/services/map-china400/rest/maps/China";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }],
48 },
49 center: [108.94, 34.34],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new Logo(), 'bottom-right');
54 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
55
56 map.on('load', function () {
57 createTheme();
58 });
59
60 function createTheme() {
61 var style1, style2, style3;
62 style1 = new SuperMap.ServerTextStyle({
63 fontHeight: 4,
64 foreColor: new SuperMap.ServerColor(0, 0, 0),
65
66 });
67 style2 = new SuperMap.ServerTextStyle({
68 fontHeight: 4,
69 foreColor: new SuperMap.ServerColor(155, 30, 45),
70 });
71 style3 = new SuperMap.ServerTextStyle({
72 fontHeight: 4,
73 foreColor: new SuperMap.ServerColor(30, 45, 155),
74 });
75 var themeLabelItem1, themeLabelItem2, themeLabelItem3;
76 themeLabelItem1 = new SuperMap.ThemeLabelItem({
77 start: 300,//110000,
78 end: 3508,//350000,
79 style: style1
80 });
81 themeLabelItem2 = new SuperMap.ThemeLabelItem({
82 start: 3508,//350000,
83 end: 5508,//550000,
84 style: style2
85 });
86 themeLabelItem3 = new SuperMap.ThemeLabelItem({
87 start: 5508,//550000,
88 end: 10724,//820000,
89 style: style3
90 });
91
92 var themeLabel = new SuperMap.ThemeLabel({
93 labelExpression: "NAME",
94 rangeExpression: "pop_2014",
95 numericPrecision: 0,
96 items: [themeLabelItem1, themeLabelItem2, themeLabelItem3],
97 background: new SuperMap.ThemeLabelBackground({
98 backStyle: new SuperMap.ServerStyle({
99 fillForeColor: new SuperMap.ServerColor(179, 209, 193),
100 fillOpaqueRate: 60,
101 lineWidth: 0.1
102 }),
103 labelBackShape: "RECT"
104 })
105 });
106 var themeParameters = new SuperMap.ThemeParameters({
107 themes: [themeLabel],
108 datasetNames: ["China_Province_pg"],
109 dataSourceNames: ["China"]
110 });
111
112 new ThemeService(dataUrl).getThemeInfo(themeParameters, function (serviceResult) {
113 var result = serviceResult.result;
114 if (result && result.newResourceID) {
115 map.addSource("theme", {
116 "type": 'raster',
117 "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}&transparent=true&cacheEnabled=false&layersID=' + result.newResourceID],
118 "tileSize": 256,
119 });
120
121 map.addLayer({
122 "id": "themeLayer",
123 "type": "raster",
124 "source": "theme",
125 });
126 }
127 })
128 }
129 }
130 }
131 </script>
132
133 <style scoped>
134 #map {
135 position: absolute;
136 height: 100%;
137 width: 100%;
138 background-color: white
139 }
140 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 15:53:23
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService, ThemeService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27 var dataUrl = host + "/iserver/services/map-china400/rest/maps/China";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }],
48 },
49 center: [108.94, 34.34],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new Logo(), 'bottom-right');
54 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
55
56 map.on('load', function () {
57 createTheme();
58 });
59
60 function createTheme() {
61 var themeRangeItem1, themeRangeItem2, themeRangeItem3, themeRange;
62 themeRangeItem1 = new SuperMap.ThemeRangeItem({
63 start: 0,
64 end: 500000000000,
65 style: new SuperMap.ServerStyle({
66 fillForeColor: new SuperMap.ServerColor(211, 255, 250),
67 lineColor: new SuperMap.ServerColor(179, 209, 193),
68 lineWidth: 0.1
69 })
70 });
71 themeRangeItem2 = new SuperMap.ThemeRangeItem({
72 start: 500000000000,
73 end: 1000000000000,
74 style: new SuperMap.ServerStyle({
75 fillForeColor: new SuperMap.ServerColor(178, 218, 199),
76 lineColor: new SuperMap.ServerColor(179, 209, 193),
77 lineWidth: 0.1
78 })
79 });
80 themeRangeItem3 = new SuperMap.ThemeRangeItem({
81 start: 1000000000000,
82 end: 3000000000000,
83 style: new SuperMap.ServerStyle({
84 fillForeColor: new SuperMap.ServerColor(58, 178, 166),
85 lineColor: new SuperMap.ServerColor(179, 209, 193),
86 lineWidth: 0.1
87 })
88 });
89 themeRange = new SuperMap.ThemeRange({
90 rangeExpression: "SMAREA",
91 rangeMode: SuperMap.RangeMode.EQUALINTERVAL,
92 items: [themeRangeItem1, themeRangeItem2, themeRangeItem3]
93 });
94 var themeParameters = new SuperMap.ThemeParameters({
95 datasetNames: ["China_Province_pg"],
96 dataSourceNames: ["China"],
97 joinItems: null,
98 themes: [themeRange]
99 });
100
101 new ThemeService(dataUrl).getThemeInfo(themeParameters, function (serviceResult) {
102 var result = serviceResult.result;
103 if (result && result.newResourceID) {
104 map.addSource("theme", {
105 "type": 'raster',
106 "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}&noWrap=true&transparent=true&cacheEnabled=false&layersID=' + result.newResourceID],
107 "tileSize": 256,
108 });
109
110 map.addLayer({
111 "id": "themeLayer",
112 "type": "raster",
113 "source": "theme",
114 });
115 }
116 })
117 }
118 }
119 }
120 </script>
121
122 <style scoped>
123 #map {
124 position: absolute;
125 height: 100%;
126 width: 100%;
127 background-color: white
128 }
129 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 14:16:04
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-10 15:40:38
6 * @FilePath: \mymapbox\src\components\Map_filter_sql.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo, FeatureService, QueryService, ThemeService } from '@supermap/iclient-mapboxgl';
17 export default {
18 name: 'HelloWorld',
19 data () {
20 return {
21
22 }
23 },
24 mounted(){
25 var map, host = "http://support.supermap.com.cn:8090";
26 var url = host + "/iserver/services/map-world/rest/maps/World";
27 var dataUrl = host + "/iserver/services/map-china400/rest/maps/China";
28
29 var map = new mapboxgl.Map({
30 container: 'map',
31 style: {
32 "version": 8,
33 "sources": {
34 "raster-tiles": {
35 "attribution": 'attribution',
36 "type": "raster",
37 "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}'],
38 "tileSize": 256,
39 },
40 },
41 "layers": [{
42 "id": "simple-tiles",
43 "type": "raster",
44 "source": "raster-tiles",
45 "minzoom": 0,
46 "maxzoom": 22
47 }],
48 },
49 center: [108.94, 34.34],
50 maxZoom: 18,
51 zoom: 2
52 });
53 map.addControl(new Logo(), 'bottom-right');
54 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
55
56 map.on('load', function () {
57 createTheme();
58 });
59
60 function createTheme() {
61 var themeGraph = new SuperMap.ThemeGraph({
62 items: [
63 new SuperMap.ThemeGraphItem({
64 caption: "全国省份2013_GDP",
65 graphExpression: "GDP_2013",
66 uniformStyle: new SuperMap.ServerStyle({
67 fillForeColor: new SuperMap.ServerColor(255, 215, 0),
68 lineWidth: 0
69 })
70 }),
71 new SuperMap.ThemeGraphItem({
72 caption: "全国省份2014_GDP",
73 graphExpression: "GDP_2014",
74 uniformStyle: new SuperMap.ServerStyle({
75 fillForeColor: new SuperMap.ServerColor(0, 191, 255),
76 lineWidth: 0
77 })
78 }),
79 ],
80 barWidth: 0.001,
81 graduatedMode: SuperMap.GraduatedMode.CONSTANT,
82 graphAxes: new SuperMap.ThemeGraphAxes({
83 axesDisplayed: true
84 }),
85 graphSize: new SuperMap.ThemeGraphSize({
86 maxGraphSize: 500000,
87 minGraphSize: 200000
88 }),
89 graphText: new SuperMap.ThemeGraphText({
90 graphTextDisplayed: true,
91 graphTextFormat: SuperMap.ThemeGraphTextFormat.VALUE,
92 graphTextStyle: new SuperMap.ServerTextStyle({
93 fontHeight: 10,
94 fontWidth: 10
95 })
96 }),
97 overlapAvoided: false,
98 graphSizeFixed: false,
99 graphType: SuperMap.ThemeGraphType.BAR
100 });
101 var themeParameters = new SuperMap.ThemeParameters({
102 themes: [themeGraph],
103 datasetNames: ["China_Province_pg"],
104 dataSourceNames: ["China"]
105 });
106
107 new ThemeService(dataUrl).getThemeInfo(themeParameters, function (serviceResult) {
108 var result = serviceResult.result;
109 if (result && result.newResourceID) {
110 map.addSource("theme", {
111 "type": 'raster',
112 "tiles": [host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}&transparent=true&cacheEnabled=false&layersID=' + result.newResourceID],
113 "tileSize": 256,
114 });
115 map.addLayer({
116 "id": "themeLayer",
117 "type": "raster",
118 "source": "theme",
119 });
120 }
121 })
122 }
123 }
124 }
125 </script>
126
127 <style scoped>
128 #map {
129 position: absolute;
130 height: 100%;
131 width: 100%;
132 background-color: white
133 }
134 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * - basic
3 * - dark
4 * - fiordcolor
5 * - klokantech
6 * - osm
7 * - positron
8 * @Author: jiangbotao
9 * @Date: 2019-12-09 23:17:48
10 * @LastEditors: jiangbotao
11 * @LastEditTime: 2019-12-12 18:34:35
12 * @FilePath: \mymapbox\src\components\Map3857.vue
13 -->
14 <template>
15 <div >
16 <div id="map"></div>
17 </div>
18 </template>
19
20 <script>
21 import mapboxgl from 'mapbox-gl';
22 import { Logo } from '@supermap/iclient-mapboxgl';
23
24 export default {
25 name: 'MVT',
26 data () {
27 return {
28
29 }
30 },
31 mounted(){
32 var map, host = "http://support.supermap.com.cn:8090";
33 var url = host + "/iserver/services/map-world/rest/maps/World";
34
35 var map = new mapboxgl.Map({
36 container: 'map', // container id
37 style: {
38 "version": 8,
39 "sources": {
40 "vector-tiles": {
41 "attribution": 'attribution',
42 "type": "vector",
43 "tiles": [host + "/iserver/services/map-beijing/rest/maps/beijingMap/tileFeature.mvt?returnAttributes=true&compressTolerance=-1&width=512&height=512&viewBounds={bbox-epsg-3857}&expands=0:0_2,132_128,138_64,141_32,143_16,145_8,147_4"]
44 },
45 },
46 "glyphs": host + "/iserver/services/map-beijing/rest/maps/beijingMap/tileFeature/sdffonts/{fontstack}/{range}.pbf",
47 "layers": []
48 },
49 center: [116.4, 39.9],
50 minZoom: 10,
51 zoom: 11
52 });
53 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
54
55 map.on('load', function () {
56 console.log(mapStyles["basic"].style);
57 map.setStyle(mapStyles["fiordcolor"].style, {diff: false});
58 });
59 }
60 }
61 </script>
62
63 <style scoped>
64 #map {
65 position: absolute;
66 height: 100%;
67 width: 100%;
68 background-color: white
69 }
70 </style>
...\ No newline at end of file ...\ No newline at end of file
1 <!--
2 * @Author: jiangbotao
3 * @Date: 2019-12-10 22:15:53
4 * @LastEditors: jiangbotao
5 * @LastEditTime: 2019-12-12 17:31:11
6 * @FilePath: \supermapvue\src\components\vt\Map_wz.vue
7 -->
8 <template>
9 <div >
10 <div id="map"></div>
11 </div>
12 </template>
13
14 <script>
15 import mapboxgl from 'mapbox-gl';
16 import { Logo } from '@supermap/iclient-mapboxgl';
17
18 export default {
19 name: 'MVT',
20 data () {
21 return {
22
23 }
24 },
25 mounted(){
26 // var url = "http://127.0.0.1:8090/iserver/services/map-mvt-China_Dark/rest/maps/China_Dark/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true";
27 // $.ajax({
28 // url:url,
29 // success:function(mvtStyle){
30 // var zoom = mvtStyle.zoom == null ? minZoomLevel : mvtStyle.zoom;
31 // var map = new mapboxgl.Map({
32 // container: 'map', // container id
33 // style: mvtStyle,
34 // center: [-1, -2],// starting position
35 // zoom: 4, // starting zoom
36 // minZoom: 0,
37 // maxZoom: 5,
38 // crs: "EPSG:4490"
39 // });
40 // map.addControl(new mapboxgl.NavigationControl(), 'top-left');
41 // // map.setStyle({
42 // // style: {
43 // // layers: [
44 // // {
45 // // "id": "background",
46 // // "type": "background",
47 // // "layout": {},
48 // // "paint": {
49 // // "background-color": "#fcfcfc"
50 // // }
51 // // }
52 // // ]
53 // // }
54 // // }, {diff: false});
55 // }
56 // });
57 var map = new mapboxgl.Map({
58 container: 'map', // container id
59 style:
60 'http://127.0.0.1:8090/iserver/services/map-mvt-China_Dark/rest/maps/China_Dark/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true',
61 center: [116.4, 39.9],
62 minZoom: 0,
63 zoom: 5
64 });
65 map.addControl(new mapboxgl.NavigationControl(), 'top-left');
66 map.on('load', function () {
67 console.log(map.getStyle().layers);
68 map.setPaintProperty('WorldElements_R@China', 'fill-color', '#a1dab4');
69 map.setPaintProperty('Country_R@China', 'fill-color', '#f03b20');
70 map.setPaintProperty('Province_R@China', 'fill-color', '#fd8d3c');
71 });
72 }
73 }
74 </script>
75
76 <style scoped>
77 #map {
78 position: absolute;
79 height: 100%;
80 width: 100%;
81 background-color: white
82 }
83 </style>
...\ No newline at end of file ...\ No newline at end of file
1 // The Vue build version to load with the `import` command
2 // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 import Vue from 'vue'
4 import App from './App'
5 import router from './router'
6 import 'ant-design-vue/dist/antd.css'
7
8 Vue.config.productionTip = false
9
10 /* eslint-disable no-new */
11 new Vue({
12 el: '#app',
13 router,
14 components: { App },
15 template: '<App/>'
16 })
1 import Vue from 'vue'
2 import Router from 'vue-router'
3 import Mapviewer from '@/components/basic/Map_measure'
4 Vue.use(Router)
5
6 export default new Router({
7 routes: [
8 {
9 path: '/',
10 name: 'Mapviewer',
11 component: Mapviewer
12 }
13 ]
14 })
File mode changed
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.