仅使用OSM地图中心和变焦因子的坐标来计算面积边界
我正在使用 mapscii (由rastapasta)与Python和Nodejs一起进行项目。我需要在MAPSCII输出中通过其位置渲染一些对象。 MAPSCII使用OSM瓷砖层生成ASCII地图。我只知道地图中心的坐标,变焦级别以及ASCII地图的行/列数。
您是否有有关如何计算边界(左上和右下角)的提示,以便我可以将局部坐标系映射到ACSII数据上?
以这些变量为例:
def calculate_boundaries(lat, lng, zoom, width, height) -> tuple:
...
lat = 51.5252178
lng = -0.0925642
zoom = 17
width = 80
height = 24
upper_left, lower_right = calculate_boundaries(lat, lng, zoom, width, height)
我偶然发现了 wiki noreferrer“有帮助,因为我不使用瓷砖数字,而是在纬度/经度上。
// 编辑 这甚至可行吗?还是在每个缩放级别的2D MAPSCII数组中移动时更容易注意到多少LAT/LNG更改?
I'm using MapSCII (by rastapasta) for a project with python and nodejs. I need to render some objects by their location within the MapSCII output. MapSCII uses OSM tile layers to generate the ASCII map. I only know the coordinates of the center of the map, the zoom level as well as the number of rows/columns of the ASCII map.
Do you have any hints on how to calculate the boundaries (upper left and lower right corner), so that I can map a local coordinate system onto the ACSII data?
Take these variables for example:
def calculate_boundaries(lat, lng, zoom, width, height) -> tuple:
...
lat = 51.5252178
lng = -0.0925642
zoom = 17
width = 80
height = 24
upper_left, lower_right = calculate_boundaries(lat, lng, zoom, width, height)
I stumbled across this wiki entry, but it does not seem to be helpful, as I do not work with the tile numbers but with latitude/longitude.
// Edit
Is this even feasible? Or would it be easier to note down, how much lat/lng change when moving in the 2D MapSCII array on each zoom level?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让我们考虑像素的宽度和高度。
计算每个像素的仪表(m/px)
由01(一个)像素表示的距离由:
s = c*cos(y)/2^(z+8)
其中:
c是赤道上地球的圆周;
z是变焦级别;
Y是您想要获得比例的纬度。
来源:
是一个错误,同时转换为Radian。所以我进口了pi和转换。
Let's consider width and height in pixels.
Calculation of Meters per Pixel (m/px)
The distance (S) represented by 01 (one) pixel is given by:
S=C*cos(y)/2^(z+8)
Where:
C is the circumference of the Earth at the Equator;
z is the zoom level;
y is the latitude where you want to get the scale.
Source: https://wiki.openstreetmap.org/wiki/Pt:Zoom_levels
There were a mistake while converting degree to radian. So I imported pi and convertion.