国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 马公市| 临安市| 左贡县| 塘沽区| 鄂温| 沅江市| 陈巴尔虎旗| 乐安县| 即墨市| 定兴县| 凭祥市| 固阳县| 长乐市| 涟源市| 庐江县| 潞城市| 锡林郭勒盟| 安龙县| 改则县| 宁远县| 新邵县| 泗阳县| 桦甸市| 罗平县| 抚州市| 都江堰市| 崇阳县| 杭锦旗| 泰宁县| 龙海市| 友谊县| 万盛区| 班戈县| 彰化市| 二连浩特市| 安丘市| 营口市| 如东县| 苍梧县| 峨山| 海口市|