zariostr
October 9th, 2004, 08:21 AM
hello
My question is about some geography
i've seen program with map of some region
mouse position shown geographycal coordinates: latitude and longtitute
how it makes ????
how attach coordinates to image map ???
thanks
Luchin_plusplus
October 12th, 2004, 07:07 PM
Hi.
In a more general sense, you don't associate coordinates to the map: you do it with the size of it. Thus with a simple linear equation you can get a very good approximation of what coordinates a certain point in the map will be.
(I'm assumming, of cours,e that the map is homogeneous -- all points will share the same "size")
For example, if you have a map represented by a 100 * 100 "points" rectangle, and you associate this size to the "coordinates" (10, 50) for the top-left and (60, 110) for the bottom-right, then you know that there is one point of left-right coordinate for each 2 coordinates in your map ( 60 - 10 = 50 [coordinates] , then 100 / 50 makes = 2 [points/coordinates], thus you can make the calculation and _know_ where the "center" of the map wil be.
That's fairly abstract, you should check for some reallife sample.
You just load the picture of the map, take the size of the picture container, perform the calculations and voilą, the one thing left is to turn, on each mouse movement, the position over the map to a pair of numbers related to the coordinates defined.