Jer*_*gan 12 gps android android-mapview
我有一个MapView,我正在显示一个"有用的半径"(想想坐标的准确性).使用MapView's Projection的meterToEquatorPixels,这当然只是赤道距离)并没有给我足够准确的距离(以像素为单位) ).如果你想在给定半径的坐标周围显示一个圆圈,你会如何计算?
Jer*_*gan 28
因此,Google地图使用墨卡托投影.这意味着从赤道越远,距离变得越扭曲.根据这个讨论,转换距离的正确方法是这样的:
public static int metersToRadius(float meters, MapView map, double latitude) {
return (int) (map.getProjection().metersToEquatorPixels(meters) * (1/ Math.cos(Math.toRadians(latitude))));
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11339 次 |
| 最近记录: |