How to get Google Maps API to set the correct zoom level for a country?

Is there a was of automatically setting the zoom level based on the size of the country that the map has been centered on? maps.google.com does exactly what I need, so, for example, if I search for Russia I get a zoom level such that Russia just fits on screen, and when I search for Cuba I get a higher zoom level so that Cuba just fits. Is there some way of giving the Maps Api a country locat

如何让Google Maps API为一个国家设置正确的缩放级别?

有没有根据地图所居住国家的大小自动设置缩放级别? maps.google.com正是我所需要的,所以,例如,如果我搜索俄罗斯,我会得到缩放级别,以便俄罗斯适合屏幕显示,而当我搜索古巴时,我可以获得更高的缩放级别,以便古巴只是适合。 有没有给Maps API一个国家位置并获得合适的缩放级别的方法。 如果不是,我想我必须手动(呃!)为这些信息创建我自己的表。 或者这个信息可以在任何地方免费获得? 对于API v3,请检查下

Show/ Hide markers depending on zoom level

I'm trying to show/hide some google map markers depending on the zoom level. I've had a look on here for the answers and while I've got a better idea of what I'm meant to be doing I haven't had any luck being able to implement it into my google map. var infowindow = new google.maps.InfoWindow(); var marker, i; var locations = [ ['<div style="width: 170px;">Title1&l

根据缩放级别显示/隐藏标记

