I am using GMaps.js and I have several points to show, I need to show all and set the zoom to the point, I was watching the documentation and requests an array of google.maps.LatLng type. I have the following code
for (x in geo){
var item = new google.maps.LatLng(geo[x]["latitud"], geo[x]["longitud"]);
arrayBound.push(item);
}
map = new GMaps({
div: '#divMapa',
lat: latWS,
lng: lngWS,
zoom: 13
});
map.fitBounds(arrayBound);
The required elements for referencing from Google Maps are: Map publisher (Year of publication) Title of map section, Sheet number or tile, scale. Available at: DOI or URL (Accessed: date).
Longitude + (result. Span.
Clear the app's cache & data On your Android phone or tablet, open the Settings app . Tap Apps & notifications. Follow the steps on your device to find the Maps app. After you select the app, storage & cache options should be available.
I didn't find the solution obvious, but, here is an example that works with v0.4.11:
var latlngs = [{lat:"39.158542", lng:"-84.423903"}, {lat:"39.4339357", lng:"-84.9850474"}];
var bounds = [];
for (var i in latlngs) {
var latlng = new google.maps.LatLng(latlngs[i].lat, latlngs[i].lng);
bounds.push(latlng);
map.addMarker({
lat: latlngs[i].lat,
lng: latlngs[i].lng
});
}
map.fitLatLngBounds(bounds);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With