I have a openstreetmap image. left upper corner is lat: 80 lon: -169 and right lower corner is lat:-56 lon: 190 The image has the width: 2618 and the height: 1513
我有一个openstreetmap图像。左上角是lat: 80 lon: -169,右下角是lat:-56 lon: 190这幅图像的宽度是2618,高度是1513。
How do I convert given lat/lon-coordinates to the pictures x/y-coordinates?
如何将给定的lat/lon坐标转换为图像x/y坐标?
I tried it by myself, but couldn't figure out how to convert the coordinates.
我自己试过,但不知道如何转换坐标。
I hope someone can answer my question.
我希望有人能回答我的问题。
3 个解决方案
#1
4
The question, as asked, is almost nonsensical. The area requested covers almost the entire globe, from 80N 169W to 56S 190E. That leaves out the band pole to pole from 170W to 169W, a disk around the north pole north of 80N, and a larger disk around the south pole south of 56S. There is no single best projection from that large an area of the globe to a screen. See wiki on geographic coordinates and map projections as starting places for general background.
正如被问到的那样,这个问题几乎是荒谬的。该地区几乎覆盖了整个地球,从80N 169W到56S 190E。从170W到169W,在80N北极附近的一个圆盘,在56S以南的南极附近有一个更大的圆盘。从地球的大范围到屏幕,没有一个最佳的投影。在地理坐标和地图投影上看到wiki,作为一般背景的起点。
That said, this is a reasonable question if the inputs are reasonable.
这就是说,如果输入是合理的,这是一个合理的问题。
For very small areas near the equator, a simple projection is to map latitude to Y and longitude to X. As you move away from the equator, this will introduce a small distortion due to the decrease in the length of the degree of longitude as the latitude approaches either pole. For a large enough area that is not symmetric about the equator, this will make the length of the top edge in miles noticeably different from the bottom edge.
对于很小的赤道附近地区,一个简单的投影是将经度和纬度Y映射到x你远离赤道,这将引入一个小失真由于减少长度的经度与纬度的程度的方法。对于一个不对称于赤道的足够大的区域,这将使顶部边缘的长度明显不同于底部边缘。
A much better projection would map latitude to Y, but scale longitude by cos(latitude)
to get X. For small enough areas, the scale is nearly constant over the whole figure and can be calculated once and held constant.
一个更好的投影是将纬度映射到Y,但是通过cos(纬度)来得到x的经度。对于足够小的区域,整个图形的尺度几乎是恒定的,可以计算一次并保持不变。
The general subject of map projection has many more solutions than the simplest identified here. They vary due to the varying goals of each projection. The choice of projection depends on the intended use, and there is generally no single "best" projection even for specific uses.
地图投影的一般主题比这里最简单的方法有更多的解决方案。它们因每个投射的不同目标而变化。投影的选择取决于预期的用途,即使是特定用途,通常也没有单一的“最佳”投影。
#2
2
For more general conversion into and out of projections, there are perl and python wrappers for PROJ.4. These would let you solve any such problem.
为了更全面地转换到和超出投影,有perl和python包装器供项目使用。这样可以解决任何这样的问题。
#3
2
There's sample code on the wiki to convert OpenStreetMap tile system to lat/long and back:
wiki上有一些示例代码,可以将OpenStreetMap tile系统转换为lat/long和back:
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
Good luck!
好运!
#1
4
The question, as asked, is almost nonsensical. The area requested covers almost the entire globe, from 80N 169W to 56S 190E. That leaves out the band pole to pole from 170W to 169W, a disk around the north pole north of 80N, and a larger disk around the south pole south of 56S. There is no single best projection from that large an area of the globe to a screen. See wiki on geographic coordinates and map projections as starting places for general background.
正如被问到的那样,这个问题几乎是荒谬的。该地区几乎覆盖了整个地球,从80N 169W到56S 190E。从170W到169W,在80N北极附近的一个圆盘,在56S以南的南极附近有一个更大的圆盘。从地球的大范围到屏幕,没有一个最佳的投影。在地理坐标和地图投影上看到wiki,作为一般背景的起点。
That said, this is a reasonable question if the inputs are reasonable.
这就是说,如果输入是合理的,这是一个合理的问题。
For very small areas near the equator, a simple projection is to map latitude to Y and longitude to X. As you move away from the equator, this will introduce a small distortion due to the decrease in the length of the degree of longitude as the latitude approaches either pole. For a large enough area that is not symmetric about the equator, this will make the length of the top edge in miles noticeably different from the bottom edge.
对于很小的赤道附近地区,一个简单的投影是将经度和纬度Y映射到x你远离赤道,这将引入一个小失真由于减少长度的经度与纬度的程度的方法。对于一个不对称于赤道的足够大的区域,这将使顶部边缘的长度明显不同于底部边缘。
A much better projection would map latitude to Y, but scale longitude by cos(latitude)
to get X. For small enough areas, the scale is nearly constant over the whole figure and can be calculated once and held constant.
一个更好的投影是将纬度映射到Y,但是通过cos(纬度)来得到x的经度。对于足够小的区域,整个图形的尺度几乎是恒定的,可以计算一次并保持不变。
The general subject of map projection has many more solutions than the simplest identified here. They vary due to the varying goals of each projection. The choice of projection depends on the intended use, and there is generally no single "best" projection even for specific uses.
地图投影的一般主题比这里最简单的方法有更多的解决方案。它们因每个投射的不同目标而变化。投影的选择取决于预期的用途,即使是特定用途,通常也没有单一的“最佳”投影。
#2
2
For more general conversion into and out of projections, there are perl and python wrappers for PROJ.4. These would let you solve any such problem.
为了更全面地转换到和超出投影,有perl和python包装器供项目使用。这样可以解决任何这样的问题。
#3
2
There's sample code on the wiki to convert OpenStreetMap tile system to lat/long and back:
wiki上有一些示例代码,可以将OpenStreetMap tile系统转换为lat/long和back:
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
Good luck!
好运!