Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. var latlng = new google.maps.LatLng(38.269239, -122.276010);
  2. var myOptions = {
  3. zoom: 15,//Calculate this somehow?
  4. center: latlng,// Calculate value from array of coordinates?
  5. mapTypeId: google.maps.MapTypeId.HYBRID
  6. };
  7.  
  8. var bounds = new google.maps.LatLngBounds();
  9. for (var i = 0; i < coordinates.length; i++) {
  10. bounds.extend(coordinates[i]);
  11. }
  12.  
  13. bounds.getCenter();
  14.  
  15. map.fitBounds(bounds);
  16.  
  17. var bounds = new google.maps.LatLngBounds();
  18. polyline.getPath().forEach(function(e){//can't do polyline.getPath()[i] because it's a MVCArray
  19. bounds.extend(e);
  20. })
  21. _map.fitBounds(bounds);
  22.  
  23. map.fitBounds(bounds);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement