I have a georeferenced image that's 开发者_开发问答really an image of a map. I know the latitude and longitude of several points on the image and I'm trying to figure out how to display my location on the image. Similar to how Google Maps works, but instead of using Google Maps I'd like to use the map I have a JPG of.
Any ideas on where to start?
If your image is for a small region on earth, with almost accuracy, you can calculate proportional placement of point on image (without considering curvature of earth). Here is how.
Assume you have top-left and bottom-right points in lat-long form.
{ point_lat - minimum(lat_top, lat_bottom) } * {width of image}
point_x = ---------------------------------------------------------------
{lat_bottom - lat_top}
Here is a pictorial representation:
(lat_top, long_left)
+-----+
| |
| |
| |
+-----+
(lat_bottom, long_right)
Similarly calculate point_y using longitude
However, if your image covers very big region (like USA/RU/India), to have better accuracy, you need to consider curvature of earth.
Do you want to write such application or you just want to use your map. Because such application already exist. It is called OruxMaps and could be found on market. You need to prepare your map in Ozi Explorer application and load it in OruxMaps. But if you want to write such application you should anyway check Ozi Explorer because maps format generated by this application is a standard in this kind of software.
精彩评论