f016ccb9 by unknown

'20191213'

1 parent 600653b5
/*
* @Author: jiangbotao
* @Date: 2019-12-12 17:39:25
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-13 01:27:49
* @FilePath: \supermapvue\config\index.js
*/
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
......@@ -22,7 +29,7 @@ module.exports = {
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
port: 7000, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
......
......@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-09 23:17:48
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-12 16:31:06
* @LastEditTime: 2019-12-13 00:41:31
* @FilePath: \mymapbox\src\components\Map3857.vue
-->
<template>
......
......@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-10 22:15:53
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-12 17:31:11
* @LastEditTime: 2019-12-12 21:07:20
* @FilePath: \supermapvue\src\components\vt\Map_wz.vue
-->
<template>
......@@ -23,51 +23,80 @@ export default {
}
},
mounted(){
// 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";
// $.ajax({
// url:url,
// success:function(mvtStyle){
// var zoom = mvtStyle.zoom == null ? minZoomLevel : mvtStyle.zoom;
// var map = new mapboxgl.Map({
// container: 'map', // container id
// style: mvtStyle,
// center: [-1, -2],// starting position
// zoom: 4, // starting zoom
// minZoom: 0,
// maxZoom: 5,
// crs: "EPSG:4490"
// });
// map.addControl(new mapboxgl.NavigationControl(), 'top-left');
// // map.setStyle({
// // style: {
// // layers: [
// // {
// // "id": "background",
// // "type": "background",
// // "layout": {},
// // "paint": {
// // "background-color": "#fcfcfc"
// // }
// // }
// // ]
// // }
// // }, {diff: false});
// }
// });
mapboxgl.accessToken = 'pk.eyJ1IjoiY2hpYW5nYnQyIiwiYSI6ImNqemYzODJuejA4ZG0zbW53azE3eWljemsifQ.zCGZHTRuZV2uqovnXYtsew';
var map = new mapboxgl.Map({
container: 'map', // container id
style:
'http://127.0.0.1:8090/iserver/services/map-mvt-China_Dark/rest/maps/China_Dark/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true',
center: [116.4, 39.9],
minZoom: 0,
zoom: 5
zoom: 3,
pitch: 45,
bearing: -10
});
map.addControl(new mapboxgl.NavigationControl(), 'top-left');
map.on('load', function () {
console.log(map.getStyle().sources);
console.log(map.getStyle().layers);
map.setPaintProperty('WorldElements_R@China', 'fill-color', '#a1dab4');
map.setPaintProperty('Country_R@China', 'fill-color', '#f03b20');
map.setPaintProperty('Country_R@China', 'fill-color', '#FFFFFF');
map.setPaintProperty('Province_R@China', 'fill-color', '#fd8d3c');
map.setPaintProperty('River_R@China', 'fill-color', '#fcfcfc');
map.addLayer({
'id': 'population',
'type': 'circle',
'source': {
type: 'vector',
url: 'mapbox://examples.8fgz4egr'
},
'source-layer': 'sf2010',
'paint': {
// make circles larger as the user zooms from z12 to z22
'circle-radius': {
'base': 1.75,
'stops': [
[12, 2],
[22, 180]
]
},
// color circles by ethnicity, using a match expression
// https://docs.mapbox.com/mapbox-gl-js/style-spec/#expressions-match
'circle-color': [
'match',
['get', 'ethnicity'],
'White',
'#fbb03b',
'Black',
'#223b53',
'Hispanic',
'#e55e5e',
'Asian',
'#3bb2d0',
/* other */ '#ccc'
]
}
});
var popup = new mapboxgl.Popup({
closeButton: false
});
map.on('mousemove', 'population', function(e) {
// Change the cursor style as a UI indicator.
map.getCanvas().style.cursor = 'pointer';
// Single out the first found feature.
var feature = e.features[0];
console.log(feature.properties);
// Display a popup with the name of the county
popup.setLngLat(e.lngLat)
.setText(feature.properties.ethnicity)
.addTo(map);
});
map.on('mouseleave', 'population', function() {
map.getCanvas().style.cursor = '';
popup.remove();
});
});
}
}
......
/*
* @Author: jiangbotao
* @Date: 2019-12-12 17:40:15
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-13 11:24:37
* @FilePath: \supermapvue\src\router\index.js
*/
import Vue from 'vue'
import Router from 'vue-router'
import Mapviewer from '@/components/basic/Map_measure'
import Mapviewer from '@/components/basic/Map_info'
Vue.use(Router)
export default new Router({
......