开发者

45 Degree Google map

How do I get google maps to tilt and display a 45% view?

Documentation says that it should do it "automatically", but it doesn't seem to be doing it. Is this a feature Google is holding back from the API?

Click the link to and zoom in to see the feature as it is used on google maps Google Offices

<html> <head>   <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
    <script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" type="text/javascript"></script> </head> <body>

<div id="Map" style="widt开发者_高级运维h: 100%;height: 500px"> </div>

<script>
        var latlng = new google.maps.LatLng(37.4219720,
-122.0841430);
        var myOptions = {
            zoom: 3,
            scrollwheel: false, 
            center: latlng,
            mapTypeId: google.maps.MapTypeId.HYBRID
        };
        var map = new google.maps.Map(document.getElementById("Map"), myOptions);
        var bounds = new google.maps.LatLngBounds();
        bounds.extend(CreateMarker(map,37.4219720,-122.0841430).getPosition());
        map.fitBounds(bounds);


function CreateMarker(map, latitude, longitude){
    var marker = new google.maps.Marker({       
        position: new google.maps.LatLng(latitude, longitude),        
        map: map,        
    });

    return marker; } </script> </body> </html>


Here is demo of using the 45 degree satellite imagery: http://code.google.com/apis/maps/documentation/javascript/examples/aerial-rotation.html

The methods you are looking for are setTilt() and setHeading(). http://code.google.com/apis/maps/documentation/javascript/reference.html#Map

Note: 45 degree imagery is only available at certain zoom levels (18,19,20) and certain areas.

var map;
function initialize() {
  var mapOptions = {
    center: new google.maps.LatLng(45.518970, -122.672899),
    zoom: 18,
    mapTypeId: google.maps.MapTypeId.SATELLITE
  };
  map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

  // changes map to use 45 degree imgary
  map.setTilt(45);
  map.setHeading(90);
}


AFAIK, Google Maps on desktop browsers can't tilt maps by itself; only Google Earth, the Google Earth browser-plugin and the Android app can do that (currently).

Could you provide a link to the documentation that says that it should tilt automatically?

The page at the link you provide only switches on the plugin if you have it (obviously) and select the 'Earth' button on the top right.

When HTML 5 is supported more widely, I’m guessing Google Maps will be able to use vector graphics as well. Till then, it’s tiled bitmaps or the Earth plugin, I’m afraid.


I might be wrong, but I though Marty (op) originally asked for the tilted view of "satelite imagery" (3D transforms of the 2D satelite images) as opposed to the aerial photage of specific cities that have been added to GMaps over the past years.

Google Maps has this feature (tilted view / two different angles), through the "tilt view" control from maps.google.com. (the API is there map.setTilt(), it just isn't enabled).

Google earth used to have this feature, now it seems Google Earth is begin phased out, and it's features have been merged into Google Maps, with the exception of "tilted view". Another exception is the Google Maps Android API, which seems to be having it!! Especially in the Google Navigation app for Android, it makes use of that in a very cool way). (Supposedly done to add more value to the Android SDK over iOS).

I guess down the road it'll be made available, when other services start offering comparable services. I hope this will happen pretty soon. Are there any other map providers doing anything similar? I think Bing is just doing more aerial photos??

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