原点纬度/经度:39.50000000,-84.78000000
目的地纬度/经度:28.42000000,-81.31000000
我如何绘制其边界框?
正确的边界框是:
+-----1
| / |
| / |
| / |
2-----+
我有兴趣找到1分和2分。
答案 0 :(得分:2)
你可以使用fitbounds
<body>
.....
<div id='your_map_id' style='height : 300px; width: 300px;'></div>
<body>
<style>
var mapDiv = document.getElementById('your_map_id');
var map = new google.maps.Map(mapDiv, {
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var southWest = new google.maps.LatLng(28.42000000, -84.780000);
var northEast = new google.maps.LatLng(39.50000000, -81.31000000);
var bounds = new google.maps.LatLngBounds(southWest,northEast);
map.fitBounds(bounds);
</style>