我试图根据缩放级别显示/隐藏一些Google地图标记。 我已经在这里看到了答案,虽然我对自己的意图有了更好的理解,但我还没有能够将其实施到Google地图中的运气。 var infowindow = new google.maps.InfoWindow(); var marker, i; var locations = [ ['<div style="width: 170px;">Title1</div>', 50.794785, -1.116947, image], ['<div style="width: 190px;">Title2</div>', 50.797, -1.109,

Google maps zoom controls and markers disappear

I encountered two very strange issues with a google maps that appear to be happening only on Chrome/Mac and Chrome/Windows If you click on the first pin located in Colorado and try to pan the map moving the mouse to the right you will notice that the zoom controls will start to disappear. I already tried fixing it with max-width:none; so this is not the same bug. If you click on the right m

Google地图缩放控件和标记消失

我遇到了两个非常奇怪的谷歌地图问题,这些问题似乎只发生在Chrome / Mac和Chrome / Windows上 如果您点击位于科罗拉多州的第一个引脚并尝试平移地图,将鼠标移动到右侧,您会注意到变焦控制将开始消失。 我已经尝试用最大宽度修复它:无; 所以这不是同一个错误。 如果您点击位于斯科普里的右侧标记,您会注意到标记将在缩放级别20消失 更新:如果我禁用Chrome上的硬件加速,这两个错误都是固定的,所以我认为它比谷歌地

zoom on google maps [Desktop]

I have a website which uses Google Maps API v3 and i couldn't get the pinch-zoom property to work properly. Instead of a Pinch-to-Zoom-In, the gesture always performs a Zoom-Out. This is a PC monitor with Touch capability. So, as i was unable to get it work properly, i decided to disable the feature. I cancelled the touch event using below document.documentElement.ontouchstart = functi

放大谷歌地图[桌面]

我有一个使用Google Maps API v3的网站,我无法使捏缩放属性正常工作。 而不是捏放缩放,手势始终执行缩小。 这是一款带Touch功能的PC显示器。 所以,因为我无法正常工作,我决定禁用该功能。 我使用下面的方式取消了触摸事件 document.documentElement.ontouchstart = function() {return false} 这有一个不需要的副作用。 此代码会取消整个触摸事件,因此用户无法使用Google Maps默认缩放控件。 我尝试将'ontouc

Remove Pan control in Google Maps API V3

Is there any way to remove the circular panning navigation control but keep the zoom control in the Google Maps V3 API? I've tried forcing it offscreen with jQuery but every time the map is updated it comes back. Any ideas? Thanks! You can use google.maps.NavigationControlStyle.SMALL to display a small plus/minus zoom control, otherwise you'll have to create your own zoom control and

在Google Maps API V3中移除平移控制

有什么方法可以移除圆形的平移导航控件,但在Google Maps V3 API中保留缩放控件? 我试图用jQuery强制离开屏幕,但每次地图更新时都会返回。 有任何想法吗? 谢谢! 您可以使用google.maps.NavigationControlStyle.SMALL来显示一个小的加/减缩放控件,否则您将不得不创建自己的缩放控件并将其添加到地图中。 http://code.google.com/apis/maps/documentation/javascript/controls.html 你也可以看看这里,你可以在声明

Draw radius around a point in Google map

I'm using the Google Maps API and have added markers. Now I want to add a 10 mile radius around each marker, meaning a circle that behaves appropriately while zooming. I have no idea how to do that and it seems it's not something common. I found one example that looks good, and you can have a look at Google Latitude, too. There they use markers with a radius, just like I want them.

在Google地图的某个点周围绘制半径

我正在使用Google Maps API并添加了标记。 现在我想在每个标记周围添加10英里的半径,这意味着在缩放时适当运行的圆圈。 我不知道如何做到这一点,看起来并不常见。 我发现了一个看起来不错的例子,你也可以看看Google Latitude。 在那里,他们使用半径标记,就像我想要的那样。 更新:谷歌纵横使用缩放的图像,这将如何工作? 使用Google Maps API V3创建一个Circle对象,然后使用bindTo()将其绑定到Marker的位置(

How to set zoom level in google map

Here is the code I have written to add a marker to the google map by providing latitude and longitude. The problem is that I get a very highly zoomed google map. I have tried setting the zoom level to 1 but this has no effect to the very highly zoomed map. <script src="http://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script> <script type="t

如何在谷歌地图中设置缩放级别

这里是我写的代码,通过提供纬度和经度向谷歌地图添加标记。 问题是我得到一个非常高度放大的谷歌地图。 我曾尝试将缩放级别设置为1,但这对高度放大的地图没有影响。 <script src="http://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script> <script type="text/javascript"> var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/m

Using setZoom() after using fitBounds() with Google Maps API V3

I'm using fitBounds() to set the zoom level on my map too include all the markers currently displayed. However, when I have only one marker visible, the zoom level is 100% (... which zoom level 20 I think...). However, I don't want it to be that far zoomed in so the user can adjust the position of the marker without having to zoom out. I have the following code: var marker = this.map

在Google Maps API V3中使用fitBounds()后使用setZoom()

我正在使用fitBounds()在我的地图上设置缩放级别,也包括当前显示的所有标记。 但是,当我只有一个标记可见时,缩放级别为100%(...我认为哪个缩放级别20 ...)。 但是,我不希望它被放大,所以用户可以调整标记的位置而不必缩小。 我有以下代码: var marker = this.map.createMarker(view.latlng, this.markerNumber); this.map.bounds.extend(view.latlng); this.map.map.setCenter(this.map.bounds.getCenter()); thi

Equivalent of getBoundsZoomLevel() in gmaps api 3

In API v2, the map object had a handy method getBoundsZoomLevel(). I used it to get the zoom level which fits the bounds best, then manipulated this optimal zoom level somehow and finally set the desired zoom level. I cannot find similar function in API v3. (What a continuous frustrating experience when moving from v2 to v3) Do I really have to use map.fitBounds() , map.getZoom() , manipula

gmaps api中getBoundsZoomLevel()的等价物3

在API v2中,地图对象有一个方便的方法getBoundsZoomLevel()。 我用它来获得最适合边界的缩放级别,然后以某种方式操纵此最佳缩放级别,最后设置所需的缩放级别。 我在API v3中找不到类似的功能。 (从v2迁移到v3时,多么令人沮丧的体验) 我真的必须再次使用map.fitBounds() , map.getZoom() ,操作和setZoom()吗? 这真的很愚蠢! 以下是我实施的功能: /** * Returns the zoom level at which the given rectangula

Google map API displaying marker location in an infowindow

I have a javascript array of locations (jarray), which I am looping over and adding a marker of each location onto a google map. Along with those markers I would like to add an infowindow displaying the marker's location. The code below displays the same latitude and longitude location in each of marker's infowindows. I would like for each marker to have its own address in its infowind

Google地图API在infowindow中显示标记位置

我有一个JavaScript数组的位置(jarray),我正在循环并将每个位置的标记添加到谷歌地图上。 除了这些标记,我还想添加一个显示标记位置的infowindow。 下面的代码在每个标记的infowindows中显示相同的纬度和经度位置。 我希望每个标记在其infowindow中都有自己的地址。 我也尝试将infowindow的内容设置为结果[0] .geometry.location,address和jarray [i]都没有成功。 任何想法,不胜感激。 for(var i = 0; i < jar