国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 育儿| 阿拉善左旗| 百色市| 西丰县| 沧源| 刚察县| 东乡县| 称多县| 依安县| 梅河口市| 大同县| 泾源县| 连城县| 聊城市| 沈阳市| 闽清县| 澄城县| 舞阳县| 融水| 邵东县| 榆树市| 固始县| 宜城市| 高陵县| 基隆市| 集贤县| 康保县| 宝应县| 临朐县| 罗源县| 义马市| 枞阳县| 杭锦后旗| 武平县| 金平| 林西县| 左云县| 花垣县| 江永县| 紫金县| 株洲县|