国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

根據(jù)圓心經(jīng)緯度和半徑計(jì)算地圖zoom level

2019-11-09 13:55:41
字體:
供稿:網(wǎng)友

方法一:

PRivate double calZoomLevel(LatLng latLng, float radius) { double equatorLength = 40075004.0; double earthRadius = 6371229; double numerator = 1 + Math.pow((float)mMapView.getHeight()/(float)mMapView.getWidth(), 2); double denominator = Math.pow(radius, 2); double distance = Math.sqrt(denominator/numerator); double longitudeDelta = (180 * distance)/(Math.PI * earthRadius * Math.cos(latLng.latitude * Math.PI/180)); int width = DisplayUtil.dpFromPx(this, mMapView.getWidth()); double tt = longitudeDelta * equatorLength * Math.PI / (180.0 * width); double zoom = 21 - Math.log(tt)/Math.log(2.0); return zoom; }

方法二:

private double calZoomLevel2(LatLng latLng, float radius) { // Equators length double equatorLength = 40075004.0; double distance = radius * 2; DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); // Use min(width, height) (to properly fit the screen int screenSize = Math.min(metrics.widthPixels, metrics.heightPixels); // The meters per pixel required to show the whole area the user might be located in double requiredMpp = distance/screenSize; // Calculate the zoom level double zoomLevel = ((Math.log(equatorLength / (256 * requiredMpp))) / Math.log(2)) + 1; return zoomLevel; }

附上參考鏈接:

http://stackoverflow.com/questions/18383236/determine-a-reasonable-zoom-level-for-google-maps-given-location-accuracy

http://blog.sina.com.cn/s/blog_49cc672f0100elsb.html


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 南和县| 江津市| 武汉市| 图们市| 昌乐县| 平潭县| 台东市| 达拉特旗| 文水县| 南岸区| 五峰| 勃利县| 城市| 彰武县| 池州市| 分宜县| 崇明县| 陕西省| 同德县| 探索| 鄂托克前旗| 东兰县| 九江县| 台江县| 弥渡县| 凤城市| 洪泽县| 柘城县| 长白| 永寿县| 疏附县| 攀枝花市| 华坪县| 新竹县| 青阳县| 四会市| 庆安县| 宜春市| 柘荣县| 如东县| 全椒县|