# Longitude and latitude

## Recommended Posts

is there a way to map coordinates like Longitude and latitude to the GUI screen and use a function like mouse over to get the Lat/Long

Thanks

Jay

Edited by jay

##### Share on other sites

How much zoom do you want? If it is zoomed in enough, the lines will be nearly straight, but if it is zoomed out, they will be curved based on the radius of the object (probably the earth) and the amount of zoom. Care to provide some more detail?

##### Share on other sites

How much zoom do you want? If it is zoomed in enough, the lines will be nearly straight, but if it is zoomed out, they will be curved based on the radius of the object (probably the earth) and the amount of zoom. Care to provide some more detail?

I guess instead of that I would like to do more of a bulleye like in the picture with the center of the bullseye being 000 00

So the scale would be in miles 000 180 would be straight up 180 miles out

##### Share on other sites

If you can do the math, AutoIt can do the rest.

Try some stuff, and let me know if you get anywhere. I'll be trying too.

##### Share on other sites

If you can do the math, AutoIt can do the rest.

Try some stuff, and let me know if you get anywhere. I'll be trying too.

My Math suck but i bet i can figure it out just thought if someone had any idea that might speed up the process.. Also i would like to be able to enter a bulls eye number like 253 77 and have it show it on the bulls eye picture

##### Share on other sites

I like math, and so I felt the need to do this myself. I went out and got a picture of a unit circle off the web thinking that I was going to use some trig stuff, but I never did. Instead, I simply used the Pythagorean Theorem (a squared + b squared = c squared). Here's the result:

#include <misc.au3>

HotKeySet ("{ESC}", "quitme")

Opt ("MouseCoordMode", 2)

\$Board = GUICreate ("Board", 712, 700)

GUICtrlCreatePic (@ScriptDir & "\UnitCircle.gif", 0, 0, 712, 658)

\$MouseCoords = GUICtrlCreateLabel ("Mouse Coords: ", 10, 670, 200, 20)

GUISetState (@SW_SHOW)

While 1
GUICtrlSetData (\$MouseCoords, "Mouse Coords: " & MouseGetPos (0) & " , " & MouseGetPos (1))
If _IsPressed ("01") Then
ClickedOnPic()
EndIf
Sleep (50)
WEnd

Func quitme()
Exit
EndFunc

Func ClickedOnPic()
\$MouseX = MouseGetPos (0)
\$MouseY = MouseGetPos (1)
\$Radius = Sqrt (((\$MouseX - 368) ^ 2) + ((\$MouseY - 321) ^ 2)) / (302/180)
\$DistanceFromCenterHoriz = (\$MouseX - 368) / (302/180)
\$DistanceFromCenterVert = (\$MouseY - 321) / (302/180)
If \$DistanceFromCenterHoriz < 0 Then
\$HorizString = " miles left of center"
\$DistanceFromCenterHoriz = -\$DistanceFromCenterHoriz
Else
\$HorizString = " miles right of center"
EndIf
If \$DistanceFromCenterVert > 0 Then
\$VertString = " miles below center"
Else
\$VertString = " miles above center"
\$DistanceFromCenterVert = -\$DistanceFromCenterVert
EndIf
MsgBox (0, "Mouse Clicked On Pic", \$MouseX & @CRLF & \$MouseY & @CRLF & \$Radius & @CRLF & _
\$DistanceFromCenterHoriz & \$HorizString & @CRLF & \$DistanceFromCenterVert & \$VertString)
EndFunc

;320-322 (horiz line y coord)
;367-369 (vert line x coord)
;center point: (368, 321)
; farthest right point (670, 321)
; farthest left point (66, 321)
; topmost point (368, 19)
; bottommost point (368, 623)
;horizontally: 180 mi = 302 pixels
;vertically: 180 mi = 302 pixels

And, here's the pic I used (so you can use the same one and not get all messed up).

edit: On a totally unrelated note, this is my 200th post. I am now a "spammer!"

Edited by greenmachine

##### Share on other sites

If you can do the math, AutoIt can do the rest.

Try some stuff, and let me know if you get anywhere. I'll be trying too.

Yah i saw that post but i need the coord to be different and start from the center

##### Share on other sites

