Skip to content

Commit 12a2629

Browse files
author
潘卓然-中地数码台式机
committed
补充mapboxgl的webgl原生绘制以及依赖
1 parent 4287809 commit 12a2629

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
lines changed

demo/mapbox/example/geometry/graphic/webgl.htm

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
mercator.x = poi.lng * Math.PI / 180 * earthRad;
3030
var a = poi.lat * Math.PI / 180;
3131
mercator.y = earthRad / 2 * Math.log((1.0 + Math.sin(a)) / (1.0 - Math.sin(a)));
32-
console.log("mercator",mercator);
32+
console.log("mercator", mercator);
3333
return mercator; //[12727039.383734727, 3579066.6894065146]
3434
}
3535
/**
@@ -51,25 +51,7 @@
5151
'pk.eyJ1IjoicGFybmRlZWRsaXQiLCJhIjoiY2o1MjBtYTRuMDhpaTMzbXhpdjd3YzhjdCJ9.sCoubaHF9-nhGTA-sgz0sA';
5252
var map = new mapboxgl.Map({
5353
container: 'mapid',
54-
style: {
55-
"version": 8,
56-
"sources": {
57-
"mapbox-tiles": {
58-
"type": "raster",
59-
'tiles': [
60-
"https://api.tiles.mapbox.com/v4/mapbox.light/{z}/{x}/{y}.png?access_token=sk.eyJ1IjoiY2hlbmdkYWRhIiwiYSI6ImNqZDFjaGo0ZjFzcnoyeG54enoxdnNuZHUifQ.hTWXXBUQ0wdGeuDF3GWeUw"
61-
],
62-
'tileSize': 256
63-
}
64-
},
65-
"layers": [{
66-
"id": "light-tiles",
67-
"type": "raster",
68-
"source": "mapbox-tiles",
69-
"minzoom": 0,
70-
"maxzoom": 22
71-
}]
72-
},
54+
style: 'mapbox://styles/mapbox/light-v9',
7355
zoom: 3,
7456
center: [7.5, 58]
7557
});
@@ -79,7 +61,6 @@
7961
type: 'custom',
8062

8163
onAdd: function (map, gl) {
82-
console.log(gl)
8364
var vertexSource = "" +
8465
"uniform mat4 u_matrix;" +
8566
"attribute vec2 a_pos;" +
@@ -106,15 +87,15 @@
10687

10788
this.aPos = gl.getAttribLocation(this.program, "a_pos");
10889

109-
var helsinki = getMercator({
90+
var helsinki = mapboxgl.MercatorCoordinate.fromLngLat({
11091
lng: 25.004,
11192
lat: 60.239
11293
});
113-
var berlin = getMercator({
94+
var berlin = mapboxgl.MercatorCoordinate.fromLngLat({
11495
lng: 13.403,
11596
lat: 52.562
11697
});
117-
var kyiv = getMercator({
98+
var kyiv = mapboxgl.MercatorCoordinate.fromLngLat({
11899
lng: 30.498,
119100
lat: 50.541
120101
});
@@ -141,7 +122,8 @@
141122
};
142123

143124
map.on('load', function () {
144-
map.addLayer(highlightLayer);
125+
var gllayer = map.addLayer(highlightLayer, 'building');
126+
console.log(gllayer)
145127
});
146128
</script>
147129
</body>

img/military/桥梁.png

620 Bytes
Loading

libs/zondyclient/include-mapboxgl-local.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
}
131131
if (!inArray(excludes, 'plugin')) {
132132
inputCSS(httpUrl + "/cdn/zondyclient/webclient-mapboxgl-plugins.css");
133-
inputScript(httpUrl + "/cdn/zondyclient/webclient-mapboxgl-plugins.js");//这里是三方如igserver-x,datastore的api
133+
inputScript(httpUrl + "/cdn/zondyclient/webclient-mapboxgl-plugins.min.js");//这里是三方如igserver-x,datastore的api
134134
}
135135
}
136136

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy