admin管理员组文章数量:1410682
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=".4.3/jquery.min.js"></script>
<script type="text/javascript" src=".8.5/jquery-ui.min.js"></script>
<script src=".2&sensor=false&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" type="text/javascript"></script> </head> <body>
<div id="Map" style="width: 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>
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./ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis./ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>
<script src="http://maps.google./maps/api/js?v=3.2&sensor=false&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" type="text/javascript"></script> </head> <body>
<div id="Map" style="width: 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>
Share
Improve this question
edited Jan 27, 2011 at 17:03
Marty Trenouth
asked Jan 27, 2011 at 16:58
Marty TrenouthMarty Trenouth
3,7526 gold badges36 silver badges43 bronze badges
5
- How do you get the map to tilt? I can't do it on my desktop PC with your link. I have seen this feature on Android - IIRC it uses multitouch gestures. – Matt Ball Commented Jan 27, 2011 at 17:02
- What do you mean by "tilt" exactly? Like, isometric view? – Pekka Commented Jan 27, 2011 at 17:03
- birds eye... zoom in on google's maps and you get a 45% tilt, zoom in on a map created from their API and you get no 45% tilt – Marty Trenouth Commented Jan 27, 2011 at 17:04
- I still don't see it. If I zoom in all the way, there's still no tilt. Keep zooming in, and I get street view. – Matt Ball Commented Jan 27, 2011 at 17:12
- Are you in Satelite? (using the Google Offices link) – Marty Trenouth Commented Jan 27, 2011 at 17:20
3 Answers
Reset to default 4Here is demo of using the 45 degree satellite imagery: http://code.google./apis/maps/documentation/javascript/examples/aerial-rotation.html
The methods you are looking for are setTilt() and setHeading(). http://code.google./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.. (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 parable 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??
本文标签: javascript45 Degree Google mapStack Overflow
版权声明:本文标题:javascript - 45 Degree Google map - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744991363a2636407.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论