Jay - try mine. I modified it so it uses miles (but doesn't have the little circular markers) and starts at the center point.

##### Share on other sites

Jay - try mine. I modified it so it uses miles (but doesn't have the little circular markers) and starts at the center point.

When i try it the center point is 368 321 when it should be 000 00

o and thank you for all your help

Edited by jay

##### Share on other sites

So it the pic below the spot marked on it would be 150 90 so that would be the mouse coords too?

##### Share on other sites

Fine, if you're not going to at least look to see what the script is doing, I'll explain the damn thing to you.

Click on the pic. It shows a message box saying mousex, mousey, radius, distance in miles from center horizontally and vertically. If you can't figure out which values are the ones you're looking for, and subject the correct number of pixels to make everything work out how you want, sucks.

You have all the resources you need right there in your script. All you have to do now is put out a little effort, and you're done. No real thinking required.

Edited by greenmachine

##### Share on other sites

Fine, if you're not going to at least look to see what the script is doing, I'll explain the damn thing to you.

Click on the pic. It shows a message box saying mousex, mousey, radius, distance in miles from center horizontally and vertically. If you can't figure out which values are the ones you're looking for, and subject the correct number of pixels to make everything work out how you want, sucks.

You have all the resources you need right there in your script. All you have to do now is put out a little effort, and you're done. No real thinking required.

what is setting the center in the gui is it the center of the gui or the picture?

##### Share on other sites

Fine, if you're not going to at least look to see what the script is doing, I'll explain the damn thing to you.

Click on the pic. It shows a message box saying mousex, mousey, radius, distance in miles from center horizontally and vertically. If you can't figure out which values are the ones you're looking for, and subject the correct number of pixels to make everything work out how you want, sucks.

You have all the resources you need right there in your script. All you have to do now is put out a little effort, and you're done. No real thinking required.

the more i look at it the more i understand it. I think

##### Share on other sites

Clicking helps.

The message box has a good amount of info (the last two lines are most important).

##### Share on other sites

Come to think of it, I didn't really address the problem as you were thinking of it. Sorry to snap at you. What mine does is get the square coordinates of the point clicked according to the center of the picture. It doesn't get the angle like you want with your pic, because that's not how coords work. CyberSlug's post uses polar coordinates, which takes a radius and angle (theta). It's a little different.

##### Share on other sites

my problem now is how do i tell it to convert it to the postion with out haveing to program all the coordinates in

Example:

if \$horizString = 180.000000 and \$Vertstring = 0.0000 Then

\$Bullseye = 000 180

Else

Endif

this would be to the right of the center of the bullseye 180 miles out or 90 dregrees of the Bullseye for 180 nm

Edited by jay

##### Share on other sites

Not sure what you're asking after a quick glance (will go back and read some more to figure it out better), but I do know this: in math, position 0 is on the right hand side of the x-axis (as shown in my picture), and the positive positions revolve counter-clockwise around the center. This is not the same as your picture, I understand that, and so I have this question: do you have to keep your coordinates the way they are, or can they be changed to fit a standard unit circle in math (my pic)? If you MUST leave your coordinates the way they are, I will have to make some changes to take that into consideration.

##### Share on other sites

Not sure what you're asking after a quick glance (will go back and read some more to figure it out better), but I do know this: in math, position 0 is on the right hand side of the x-axis (as shown in my picture), and the positive positions revolve counter-clockwise around the center. This is not the same as your picture, I understand that, and so I have this question: do you have to keep your coordinates the way they are, or can they be changed to fit a standard unit circle in math (my pic)? If you MUST leave your coordinates the way they are, I will have to make some changes to take that into consideration.

the bullseye is the way military pilots call out bandits over the radio so if you were to over lay that on a map you could call out a position such as Bulls Eye 000 for 180 and that would be on the 90 degree line and 180 miles out from the center so its like a navigational aid

##### Share on other sites

Ok, I have an idea of what's going on, but I'm pretty much done with writing it for you. Here's what's left: since you're using angles, you're going to need sin, cos, and probably arcsin and arccos (Asin and Acos in autoit) to get all the angles and positions worked out correctly. Since it's so far out of the ordinary for me, and I have work to do for school, I'm going to leave it up to you to test things and figure it out yourself.

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...