09470480 by unknown

20191215

1 parent 1e47f312
......@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-09 23:17:48
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-15 14:19:14
* @LastEditTime: 2019-12-15 18:51:41
* @FilePath: \mymapbox\src\components\Map3857.vue
-->
<template>
......
......@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-10 14:16:04
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-10 14:56:09
* @LastEditTime: 2019-12-15 18:42:18
* @FilePath: \mymapbox\src\components\Map_filter_sql.vue
-->
<template>
......
......@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-13 23:53:57
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-15 15:28:22
* @LastEditTime: 2019-12-15 18:39:11
* @FilePath: \supermapvue\src\components\menu\MyMenu.vue
-->
<template>
......@@ -17,6 +17,7 @@
<a-menu-item key="1_2"><router-link :to="'/rastertile'">栅格瓦片</router-link></a-menu-item>
<a-menu-item key="1_3"><router-link :to="'/mvt'">矢量瓦片</router-link></a-menu-item>
<a-menu-item key="1_4"><router-link :to="'/measure'">地图量测</router-link></a-menu-item>
<a-menu-item key="1_5"><router-link :to="'/mvt_wz'">本地矢量瓦片</router-link></a-menu-item>
</a-sub-menu>
<a-sub-menu key="sub2">
<span slot="title"><a-icon type="team" /><span>要素查询</span></span>
......
......@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-10 14:16:04
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-10 14:29:45
* @LastEditTime: 2019-12-15 18:15:04
* @FilePath: \mymapbox\src\components\Map_filter_sql.vue
-->
<template>
......
......@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-10 22:15:53
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-12 21:07:20
* @LastEditTime: 2019-12-15 19:21:09
* @FilePath: \supermapvue\src\components\vt\Map_wz.vue
-->
<template>
......@@ -13,89 +13,77 @@
<script>
import mapboxgl from 'mapbox-gl';
import { Logo } from '@supermap/iclient-mapboxgl';
import { Logo, FeatureService, QueryService } from '@supermap/iclient-mapboxgl';
export default {
name: 'MVT',
data () {
return {
map: null
}
},
mounted(){
mapboxgl.accessToken = 'pk.eyJ1IjoiY2hpYW5nYnQyIiwiYSI6ImNqemYzODJuejA4ZG0zbW53azE3eWljemsifQ.zCGZHTRuZV2uqovnXYtsew';
var map = new mapboxgl.Map({
this.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: 3,
pitch: 45,
bearing: -10
// pitch: 45,
// bearing: -10
});
map.addControl(new mapboxgl.NavigationControl(), 'top-left');
this.map.addControl(new mapboxgl.NavigationControl(), 'top-left');
var __this = this;
this.map.on('load', function () {
// console.log(map.getStyle().sources);
// console.log(map.getStyle().layers);
__this.map.setPaintProperty('WorldElements_R@China', 'fill-color', '#a1dab4');
__this.map.setPaintProperty('River_R@China', 'fill-color', '#fcfcfc');
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', '#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]
]
var dataUrl = 'http://127.0.0.1:8090/iserver/services/data-China/rest/data/';
var sqlParam = new SuperMap.GetFeaturesBySQLParameters({
queryParameter: {
name: "poi",
attributeFilter: "SMID > 0"
},
// 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'
]
}
datasetNames: ["China:poi"],
maxFeatures: 1000,
toIndex: -1
});
var featureService = new mapboxgl.supermap.FeatureService(dataUrl);
var features = null;
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);
featureService.getFeaturesBySQL(sqlParam, function (serviceResult) {
features = serviceResult.result.features;
console.log(features);
__this.map.addSource("queryDatas", {
"type": "geojson",
"data": features
});
map.on('mouseleave', 'population', function() {
map.getCanvas().style.cursor = '';
popup.remove();
__this.map.addLayer({
"id": "queryDatasLayer",
"type": "circle",
"source": "queryDatas",
"paint": {
'circle-radius': 2,
'circle-color': '#6879FB',
// property:'value',
// stops: [
// [min,'#6879FB'],
// [min + 1/3*range,'#68FB75'],
// [min + 2/3*range, '#F94B18'],
// [max, '#F92918']
// ]
// },
'circle-opacity': 1.0,
"circle-stroke-width": 2,
"circle-stroke-color": "#007cbf",
"circle-stroke-opacity": 0.7
}
});
});
});
}
......
......@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-12 17:40:15
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-14 00:05:56
* @LastEditTime: 2019-12-15 18:08:19
* @FilePath: \supermapvue\src\router\index.js
*/
import Vue from 'vue'
......@@ -106,6 +106,11 @@ export default new Router({
path: '/theme_label',
name: 'Theme_Label',
component: () => import('@/components/theme/Map_theme_label')
},
{
path: '/mvt_wz',
name: 'Theme_wz',
component: () => import('@/components/vt/Map_wz')
}
]
})
......