简体   繁体   English

Android-计算每个缩放级别(例如Gmaps比例尺)的地图距离

[英]Android - Compute distance of map every zoom level like Gmaps scale bar

I got zoom level of 3-21. 我的缩放级别为3-21。 zoom out-zoom in respectively. 分别放大缩小。

But i want to compute that zoom level to meter/km distance with the given bar(screenwidth?) of the screen like Gmaps scale bar do. 但是我想像Gmaps比例尺一样,使用屏幕的给定bar(screenwidth?)计算该缩放级别到米/公里的距离。

Example : 范例:

zoom level 20 = hundreds of meter 缩放级别20 =百米
zoom levevl 3 = thousands of km or a mile zoom levevl 3 =数千公里或一英里

TIA TIA

You can find the radius between right/left most point and center of the map when map becomes idle by using 当地图闲置时,可以找到最右/最左点与地图中心之间的半径,方法是使用

/**
 * Method used to fetch Map radius
 */
private int getMapRadius() {
    LatLng latlng = googleMap.getProjection().getVisibleRegion().latLngBounds.getCenter();
    if (latLng == null)
        return 0;
    LatLng latLng1 = googleMap.getProjection().getVisibleRegion().farRight;
    return (int) MapUtils.computeDistance(latLng1.latitude, latLng1.longitude, latLng.latitude, latLng.longitude);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM