lat/lon conversion to x/y-coordinates

纵饮孤独 提交于 2019-12-06 15:05:01

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.

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.

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.

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.

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.

There's sample code on the wiki to convert OpenStreetMap tile system to lat/long and back:

http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

Good luck!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!