`
hain
  • 浏览: 448934 次
  • 来自: ...
社区版块
存档分类
最新评论

google maps v3 getBounds()

阅读更多

这两天被Google map的getBounds搞得郁闷,在初始化方法map或者onload的时候调用map.getBounds() 总是出问题,要么map==null 要么 getBounds 返回 undefined。

按照 Google Maps API V3 Reference 的如下说明调用也不行

getBounds():Returns the lat/lng bounds of the current viewport. If the map is not yet initialized (i.e. the mapType is still null), or center and zoom have not been set then the result is null.

 

最后发现这种方式可行或者getBounds只要在setTimeout 第一个参数方法里面被包含都莫问题:

setTimeout ('map.getBounds()',0)

分享到:
评论

相关推荐

    city-boundaries-google-maps:在Google地图上绘制城市边界(界限)

    city-boundaries-googlemaps.js 查找城市边界并将其显示在Google Maps画布上的主要JavaScript文件。 使用输入的城市创建图例。 Utility-functions.js 一些小的实用程序。 依序关系 该JavaScript获取指定的边界关系...

    MoonCamp:MoonCamp是Airbnb的俏皮翻版

    月亮地图月球营地的有趣方面之一是使用Google Maps imageType通过美国国家航空航天局的开源卫星图像绘制出行星的不同表面。 通过使用Google Maps API,月球营地可以规范and imgaeType的经度和纬度,从而轻松绘制出可...

    GoogleMap API2 和GoogleMap API3 的应用

    主要是getBoundsZoomLevel在googleV2和googleV3中的不同用法!欢迎各位做地图开发的童鞋联系我。

    java多种改变字体样式实例

    j < shape.getBounds().y + shape.getBounds().height; j=j+3) { Line2D line = new Line2D.Float( 0.0f, (float) j, (float) w, (float) j); g2.draw(line); } } public static void main(String s[]) { ...

    sodaWithinBox:使用传单的 getBounds() 方法进行 inside_box 查询的简单 SODA API 示例

    使用 Leaflet 的 SODA inside_box() 示例一个简单的网络地图,它从传单中获取当前边界框并从 SODA API 中提取数据,在地图上创建带有弹出窗口的标记。该地图在固定位置加载并检索过去 7 天来自纽约市的 311 次投诉以...

    D3-Integration:收集所有精美的D3 SVG代码

    D3出色的SVG集成 该存储库主要专注于绘制/收集交互式,清晰,易于使用的数据,即 条形字符,线形字符,散点图 交互式显示标签 根据数据填充颜色 向折线图添加阴影 添加对应于不同轴的多线 添加与输入数据相对应的...

    华容道 小游戏 源代码

    Rectangle directionRect=direction.getBounds(); for(int k=0;k;k++) { Rectangle personRect=person[k].getBounds(); if((manRect.intersects(personRect))&&(man.number!=k)) { move=false; } } if...

    汉诺塔java代码注释

    int x=this.getBounds().x+this.getBounds().width; int y=this.getBounds().y; tower.getAutoMoveDisc().setLocation(x,y); tower.getAutoMoveDisc().setSize(280,this.getBounds().height); tower....

    C#100例题 献给c#初学者

    this.SetBounds(this.Left, this.Top, Rows[0].GetBounds().Width, this.Height); TheScore = new Score(ClientRectangle.Right - 50, ClientRectangle.Bottom - 180); // choose Level SpeedDialog dlg = ...

    bound-points:查找一组点的边界框

    var getBounds = require ( 'bound-points' ) var points = [ [ - 1 , 1 ] , [ 5 , 10 ] , [ - 8 , 13 ] ] console . log ( '2d:' , getBounds ( points ) ) var mesh = require ( 'bunny' ) console . log ( '3d:' ...

    svg-path-bounds:获取svg路径数据的边界框

    const getBounds = require ( 'svg-path-bounds' ) let [ left , top , right , bottom ] = getBounds ( 'M0 0L10 10 20 0Z' ) // [0, 0, 20, 10] bounds = getBounds(path | segments) 计算字符串或数组的边界...

    as2.0amlabfire.zip_BitmapData_True Blue

    var clipBounds: Object = blueSpotClip.getBounds() var blueSpot: BitmapData = new BitmapData( clipBounds.xMax, clipBounds.yMax, true, 0 ) blueSpot.draw( blueSpotClip, new Matrix() ) blueSpotClip....

    华容道基于Java swing开发

    Rectangle dirctionRect = direction.getBounds(); for (int k = 0; k ; k++) { Rectangle personRect = person[k].getBounds(); if ((manRect.intersects(personRect)) && (man.number != k)) move = ...

    easeljs1.0.0源码

    this._managed[b.id]&&b._reset()),this._managed[b.id]=2)},b.Container__getBounds=b._getBounds,b._getBounds=function(a,b){var c=this.DisplayObject_getBounds();return c||(this._updateTimeline(),this....

    百度地图使用的demo

    ##创建一个map var map = new BMap.Map("divId"); ##要想显示地图,必须设定中心坐标和放大级别(范围为3-18级) ...var bounds = map.getBounds(); var sw = bounds.getSouthWest(); var ne = bounds.getNorthEast();

    Java实现图形弹跳球程序

    Rectangle bounds = getBounds(); //获得此 Rectangle 的边界 Rectangle if ((x - r + dx ) || (x + r + dx > bounds.width)) dx = -dx; if ((y - r + dy ) || (y + r + dy > bounds.height)) dy ...

    node-window-manager:使用Node.js管理Windows,macOS和Linux中的窗口

    节点窗口管理器 ... getBounds ( ) ) ; // This method has to be called on macOS before changing the window's bounds, otherwise it will throw an error. // It will prompt an accessibility permission r

    电子托盘窗口定位器:放置自定义电子托盘窗口

    在linux上,位置是根据当前光标位置计算的,因为Tray.getBounds()始终返回一个Rectangle且所有值均设置为零。 安装 npm install --save electron-traywindow-positioner 用法 const positioner = require('electron...

    xrope:原生 as3 显示对象的简单布局库

    AtomLayout 使用getBounds()对齐 DisplayObject。 不用担心FLA 中的注册点。 (将useBounds设置为true ,默认为false ) 轻松合成布局元素/组。 不再需要 DisplayObjectContainer。 如何使用 创建一个实现...

    leaflet-areaselect:用于让用户使用矩形选择地图区域并获得边界框的小叶插件

    传单区域选择 AreaSelect是一个传单插件,可让用户使用地图顶部可调整大小的居中框来选择正方形区域(边框)。 另一个类似的插件是 ,它解决了相同的问题,但提供了一个可移动且不固定在... getBounds ( ) ; // Get a

Global site tag (gtag.js) - Google Analytics