Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
蒋波涛
/
super_mapboxgl_vue
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
09470480
authored
2019-12-15 19:21:49 +0800
by
unknown
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
20191215
1 parent
1e47f312
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
68 deletions
src/components/basic/Map_mvt.vue
src/components/features/Map_feature_sql.vue
src/components/menu/MyMenu.vue
src/components/query/Map_query_sql.vue
src/components/vt/Map_wz.vue
src/router/index.js
src/components/basic/Map_mvt.vue
View file @
0947048
...
...
@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-09 23:17:48
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-15 1
4:19:14
* @LastEditTime: 2019-12-15 1
8:51:41
* @FilePath: \mymapbox\src\components\Map3857.vue
-->
<
template
>
...
...
src/components/features/Map_feature_sql.vue
View file @
0947048
...
...
@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-10 14:16:04
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-1
0 14:56:09
* @LastEditTime: 2019-12-1
5 18:42:18
* @FilePath: \mymapbox\src\components\Map_filter_sql.vue
-->
<
template
>
...
...
src/components/menu/MyMenu.vue
View file @
0947048
...
...
@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-13 23:53:57
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-15 1
5:28:22
* @LastEditTime: 2019-12-15 1
8: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>
...
...
src/components/query/Map_query_sql.vue
View file @
0947048
...
...
@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-10 14:16:04
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-1
0 14:29:45
* @LastEditTime: 2019-12-1
5 18:15:04
* @FilePath: \mymapbox\src\components\Map_filter_sql.vue
-->
<
template
>
...
...
src/components/vt/Map_wz.vue
View file @
0947048
...
...
@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-10 22:15:53
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-1
2 21:07:20
* @LastEditTime: 2019-12-1
5 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
}
});
});
});
}
...
...
src/router/index.js
View file @
0947048
...
...
@@ -2,7 +2,7 @@
* @Author: jiangbotao
* @Date: 2019-12-12 17:40:15
* @LastEditors: jiangbotao
* @LastEditTime: 2019-12-1
4 00:05:56
* @LastEditTime: 2019-12-1
5 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'
)
}
]
})
...
...
Please
register
or
sign in
to post a comment