Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nora-soderlund/markerbundle

A way to bundle Maps JavaScript API markers that are placed at the same coordinate.
https://github.com/nora-soderlund/markerbundle

google-maps google-maps-api map maps

Last synced: 26 days ago
JSON representation

A way to bundle Maps JavaScript API markers that are placed at the same coordinate.

Awesome Lists containing this project

README

        

# Get Started
```bat
npm install @nora-soderlund/MarkerBundle
```

# Example
```js
import MarkerBundle from "@nora-soderlund/MarkerBundle";

const center = {
lat: 58.3797077874133,
lng: 12.324640529544448
};

const map = new google.maps.Map(document.getElementById("map"), {
center,

zoom: 12
});

MarkerBundle.getMarkerImage().then((image) => {
const bundle = new MarkerBundle(map, center, image);

const infowindow = new google.maps.InfoWindow({});

for(let index = 1; index < 5; index++) {
const marker = new google.maps.Marker({
map: this.map,
position: this.center
});

marker.addListener("click", (event) => {
infowindow.setContent("Marker " + index);

infowindow.open({
map: this.map,
anchor: bundle.marker
});
});

bundle.addMarker(marker);
}
});
```