this is the cut down version of something i posted to the group last week.
firstly set the bounds of your image.
Xmin = 138.4392 ' the Easternmost point of my area
Xmax = 138.7904 ' the Westernmost point of my area
Ymin = -34.7092 ' the Northernmost point of my area
Ymax = -35.1038 ' the Southernmost point of my area
then define the length and breadth of your image.
Xpants = (Xmax - Xmin) / MapImage.Width
Ypants = (Ymax - Ymin) / MapImage.Height
and then wherever your mouse (or whatever) is on the MapImage equals the
following X and Y calculations.
X = (Xpants * MapImage.X) + Xmin
Y = (Ypants * MapImage.Y) + Ymin
so if you have say a form which continually gives the current location of
the mouse in WGS84 based on where it is on the image, have two text boxes
bound to the X and Y variables as above, and have a mousemove event which
recalculates the variables. the other calculations need only be done on
initialization.
if you wish to measure distances, you will need to know how many metres (or
whatever you use) are in a degree in your area. i use a flat-earth model
because my distances are generally less than 10km, so this may or may not be
useful to you. easiest way to find how many units in a degree of the earth
is to make a line in MapInfo exactly 1 degree long in X, then double-click
it to find out the length of that line. copy that data to the following
variable and do the same for Y.
XDegree2Metres = 91163.7427419522 ' number of metres in a degree of
longitude in my area
YDegree2Metres = 111198.387139005 ' number of metres in a degree of
latitude in my area
then distance is merely a basic calculation based on one X and Y to another
X and Y, whether it be clicked or static points, as such:
Distance = Sqr((((FirstX - SecondX) * XDegree2Metres) ^ 2) +
(((FirstY - SecondY) * YDegree2Metres) ^ 2))
hope this helps
ash.
-----Original Message-----
From: Adam C. Hegedus [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 18 May 2002 1:00 AM
To: [EMAIL PROTECTED]
Subject: MI-L Convert WGS84 to X,Y
I need to convert a wgs84 lat/lon point to an x,y coordinate. I am
converting a mapinfo map to a rastor image, and I need to be able to locate
a gps point on the image. I'm thinking that there must be some sort of
mathematical formula to do this. I know that this isn't really a mapinfo
question, but I couldn't think of a better place to ask.
Thanks,
Adam
---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]