Google maps satellite view

跟風遠走 提交于 2020-01-13 06:44:07

问题


I'm using the google maps API with openstreetmap (see the following example code),

I'd like to add the google satellite view too.

How can this be accomplished?

var tilesMapnik     = new GTileLayer(copyOSM, 1, 17, {tileUrlTemplate: 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'});
var mapMapnik = new GMapType([tilesMapnik],G_NORMAL_MAP.getProjection(), "îôä");


map = new GMap2(document.getElementById("map_canvas"), { mapTypes: [mapMapnik] });
map.setCenter(new GLatLng(32.08, 34.82), 12);

map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());

Explanation about using openstreetmap with google maps:

http://wiki.openstreetmap.org/wiki/Google_Maps_Example


回答1:


If you just want to add the satellite option to your Google Map, try this:

map = new GMap2(document.getElementById("map_canvas"), { mapTypes: [mapMapnik, G_SATELLITE_MAP] });

Alternatively, you can also use this:

map.addMapType(G_SATELLITE_MAP);



回答2:


i think he want to add 2 tabs one is the openStreetMapData and the seconf is google satelite data

like in this site.

http://www.shvoongmap.co.il/

the first tab on the map that writing in hebrew is the openStreetMap data and the others that writine in english is the google data.



来源:https://stackoverflow.com/questions/1437780/google-maps-satellite-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!