distLong = -18
gw = GraphicsWindow.Width
gh = GraphicsWindow.Height
img = ImageList.LoadImage("https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Worldmap_location_NED_50m.svg/1024px-Worldmap_location_NED_50m.svg.png")
' The following line could be harmful and has been automatically commented.
' 'img = ImageList.LoadImage(LDFile.PicturesFolder +"\Planeten-Sonnensystem\Projections\WorldMap_Location_NED_50m_1024x512.png")
GraphicsWindow.DrawResizedImage(img, 0,0, gw,gh)
'Turtle.Show()
'w = LDShapes.Width("_turtle")
'h = LDShapes.Height("_turtle")
'GraphicsWindow.Title = w +" x "+ h
' Random walk
While "True"
If bPause Then
Program.Delay(20)
Else
x = Math.GetRandomNumber(gw)-1
y = Math.GetRandomNumber(gh)-1
cG = LDColours.GetGreen(LDGraphicsWindow.GetPixel(x,y))
If cG > 250 Then ' target is on a continent (~White)
GetLatLong()
Turtle.MoveTo(x,y)
Program.Delay(1000)
EndIf
EndIf
EndWhile
' //////////////////// SUBs ////////////////////
Sub GetLatLong
'long = 180*(2*x/gw - 1) ' 360*x/gw - 180 (-180 W bis 180° E)
'long = 0.01 * Math.Round(100*long)
long = 0.01 * Math.Round(18000*(2*(x-distLong)/gw - 1))
If long < 0 Then
long = Math.Abs(long) +"°W"
Else
long = long +"°O" ' "°E"
EndIf
''lat = 90*(2*y/gh - 1) ' 180*y/gh - 90 (-90 N bis 90 ° S)
'lat = 0.01 * Math.Round(100*lat)
lat = 0.01 * Math.Round(9000*(2*y/gh - 1))
If lat < 0 Then
lat = Math.Abs(lat) +"°N"
Else
lat = lat +"°S"
EndIf
'TextWindow.WriteLine(x +", "+ y +" | "+ long +", "+ lat)
GraphicsWindow.Title = x +", "+ y +" | "+ long +", "+ lat
EndSub
Sub Pause
bPause = LDLogic.Not(bPause)
EndSub
' ////////////////// EVENTs ///////////////////
Sub OnKeyDown
lastKey = GraphicsWindow.LastKey