我已经成功地从 osmdroid (Mapnik) 的 SD 卡加载 map block
但现在我想在我的 Android 应用程序中提供一个选项来下载用户想要使用的 map 图 block mean map show online 用户选择特定区域并兑现供他使用我不知道该怎么做请帮忙谢谢
我不确定问题指向哪里。据我了解,您让用户选择一个区域 - 用地理坐标表示 - 然后使用这些坐标来计算要检索的图 block 。
下Slippy map tilenames在 OSM wiki 中有一个很好的解释如何做到这一点:
Reproject the coordinates to the Mercator projection (from EPSG:4326 to EPSG:3857):
x = lon
y = arsinh(tan(lat)) = log[tan(lat) + sec(lat)]
(lat and lon are in radians)
Transform range of x
and y
to 0
– 1
and shift origin to top left corner:
x = [1 + (x / π)] / 2
y = [1 − (y / π)] / 2
- Calculate the number of tiles across the map,
n
, using 2^zoom
- Multiply
x
and y
by n
. Round results down to give tilex
and tiley
.
我是一名优秀的程序员,十分优秀!