Skip to content

Commit c42771f

Browse files
authored
Merge pull request #6 from stadiamaps/minor-fixes
Minor fixes
2 parents 89ff90a + 3f75b99 commit c42771f

File tree

5 files changed

+956
-823
lines changed

5 files changed

+956
-823
lines changed

examples/local-test.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Basic MapLibre Search</title>
7+
<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js"></script>
8+
<link
9+
href="https://unpkg.com/[email protected]/dist/maplibre-gl.css"
10+
rel="stylesheet"
11+
/>
12+
<script src="../dist/maplibre-search-box.umd.js"></script>
13+
<link href="../dist/maplibre-search-box.css" rel="stylesheet" />
14+
</head>
15+
<body style="margin: 0; padding: 0">
16+
<div id="map" style="height: 100vh; width: 100vw"></div>
17+
<script type="application/javascript">
18+
var control = new maplibreSearchBox.MapLibreSearchControl({
19+
useMapFocusPoint: true,
20+
onResultSelected: feature => {
21+
// You can add code here to take some action when a result is selected.
22+
console.log(feature.geometry.coordinates);
23+
},
24+
});
25+
var map = new maplibregl.Map({
26+
container: "map",
27+
style: "https://tiles.stadiamaps.com/styles/alidade_smooth.json", // stylesheet location
28+
center: [-74.5, 40], // starting position [lng, lat]
29+
zoom: 2, // starting zoom
30+
});
31+
map.addControl(control, "top-left");
32+
</script>
33+
</body>
34+
</html>

0 commit comments

Comments
 (0)