Ich habe diesen Code, der eine Karte rendert.Google Maps API V3-Methode fitBounds()
function initialize() {
var myOptions = {
center: new google.maps.LatLng(45.4555729, 9.169236),
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP,
panControl: true,
mapTypeControl: false,
panControlOptions: {
position: google.maps.ControlPosition.RIGHT_CENTER
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.RIGHT_CENTER
},
scaleControl: false,
streetViewControl: false,
streetViewControlOptions: {
position: google.maps.ControlPosition.RIGHT_CENTER
}
};
var map = new google.maps.Map(document.getElementById("mapCanvas"),
myOptions);
var Item_1 = new google.maps.LatLng(45.5983128 ,8.9172776);
var myPlace = new google.maps.LatLng(45.4555729, 9.169236);
var marker = new google.maps.Marker({
position: Item_1,
map: map});
var marker = new google.maps.Marker({
position: myPlace,
map: map});
var bounds = new google.maps.LatLngBounds(myPlace, Item_1);
map.fitBounds(bounds);
}
Auch wenn die beiden Punkte von 25 km getrennt sind erhalte ich dieses Ergebnis:
Während Ich mag würde ein höheres Maß Zoom machen.
Gefällt Ihnen dieses
ich die Methode fitBounds verwenden()
var bounds = new google.maps.LatLngBounds(myPlace, Item_1);
map.fitBounds(bounds);
Vielen Dank für Ihre Unterstützung
Hah! Ich habe mich nur geschlagen. iPad-Tastaturen machen schnelles Tippen nicht einfach. –