如何计算点周围半径在Android图形页面?半径、图形、页面、Android

由网友(媳妇么么哒)分享简介:我有一个MapView我正在显示一个有用半径(想想坐标精度)的,利用图形页面的Projection's metersToEquatorPixels,这是无可否认的只是赤道的距离)不给我一个准确的足够的距离(以像素为单位)。你会如何​​计算这个,如果你想显示你的坐标,​​给定的半径绕一大圈?I have a MapVi...

我有一个MapView我正在显示一个有用半径(想想坐标精度)的,利用图形页面的Projection's metersToEquatorPixels,这是无可否认的只是赤道的距离)不给我一个准确的足够的距离(以像素为单位)。你会如何​​计算这个,如果你想显示你的坐标,​​给定的半径绕一大圈?

I have a MapView that I'm displaying a "useful radius" (think accuracy of coordinate) in. Using MapView's Projection's metersToEquatorPixels, which is admittedly just for equatorial distance) isn't giving me an accurate enough distance (in pixels). How would you compute this if you wanted to display a circle around your coordinate, given radius?

推荐答案

所以,谷歌地图使用墨卡托投影。这意味着,进一步从赤道越失真的距离变得得到。根据这个讨论,适当的方式转换的距离是一样的东西:

So, Google Maps uses a Mercator projection. This means that the further you get from the equator the more distorted the distances become. According to this discussion, the proper way to convert for distances is something like:

public static int metersToRadius(float meters, MapView map, double latitude) {
    return (int) (map.getProjection().metersToEquatorPixels(meters) * (1/ Math.cos(Math.toRadians(latitude))));         
}
阅读全文

相关推荐

最新文章