-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
11,287 additions
and
1,614 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2023 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<html> | ||
<head> | ||
<style> | ||
html, | ||
body, | ||
#map { | ||
margin: 0; | ||
height: 100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script src="bench-advanced.js" type="module"></script> | ||
<script src="vendor.js" type="module"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { MAP_ID, getLoaderOptions } from "./config"; | ||
import { Loader } from "@googlemaps/js-api-loader"; | ||
import { MarkerClusterer } from "../src"; | ||
import points from "./realworld.json"; | ||
|
||
// Do not set the mapId to force legacy markers | ||
const mapOptions: google.maps.MapOptions = { | ||
center: { lat: -37.89, lng: 175.46 }, | ||
zoom: 8, | ||
maxZoom: 18, | ||
mapId: MAP_ID, | ||
}; | ||
|
||
new Loader(getLoaderOptions()).load().then(() => { | ||
const element = document.getElementById("map"); | ||
|
||
const map = new google.maps.Map(element, mapOptions); | ||
|
||
const markers = (points as [number, number, string][]).map( | ||
([lat, lng, title]) => | ||
new google.maps.marker.AdvancedMarkerElement({ | ||
position: { lat, lng }, | ||
map, | ||
title, | ||
}) | ||
); | ||
|
||
const markerCluster = new MarkerClusterer({ | ||
markers, | ||
algorithmOptions: { maxZoom: 30 }, | ||
}); | ||
|
||
markerCluster.setMap(map); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2023 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<html> | ||
<head> | ||
<style> | ||
html, | ||
body, | ||
#map { | ||
margin: 0; | ||
height: 100%; | ||
} | ||
</style> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" | ||
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" | ||
crossorigin=""/> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/MarkerCluster.Default.css"/> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" | ||
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" | ||
crossorigin=""></script> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.markercluster-src.js"></script> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script src="bench-leaflet.js" type="module"></script> | ||
<script src="vendor.js" type="module"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import points from "./realworld.json"; | ||
|
||
declare let L: any; | ||
|
||
const tiles = L.tileLayer("//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { | ||
maxZoom: 18, | ||
attribution: | ||
'© <a href="//openstreetmap.org/copyright">OpenStreetMap</a> contributors, Points © 2012 LINZ', | ||
}); | ||
|
||
const map = L.map("map", { | ||
center: L.latLng(-37.89, 175.46), | ||
zoom: 8, | ||
layers: [tiles], | ||
}); | ||
|
||
const mcg = L.markerClusterGroup({ | ||
chunkedLoading: true, | ||
spiderfyOnMaxZoom: false, | ||
}); | ||
|
||
for (const [lat, lng, title] of points as [number, number, string][]) { | ||
const marker = L.marker(new L.LatLng(lat, lng), { title }); | ||
marker.bindPopup(title); | ||
mcg.addLayer(marker); | ||
} | ||
|
||
map.addLayer(mcg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2023 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<html> | ||
<head> | ||
<style> | ||
html, | ||
body, | ||
#map { | ||
margin: 0; | ||
height: 100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script src="bench-legacy.js" type="module"></script> | ||
<script src="vendor.js" type="module"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { getLoaderOptions } from "./config"; | ||
import { Loader } from "@googlemaps/js-api-loader"; | ||
import { MarkerClusterer } from "../src"; | ||
import points from "./realworld.json"; | ||
|
||
// Do not set the mapId to force legacy markers | ||
const mapOptions: google.maps.MapOptions = { | ||
center: { lat: -37.89, lng: 175.46 }, | ||
zoom: 8, | ||
maxZoom: 18, | ||
}; | ||
|
||
new Loader(getLoaderOptions()).load().then(() => { | ||
const element = document.getElementById("map"); | ||
|
||
const map = new google.maps.Map(element, mapOptions); | ||
|
||
const markers = (points as [number, number, string][]).map( | ||
([lat, lng, label]) => | ||
new google.maps.Marker({ position: { lat, lng }, label }) | ||
); | ||
|
||
const markerCluster = new MarkerClusterer({ | ||
markers, | ||
algorithmOptions: { maxZoom: 30 }, | ||
}); | ||
|
||
markerCluster.setMap(map); | ||
}); |
Oops, something went wrong.