|
1 | | -<!DOCTYPE html> |
| 1 | +<!doctype html> |
2 | 2 | <html> |
3 | | - |
4 | | -<head> |
5 | | - <meta charset="utf-8"> |
6 | | - <title>deck-gl.leaflet</title> |
7 | | - <script src=" https://unpkg.com/[email protected]/dist/leaflet.js" ></script> |
8 | | - <link rel=" stylesheet" href=" https://unpkg.com/[email protected]/dist/leaflet.css" > |
9 | | - <script src=" https://unpkg.com/[email protected]/dist.min.js" ></script> |
10 | | - <script src=" https://unpkg.com/[email protected]/dist/deck.gl-leaflet.umd.min.js" ></script> |
11 | | - <!-- <script src="../dist/deck.gl-leaflet.umd.min.js"></script> --> |
12 | | - |
13 | | - <style> |
14 | | - body { |
15 | | - margin: 0; |
16 | | - background: #000; |
17 | | - } |
18 | | - |
19 | | - #map { |
20 | | - width: 100vw; |
21 | | - height: 100vh; |
22 | | - } |
23 | | - </style> |
24 | | -</head> |
25 | | - |
26 | | -<body> |
27 | | - <div id="map"></div> |
28 | | - |
29 | | - <script type="module"> |
30 | | - const mapElement = document.querySelector('#map'); |
31 | | - |
32 | | - const map = L.map(mapElement, { |
33 | | - center: [51.5, -0.11], |
34 | | - zoom: 13, |
35 | | - }); |
36 | | - L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
37 | | - attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', |
38 | | - }).addTo(map); |
39 | | - |
40 | | - const startLatLng = [51.5, -0.11]; |
41 | | - const latDelta = 0.01; |
42 | | - const lngDelta = latDelta * 1.75; |
43 | | - const latLngs = new Array(9).fill(undefined).map((_, i) => [startLatLng[0] + Math.floor(i / 3) * latDelta, startLatLng[1] + (i % 3) * lngDelta]); |
44 | | - map.setView([startLatLng[0] + latDelta, startLatLng[1] + lngDelta]); |
45 | | - |
46 | | - const deckLayer = new DeckGlLeaflet.LeafletLayer({ |
47 | | - views: [ |
48 | | - new deck.MapView({ |
49 | | - repeat: true |
50 | | - }) |
51 | | - ], |
52 | | - layers: [ |
53 | | - new deck.PolygonLayer({ |
54 | | - data: [ |
55 | | - [[-180, 85.06], [0, 85.06], [180, 85.06], [180, -85.06], [0, -85.06], [-180, -85.06]] |
56 | | - ], |
57 | | - getPolygon: d => d, |
58 | | - stroked: true, |
59 | | - filled: false, |
60 | | - getLineColor: [255, 0, 0], |
61 | | - getLineWidth: 2, |
62 | | - lineWidthUnits: 'pixels', |
63 | | - }), |
64 | | - new deck.ScatterplotLayer({ |
65 | | - data: latLngs.map((latLng, i) => ({ id: i, position: [latLng[1], latLng[0]] })), |
66 | | - getPosition: d => d.position, |
67 | | - getRadius: 100, |
68 | | - getFillColor: [255, 0, 0], |
69 | | - pickable: true, |
70 | | - }), |
71 | | - ], |
72 | | - onHover: ({ object }) => object && console.log(object), |
73 | | - getTooltip: ({ object }) => object && { html: object.id }, |
74 | | - }); |
75 | | - map.addLayer(deckLayer); |
76 | | - |
77 | | - const featureGroup = L.featureGroup(); |
78 | | - latLngs.forEach(latLng => { |
79 | | - featureGroup.addLayer(L.marker(latLng)); |
80 | | - }); |
81 | | - map.addLayer(featureGroup); |
82 | | - </script> |
83 | | -</body> |
84 | | - |
| 3 | + <head> |
| 4 | + <title>deck.gl-community tests</title> |
| 5 | + </head> |
| 6 | + <body> |
| 7 | + <script type="module" src="./test/browser.js"></script> |
| 8 | + </body> |
85 | 9 | </html> |
0 commit comments