/** * 将实际地理距离转换为屏幕像素值 * * @param distance * 实际距离,单位为米 * @param currScale * 当前地图尺寸 * @param context * @return */ public static double metreToScreenPixel(double distance, double currScale, Context context) { float dpi = context.getResources().getDisplayMetrics().densityDpi; // 当前地图范围内1像素代表多少地图单位的实际距离 double resolution = (25.39999918 / dpi) * currScale / 1000; return distance / resolution; } /** * 将屏幕上对应的像素距离转换为当前显示地图上的地理距离(米) * * @param pxlength * @param currScale * @param context * @return */ public static double screenPixelToMetre(double pxlength, double currScale, Context context) { float dpi = context.getResources().getDisplayMetrics().densityDpi; double resolution = (25.39999918 / dpi) * currScale / 1000; return pxlength * resolution; }
来自:http://blog.csdn.net/u012481275/article/details/12861179