Closed spinninghamster closed 3 years ago
const markerData = [
{ position : { lat: xxx, lng: xxx}, icon: { ... }, name: "marker1"}},
{ position : { lat: xxx, lng: xxx}, icon: { ... }, name: "marker2"}},
{ position : { lat: xxx, lng: xxx}, icon: { ... }, name: "marker3"}},
];
var map = plugin.google.maps.getMap(div, {
camera: {
target: [
markerData[0].position,
markerData[1].position,
markerData[2].position
]
}
});
map.one(plugin.google.maps.MAP_READY, () => {
const markers = markerData.map((data) => {
return map.addMarker(data);
});
});
If you pass the array of LatLng
or ILatLng
to the camera, this plugin calculates the center and zoom automatically.
Thanks a lot! You saved me day :)
I've been looking in the documentation for quite some time but can't find an answer or where to get started.
I have 3 markers on a simple map and I just whenever the map loads want to ensure they are all shown on the map and therefor also adjust the zoom level accordingly. How do I achieve that?
They are placed with: