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

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

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

2019-11-09 14:44:31
字體:
供稿:網(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ā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 龙井市| 石景山区| 治县。| 武隆县| 犍为县| 临夏县| 余江县| 新丰县| 乐至县| 南江县| 霸州市| 景泰县| 浦县| 祁东县| 胶州市| 双桥区| 福鼎市| 鹤山市| 温泉县| 新疆| 房山区| 灯塔市| 耒阳市| 清新县| 上高县| 贡嘎县| 伽师县| 鄂尔多斯市| 富平县| 安义县| 社会| 平阳县| 彩票| 金昌市| 唐河县| 滁州市| 嘉鱼县| 太和县| 尉犁县| 遂昌县| 子洲县|