GPS coordinates to pixel

为君一笑 提交于 2019-12-24 12:36:14

问题


I need to create image (polygon) from GPS coordinates. I have coordinates like this:

(49.274633220,17.160206083),(49.276968797,17.162732143),(49.278188519,17.162391767),(49.279761626,17.161087954), ......

And I need to transform them to XY pixel points. Each pair of coordinates are vertex of created polygon.

File with all coordinates:

GPS.txt

and how the created polygon should look like:

Any idea how can I transform the coordinates? Thanks for all reply.


回答1:


In all cases you need a transformation form lat,lon (spherical) to cartesian (x,y) coordinated. If the polygon is not bigger than 100km you can use a simple Cyclindrical Equidistant Projection. Otherwise, you may use a Mercator Projection. (Google Maps uses that too)




回答2:


Are you sure the assignment says to create a graphic? Or is it just to read the text file and extract the pairs of coordinates? Because you can't create a graphic without defining a transformation. I would start by finding the max and min latitude and longitude values (making sure which is which!). Then just use a linear scale for the longitude so that your minimum longitude goes to px=0 and the maximum longitude goes to however wide you want your image to be. Then do the same for latitude - it'll look distorted but at least you'll see something to start with.

By the way, the graphic you pasted doesn't seem to correspond to the coordinates you gave. If it helps, yours look more like this red area.



来源:https://stackoverflow.com/questions/15882368/gps-coordinates-to-pixel

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