archrival Posted April 21, 2005 Posted April 21, 2005 (edited) This is my first script in a couple of months, forgive the sloppiness of it. It's just a nice little google map tool that will allow you to enter in GPS coordinates or a street address and create a quick and dirty web page with the specified zoom and grid size. The grid needs to be an odd number, this will make it one if it's not already. So if you enter 3, this will be 3x3 (384 px x 384 px). My next plan is to create one large picture (jpeg, png) from the resulting web page. I just started this a couple of hours ago, I'm sure there are spelling mistakes, HTML errors, etc. It works for me right now, let me know if you like it or find it useful. expandcollapse popup; ArchRival's Google Mapping Tool ; archrival at gmail dot com $version = "2.2.5.4" #include <GUIConstants.au3> $gui = GUICreate("Google Map Tool", 300, 200) AutoItWinSetTitle("Google Map Tool") GUICtrlCreateLabel("Address (USA):", 5, 5) GUICtrlCreateLabel("Latitude (N):", 5, 45) GUICtrlCreateLabel("Longitude (W):", 5, 85) GUICtrlCreateLabel("Zoom:", 5, 130) GUICtrlCreateLabel("Grid Size:", 5, 152) GUICtrlCreateLabel("Location:", 130, 130) GUICtrlCreateLabel("Output:", 130, 152) $titlelabel = GUICtrlCreateLabel("Google Map Tool Ver. " & $version, 5, 173) $copylabel = GUICtrlCreateLabel(Chr(169) & @YEAR & ", ArchRival Networks", 5, 183) GUICtrlSetFont($titlelabel, 6) GUICtrlSetFont($copylabel, 6) $gpsadddrop = GUICtrlCreateCombo("Street Address", 185, 127, 110, "", $CBS_DROPDOWNLIST) GUICtrlSetData($gpsadddrop, "GPS Coordinates", "Street Address") $webpicdrop = GUICtrlCreateCombo("Create HTML", 185, 147, 110, "", $CBS_DROPDOWNLIST) GUICtrlSetData($webpicdrop, "Create JPG|Create PNG|Create TIFF|Create BMP|Create GIF|Create PDF", "Create PNG") $okbut = GUICtrlCreateButton("OK", 139, 170, 50) $cancelbut = GUICtrlCreateButton("Cancel", 245, 170, 50) $clearbut = GUICtrlCreateButton("Clear", 192, 170, 50) $addrgui = GUICtrlCreateInput("", 5, 20, 290) $latgui = GUICtrlCreateInput("", 5, 60, 290) $longgui = GUICtrlCreateInput("", 5, 100, 290) $zoomgui = GUICtrlCreateCombo("0", 55, 127, 40, "", $CBS_DROPDOWNLIST) GUICtrlSetData($zoomgui, "1|2|3|4|5|6|7|8|9|10|11|12|13|14", "2") $gridgui = GUICtrlCreateCombo("1", 55, 147, 40, "", $CBS_DROPDOWNLIST + $WS_VSCROLL) GUICtrlSetData($gridgui, "3|5|7|9|11|13|15|17|19|21|23|25|27|29|31|33|35|37|39|41|43|45|47|49|51|53|55|57|59|61|63|65|67|6 9|71|73|75|77|79|81|83|85|87|89|91|93|95|97|99", "3") GUICtrlSetState($addrgui, $GUI_DISABLE) GUICtrlSetState($latgui, $GUI_DISABLE) GUICtrlSetState($longgui, $GUI_DISABLE) GUISetState(@SW_SHOW) Dim $addrsel Dim $deletefold Dim $writepic While 1 $msg = GUIGetMsg() Select Case $msg = $gpsadddrop If GUICtrlRead($gpsadddrop) = "GPS Coordinates" Then GUICtrlSetState($addrgui, $GUI_DISABLE) GUICtrlSetState($latgui, $GUI_ENABLE) GUICtrlSetState($longgui, $GUI_ENABLE) Global $addrsel = 0 Global $coordsel = 1 ElseIf GUICtrlRead($gpsadddrop) = "Street Address" Then GUICtrlSetState($latgui, $GUI_DISABLE) GUICtrlSetState($longgui, $GUI_DISABLE) GUICtrlSetState($addrgui, $GUI_ENABLE) Global $addrsel = 1 Global $coordsel = 0 EndIf Case $msg = $okbut Global $create = GUICtrlRead($webpicdrop) If $addrsel = 1 Then Global $readaddr = GUICtrlRead($addrgui) If $readaddr = "" Then ContinueLoop EndIf Global $address = StringReplace($readaddr, " ", "+") $googsrch = "http://maps.google.com/maps?q=" & $address & "&hl=en" InetGet($googsrch, @TempDir & "\googtemp.txt") $parse = FileRead(@TempDir & "\googtemp.txt", FileGetSize(@TempDir & "\googtemp.txt")) Global $lat = StringTrimLeft(StringMid($parse, StringInStr($parse, "point lat=") + 10, 10), 1) $checklatper = StringInStr($lat, ",") If $checklatper = 3 Then Global $lat = StringTrimRight($lat, 1) $longloc = 26 Else $longloc = 27 EndIf Global $long = StringTrimLeft(StringMid($parse, StringInStr($parse, "point lat=") + $longloc, 11), 1) $checklongper = StringInStr($long, ".") If $checklongper = 3 Then Global $long = StringTrimRight($long, 1) EndIf Global $zoom = GUICtrlRead($zoomgui) Global $gridsize = GUICtrlRead($gridgui) ElseIf $coordsel = 1 Then Global $zoom = GUICtrlRead($zoomgui) Global $gridsize = GUICtrlRead($gridgui) Global $long = Number(GUICtrlRead($longgui)) If $long = "" Then ContinueLoop EndIf If $long > 360 or $long < 0 Then ContinueLoop EndIf Global $lat = Number(GUICtrlRead($latgui)) If $lat = "" Then ContinueLoop EndIf If $lat > 360 or $lat < 0 Then ContinueLoop EndIf Else ContinueLoop EndIf GUIDelete($gui) ExitLoop Case $msg = $cancelbut OnExit() Exit Case $msg = $clearbut GUICtrlSetData($addrgui, "") GUICtrlSetData($latgui, "") GUICtrlSetData($longgui, "") Case $msg = $GUI_EVENT_CLOSE OnExit() Exit EndSelect WEnd Global $img[$gridsize + 1][$gridsize + 1] Global $x = Round(2^ (17 - $zoom) * (-$long + 98.35) * 0.77162458338772 / 128, 0) Global $y = Round(2^ (17 - $zoom) * (39.5 - $lat) / 128, 0) If InetGetSize("http://mt.google.com/mt?v=.1&x=" & $x & "&y=" & $y & "&zoom=" & $zoom) = 1283 and InetGetSize("http://mt.google.com/mt?v=.1&x=" & $x + 1 & "&y=" & $y & "&zoom=" & $zoom) = 1283 Then MsgBox(0, "Invalid Address", "Please Enter a valid address/coordinates") Exit EndIf Global $i = 1 If $addrsel = 1 Then Global $fold = $readaddr & " (" & $gridsize & "x" & $zoom & ")" Else Global $fold = $lat & "N, " & $long & "W" & " (" & $gridsize & "x" & $zoom & ")" EndIf If $create = "Create HTML" Then $deletefold = 0 WriteHTML() Else $deletefold = 1 $writepic = 1 WritePic() EndIf Func WriteHTML() If Not FileExists($fold) Then DirCreate($fold) Else If FileExists($fold & "\googmap.htm") Then FileDelete($fold & "\googmap.htm") EndIf EndIf FileWrite($fold & "\googmap.htm", "<html>" & @CRLF) If $addrsel = 1 Then FileWrite($fold & "\googmap.htm", "<title>" & $readaddr & " @ " & $lat & "N, " & $long & "W " & ":: Grid Size: " & $gridsize & "x" & $gridsize & " :: Zoom: " & $zoom & "</title>" & @CRLF) Else FileWrite($fold & "\googmap.htm", "<title>" & $lat & "N, " & $long & "W :: Grid Size: " & $gridsize & "x" & $gridsize & " :: Zoom: " & $zoom & "</title>" & @CRLF) EndIf FileWrite($fold & "\googmap.htm", @Tab & "<table border=" & Chr(34) & "0" & Chr(34) & " cellpadding=" & Chr(34) & "0" & Chr(34) & " cellspacing=" & Chr(34) & "0" & Chr(34) & ">" & @CRLF) For $row = 1 To $gridsize FileWrite($fold & "\googmap.htm", @Tab & @Tab & "<tr>" & @CRLF) If $row = Int($gridsize / 2) + 1 Then $currow = 0 Else $currow = ((Int($gridsize / 2) + 1) - $row) EndIf For $column = 1 To $gridsize If $column = Int($gridsize / 2) + 1 Then $curcol = 0 Else $curcol = ((Int($gridsize / 2) + 1) - $column) EndIf FileWrite($fold & "\googmap.htm", @Tab & @Tab & @Tab & "<td width=" & Chr(34) & "128" & Chr(34) & "height=" & Chr(34) & "128" & Chr(34) & ">" & @CRLF) FileWrite($fold & "\googmap.htm", @Tab & @Tab & @Tab & @Tab & "<img src=" & Chr(34) & "http://mt.google.com/mt?v=.1&x=" & $x - $curcol & "&y=" & $y - $currow & "&zoom=" & $zoom & Chr(34) & " width=" & Chr(34) & "128" & Chr(34) & "height=" & Chr(34) & "128" & Chr(34) & "></td>" & @CRLF) If $addrsel = 1 Then TrayTip("Google Map Tool", "Now mapping " & $readaddr & ", " & Round(($i/($gridsize * $gridsize)) * 100) & "%", 5) Else TrayTip("Google Map Tool", "Now mapping " & $lat & "N, " & $long & "W" & ", " & Round(($i/($gridsize * $gridsize)) * 100) & "%", 5) EndIf $i = $i + 1 Next FileWrite($fold & "\googmap.htm", @Tab & @Tab & "</tr>" & @CRLF) Next FileWrite($fold & "\googmap.htm", "</html>" & @CRLF) ;$o_URL = ObjCreate("Shell.Application") ;$o_URL.Open(@WorkingDir & "\" & $fold & "\googmap.htm") OnExit() EndFunc Func WritePic() If $create = "Create JPG" Then $picout = ".jpg" ElseIf $create = "Create PNG" Then $picout = ".png" ElseIf $create = "Create TIFF" Then $picout = ".tif" ElseIf $create = "Create BMP" Then $picout = ".bmp" ElseIf $create = "Create GIF" Then $picout = ".gif" ElseIf $create = "Create PDF" Then $picout = ".pdf" EndIf Dim $picnames Dim $picnamesrow[$gridsize + 1] Dim $rows $rowwidth = $gridsize * 128 If Not FileExists($fold) Then DirCreate($fold) EndIf FileInstall("montage.exe", @TempDir & "\montage.exe", 1) For $row = 1 To $gridsize If $row = Int($gridsize / 2) + 1 Then $currow = 0 Else $currow = ((Int($gridsize / 2) + 1) - $row) EndIf $picnamesrow[$row] = "" For $column = 1 To $gridsize If $column = Int($gridsize / 2) + 1 Then $curcol = 0 Else $curcol = ((Int($gridsize / 2) + 1) - $column) EndIf $img[$row][$column] = "http://mt.google.com/mt?v=.1&x=" & $x - $curcol & "&y=" & $y - $currow & "&zoom=" & $zoom InetGet($img[$row][$column], $fold & "\" & $i & ".gif") If $addrsel = 1 Then TrayTip("Google Map Tool", "Now mapping " & $fold & ", " & Round(($i/($gridsize * $gridsize)) * 100) & "%", 50000, 16) Else TrayTip("Google Map Tool", "Now mapping " & $lat & "N, " & $long & "W" & ", " & Round(($i/($gridsize * $gridsize)) * 100) & "%", 50000, 16) EndIf If $gridsize < 15 Then $picnames = $picnames & Chr(34) & $fold & "\" & $i & ".gif" & Chr(34) & " " Else $picnamesrow[$row] = $picnamesrow[$row] & Chr(34) & $fold & "\" & $i & ".gif" & Chr(34) & " " EndIf $i = $i + 1 Next Next TrayTip("Google Map Tool", "Now creating " & $fold & $picout, 50, 16) If $gridsize < 15 Then RunWait(@TempDir & "\montage.exe +frame +shadow +label -tile " & $gridsize & "x" & $gridsize & " -geometry 128x128+0+0 " & $picnames & Chr(34) & $fold & $picout & Chr(34), "", @SW_HIDE) Else For $i = 1 to $gridsize RunWait(@TempDir & "\montage.exe +frame +shadow +label -tile " & $gridsize & "x1 -geometry 128x128+0+0 " & $picnamesrow[$i] & Chr(34) & @TempDir & "\" & $i & ".gif" & Chr(34), "", @SW_HIDE) $rows = $rows & @TempDir & "\" & $i & ".gif " Next RunWait(@TempDir & "\montage.exe +frame +shadow +label -tile 1x" & $gridsize & " -geometry " & $rowwidth & "x128+0+0 " & $rows & " " & Chr(34) & $fold & $picout & Chr(34), "", @SW_HIDE) EndIf OnExit() EndFunc Func OnExit() FileDelete(@TempDir & "\montage.exe") FileDelete(@TempDir & "\googtemp.txt") If $deletefold = 1 Then DirRemove($fold, 1) EndIf If $writepic = 1 Then For $i = 1 to ($gridsize * $gridsize) FileDelete(@TempDir & "\" & $i & ".gif") Next EndIf EndFunc Google Map Tool: Resulting Map: Edited May 20, 2006 by Jon
archrival Posted April 22, 2005 Author Posted April 22, 2005 Update:Changed screenshots, updated code, added preview of resulting map. I'm still planning on jpeg output instead of webpage output and possibly adding a transparent png/gif to pinpoint the center.
archrival Posted April 23, 2005 Author Posted April 23, 2005 I have now added jpg, png, bmp, gif, tiff and pdf support. It requires montage from ImageMagick, but works very nicely. The only thing left would be to pinpoint the center.
PerryRaptor Posted April 24, 2005 Posted April 24, 2005 Pretty Cool if you need to do some map work!!!
Mosquitos Posted April 24, 2005 Posted April 24, 2005 Nice script but what is montage.exe please and what does it do? Sapiente vince, rex, noli vincere ferro!
archrival Posted April 24, 2005 Author Posted April 24, 2005 Nice script but what is montage.exe please and what does it do?<{POST_SNAPBACK}>ImageMagickmontage is the program that actually is able to combine the 128x128 files into larger images. It's included in the imagemagick release.
Fossil Rock Posted December 14, 2005 Posted December 14, 2005 I found a couple little errors and added a couple little thingss. Hope you don't mind me updating it to version 2.2.5.5 (if you don't already have a newer version).I haven't figured out yet how to get the montage part to work. The FileInstall command apparently doesn't know where to install from (easy fix), but when I tell it where to install from and then run it, Montage gives me a .dll not found error. Guess I'll need to poke around some more.By the way, very nice project and correct me if I am wrong with the corrections (they made it work on my system).NOTE: On line 32 the line gets broken in the post. Change & #34; to a "expandcollapse popup; ArchRival's Google Mapping Tool ; archrival at gmail dot com $version = "2.2.5.5" #include <GUIConstants.au3> $gui = GUICreate("Google Map Tool", 300, 200) AutoItWinSetTitle("Google Map Tool") GUICtrlCreateLabel("Address (USA):", 5, 5) GUICtrlCreateLabel("Latitude (N):", 5, 45) GUICtrlCreateLabel("Longitude (W):", 5, 85) GUICtrlCreateLabel("Zoom:", 5, 130) GUICtrlCreateLabel("Grid Size:", 5, 152) GUICtrlCreateLabel("Location:", 130, 130) GUICtrlCreateLabel("Output:", 130, 152) $titlelabel = GUICtrlCreateLabel("Google Map Tool Ver. " & $version, 5, 173) $copylabel = GUICtrlCreateLabel(Chr(169) & @YEAR & ", ArchRival Networks", 5, 183) GUICtrlSetFont($titlelabel, 6) GUICtrlSetFont($copylabel, 6) $gpsadddrop = GUICtrlCreateCombo("Street Address", 185, 127, 110, "", $CBS_DROPDOWNLIST) GUICtrlSetData($gpsadddrop, "GPS Coordinates", "Street Address") $webpicdrop = GUICtrlCreateCombo("Create HTML", 185, 147, 110, "", $CBS_DROPDOWNLIST) GUICtrlSetData($webpicdrop, "Create JPG|Create PNG|Create TIFF|Create BMP|Create GIF|Create PDF", "Create PNG") $okbut = GUICtrlCreateButton("OK", 139, 170, 50) $cancelbut = GUICtrlCreateButton("Cancel", 245, 170, 50) $clearbut = GUICtrlCreateButton("Clear", 192, 170, 50) $addrgui = GUICtrlCreateInput("", 5, 20, 290) $latgui = GUICtrlCreateInput("", 5, 60, 290) $longgui = GUICtrlCreateInput("", 5, 100, 290) $zoomgui = GUICtrlCreateCombo("0", 55, 127, 40, "", $CBS_DROPDOWNLIST) GUICtrlSetData($zoomgui, "1|2|3|4|5|6|7|8|9|10|11|12|13|14", "2") $gridgui = GUICtrlCreateCombo("1", 55, 147, 40, "", $CBS_DROPDOWNLIST + $WS_VSCROLL) GUICtrlSetData($gridgui, "3|5|7|9|11|13|15|17|19|21|23|25|27|29|31|33|35|37|39|41|43|45|47|49|51|53|55|57|59|61|63|65|67|6 9|71|73|75|77|79|81|83|85|87|89|91|93|95|97|99", "3") GUICtrlSetState($addrgui, $GUI_DISABLE) GUICtrlSetState($latgui, $GUI_DISABLE) GUICtrlSetState($longgui, $GUI_DISABLE) GUISetState(@SW_SHOW) Dim $addrsel Dim $deletefold Dim $writepic Dim $coordsel ;======== Added this to make the Address field active and have focus upon startup GUICtrlSetState($latgui, $GUI_DISABLE) GUICtrlSetState($longgui, $GUI_DISABLE) GUICtrlSetState($addrgui, $GUI_ENABLE) GUICtrlSetState($addrgui, $GUI_FOCUS) Global $addrsel = 1 Global $coordsel = 0 ;======== While 1 $msg = GUIGetMsg() Select Case $msg = $gpsadddrop If GUICtrlRead($gpsadddrop) = "GPS Coordinates" Then GUICtrlSetState($addrgui, $GUI_DISABLE) GUICtrlSetState($latgui, $GUI_ENABLE) GUICtrlSetState($longgui, $GUI_ENABLE) GUICtrlSetState($latgui, $GUI_FOCUS) ;added this to give focus to the field Global $addrsel = 0 Global $coordsel = 1 ElseIf GUICtrlRead($gpsadddrop) = "Street Address" Then GUICtrlSetState($latgui, $GUI_DISABLE) GUICtrlSetState($longgui, $GUI_DISABLE) GUICtrlSetState($addrgui, $GUI_ENABLE) GUICtrlSetState($addrgui, $GUI_FOCUS) ;added this to give focus to the field Global $addrsel = 1 Global $coordsel = 0 EndIf Case $msg = $okbut Global $create = GUICtrlRead($webpicdrop) If $addrsel = 1 Then Global $readaddr = GUICtrlRead($addrgui) If $readaddr = "" Then ContinueLoop EndIf Global $address = StringReplace($readaddr, " ", "+") $googsrch = "http://maps.google.com/maps?q=" & $address & "&hl=en" InetGet($googsrch, @TempDir & "\googtemp.txt") $parse = FileRead(@TempDir & "\googtemp.txt", FileGetSize(@TempDir & "\googtemp.txt")) Global $lat = StringTrimLeft(StringMid($parse, StringInStr($parse, "point lat=") + 10, 10), 1) $checklatper = StringInStr($lat, ",") If $checklatper = 3 Then Global $lat = StringTrimRight($lat, 1) $longloc = 26 Else $longloc = 27 EndIf Global $long = StringTrimLeft(StringMid($parse, StringInStr($parse, "point lat=") + $longloc, 11), 1) $checklongper = StringInStr($long, ".") If $checklongper = 3 Then Global $long = StringTrimRight($long, 1) EndIf Global $zoom = GUICtrlRead($zoomgui) Global $gridsize = GUICtrlRead($gridgui) ElseIf $coordsel = 1 Then Global $zoom = GUICtrlRead($zoomgui) Global $gridsize = GUICtrlRead($gridgui) Global $long = Number(GUICtrlRead($longgui)) If $long = "" Then ContinueLoop EndIf If $long > 360 or $long < 0 Then ContinueLoop EndIf Global $lat = Number(GUICtrlRead($latgui)) If $lat = "" Then ContinueLoop EndIf If $lat > 360 or $lat < 0 Then ContinueLoop EndIf Else ContinueLoop EndIf GUIDelete($gui) ExitLoop Case $msg = $cancelbut OnExit() Exit Case $msg = $clearbut GUICtrlSetData($addrgui, "") GUICtrlSetData($latgui, "") GUICtrlSetData($longgui, "") If $addrgui = 1 Then GUICtrlSetState($addrgui, $GUI_FOCUS) ; Doesn't work for some reason Else GUICtrlSetState($latgui, $GUI_FOCUS) ; Works - so why doesn't the other one work ? EndIf Case $msg = $GUI_EVENT_CLOSE OnExit() Exit EndSelect WEnd Global $img[$gridsize + 1][$gridsize + 1] Global $x = Round(2^ (17 - $zoom) * (-$long + 98.35) * 0.77162458338772 / 128, 0) Global $y = Round(2^ (17 - $zoom) * (39.5 - $lat) / 128, 0) If InetGetSize("http://mt.google.com/mt?v=.1&x=" & $x & "&y=" & $y & "&zoom=" & $zoom) = 1283 and InetGetSize("http://mt.google.com/mt?v=.1&x=" & $x + 1 & "&y=" & $y & "&zoom=" & $zoom) = 1283 Then MsgBox(0, "Invalid Address", "Please Enter a valid address/coordinates") Exit EndIf Global $i = 1 If $addrsel = 1 Then Global $fold = $readaddr & " (" & $gridsize & "x" & $zoom & ")" Else Global $fold = $lat & "N, " & $long & "W" & " (" & $gridsize & "x" & $zoom & ")" EndIf If $create = "Create HTML" Then $deletefold = 0 WriteHTML() Else $deletefold = 1 $writepic = 1 WritePic() EndIf Func WriteHTML() If Not FileExists($fold) Then DirCreate($fold) Else If FileExists($fold & "\googmap.htm") Then FileDelete($fold & "\googmap.htm") EndIf EndIf FileWrite($fold & "\googmap.htm", "<html>" & @CRLF) If $addrsel = 1 Then FileWrite($fold & "\googmap.htm", "<title>" & $readaddr & " @ " & $lat & "N, " & $long & "W " & ":: Grid Size: " & $gridsize & "x" & $gridsize & " :: Zoom: " & $zoom & "</title>" & @CRLF) Else FileWrite($fold & "\googmap.htm", "<title>" & $lat & "N, " & $long & "W :: Grid Size: " & $gridsize & "x" & $gridsize & " :: Zoom: " & $zoom & "</title>" & @CRLF) EndIf FileWrite($fold & "\googmap.htm", @Tab & "<table border=" & Chr(34) & "0" & Chr(34) & " cellpadding=" & Chr(34) & "0" & Chr(34) & " cellspacing=" & Chr(34) & "0" & Chr(34) & ">" & @CRLF) For $row = 1 To $gridsize FileWrite($fold & "\googmap.htm", @Tab & @Tab & "<tr>" & @CRLF) If $row = Int($gridsize / 2) + 1 Then $currow = 0 Else $currow = ((Int($gridsize / 2) + 1) - $row) EndIf For $column = 1 To $gridsize If $column = Int($gridsize / 2) + 1 Then $curcol = 0 Else $curcol = ((Int($gridsize / 2) + 1) - $column) EndIf FileWrite($fold & "\googmap.htm", @Tab & @Tab & @Tab & "<td width=" & Chr(34) & "128" & Chr(34) & "height=" & Chr(34) & "128" & Chr(34) & ">" & @CRLF) FileWrite($fold & "\googmap.htm", @Tab & @Tab & @Tab & @Tab & "<img src=" & Chr(34) & "http://mt.google.com/mt?v=.1&x=" & $x - $curcol & "&y=" & $y - $currow & "&zoom=" & $zoom & Chr(34) & " width=" & Chr(34) & "128" & Chr(34) & "height=" & Chr(34) & "128" & Chr(34) & "></td>" & @CRLF) If $addrsel = 1 Then TrayTip("Google Map Tool", "Now mapping " & $readaddr & ", " & Round(($i/($gridsize * $gridsize)) * 100) & "%", 5) Else TrayTip("Google Map Tool", "Now mapping " & $lat & "N, " & $long & "W" & ", " & Round(($i/($gridsize * $gridsize)) * 100) & "%", 5) EndIf $i = $i + 1 Next FileWrite($fold & "\googmap.htm", @Tab & @Tab & "</tr>" & @CRLF) Next FileWrite($fold & "\googmap.htm", "</html>" & @CRLF) ;$o_URL = ObjCreate("Shell.Application") ;$o_URL.Open(@WorkingDir & "\" & $fold & "\googmap.htm") OnExit() EndFunc Func WritePic() If $create = "Create JPG" Then $picout = ".jpg" ElseIf $create = "Create PNG" Then $picout = ".png" ElseIf $create = "Create TIFF" Then $picout = ".tif" ElseIf $create = "Create BMP" Then $picout = ".bmp" ElseIf $create = "Create GIF" Then $picout = ".gif" ElseIf $create = "Create PDF" Then $picout = ".pdf" EndIf Dim $picnames Dim $picnamesrow[$gridsize + 1] Dim $rows $rowwidth = $gridsize * 128 If Not FileExists($fold) Then DirCreate($fold) EndIf FileInstall("montage.exe", @TempDir & "\montage.exe", 1) For $row = 1 To $gridsize If $row = Int($gridsize / 2) + 1 Then $currow = 0 Else $currow = ((Int($gridsize / 2) + 1) - $row) EndIf $picnamesrow[$row] = "" For $column = 1 To $gridsize If $column = Int($gridsize / 2) + 1 Then $curcol = 0 Else $curcol = ((Int($gridsize / 2) + 1) - $column) EndIf $img[$row][$column] = "http://mt.google.com/mt?v=.1&x=" & $x - $curcol & "&y=" & $y - $currow & "&zoom=" & $zoom InetGet($img[$row][$column], $fold & "\" & $i & ".gif") If $addrsel = 1 Then TrayTip("Google Map Tool", "Now mapping " & $fold & ", " & Round(($i/($gridsize * $gridsize)) * 100) & "%", 50000, 16) Else TrayTip("Google Map Tool", "Now mapping " & $lat & "N, " & $long & "W" & ", " & Round(($i/($gridsize * $gridsize)) * 100) & "%", 50000, 16) EndIf If $gridsize < 15 Then $picnames = $picnames & Chr(34) & $fold & "\" & $i & ".gif" & Chr(34) & " " Else $picnamesrow[$row] = $picnamesrow[$row] & Chr(34) & $fold & "\" & $i & ".gif" & Chr(34) & " " EndIf $i = $i + 1 Next Next TrayTip("Google Map Tool", "Now creating " & $fold & $picout, 50, 16) If $gridsize < 15 Then RunWait(@TempDir & "\montage.exe +frame +shadow +label -tile " & $gridsize & "x" & $gridsize & " -geometry 128x128+0+0 " & $picnames & Chr(34) & $fold & $picout & Chr(34), "", @SW_HIDE) Else For $i = 1 to $gridsize RunWait(@TempDir & "\montage.exe +frame +shadow +label -tile " & $gridsize & "x1 -geometry 128x128+0+0 " & $picnamesrow[$i] & Chr(34) & @TempDir & "\" & $i & ".gif" & Chr(34), "", @SW_HIDE) $rows = $rows & @TempDir & "\" & $i & ".gif " Next RunWait(@TempDir & "\montage.exe +frame +shadow +label -tile 1x" & $gridsize & " -geometry " & $rowwidth & "x128+0+0 " & $rows & " " & Chr(34) & $fold & $picout & Chr(34), "", @SW_HIDE) EndIf OnExit() EndFunc Func OnExit() FileDelete(@TempDir & "\montage.exe") FileDelete(@TempDir & "\googtemp.txt") If $deletefold = 1 Then DirRemove($fold, 1) EndIf If $writepic = 1 Then For $i = 1 to ($gridsize * $gridsize) FileDelete(@TempDir & "\" & $i & ".gif") Next EndIf EndFunc Agreement is not necessary - thinking for one's self is!
archrival Posted December 14, 2005 Author Posted December 14, 2005 What did you change? I've been attempting to get this to work recently, Google changed everything around now that you can search for more than just US places. They also changed the pictures to be 256x256 now, this code does not work for me, nor should it with all of the changes Google has made since I wrote this. I basically have the changes figured out, I just can't quite figure out their calculations, apparently the earth is really ~363 degrees around...
Fossil Rock Posted December 14, 2005 Posted December 14, 2005 What did you change? I've been attempting to get this to work recently, Google changed everything around now that you can search for more than just US places. They also changed the pictures to be 256x256 now, this code does not work for me, nor should it with all of the changes Google has made since I wrote this. I basically have the changes figured out, I just can't quite figure out their calculations, apparently the earth is really ~363 degrees around... The changes I made have remarks above or beside them. Dim $coordsel - forgot to add a remark ;======== Added this to make the Address field active and have focus upon startup GUICtrlSetState($latgui, $GUI_DISABLE) GUICtrlSetState($longgui, $GUI_DISABLE) GUICtrlSetState($addrgui, $GUI_ENABLE) GUICtrlSetState($addrgui, $GUI_FOCUS) Global $addrsel = 1 Global $coordsel = 0 ;======== GUICtrlSetState($latgui, $GUI_FOCUS) ;added this to give focus to the field GUICtrlSetState($addrgui, $GUI_FOCUS) ;added this to give focus to the field If $addrgui = 1 Then GUICtrlSetState($addrgui, $GUI_FOCUS); Doesn't work for some reason Else GUICtrlSetState($latgui, $GUI_FOCUS) ; Works - so why doesn't the other one work ? It wasn't anything big and as I mentioned, the montage thing doesn't work for me. So the app works upto the point it tries to run montage then I get a dll error. Keep working on it, I think it a nice app. Agreement is not necessary - thinking for one's self is!
Andrey777 Posted February 17, 2009 Posted February 17, 2009 I have error D:\au3\googlemapping.au3 (20) : ==> Variable used without being declared.: $gpsadddrop = GUICtrlCreateCombo("Street Address", 185, 127, 110, "", $CBS_DROPDOWNLIST) $gpsadddrop = GUICtrlCreateCombo("Street Address", 185, 127, 110, "", ^ ERROR
BrettF Posted February 17, 2009 Posted February 17, 2009 Hi,Please read these pages if you are having trouble with the constants. This is your 2nd post on the subject, so maybe try fix them yourself first okay?http://www.autoitscript.com/autoit3/docs/a...x/GUIStyles.htmIt tells you what to include for the specific styles.Cheers,Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
ReFran Posted February 25, 2009 Posted February 25, 2009 For me it works furtheron (after using Scite->Tools->OrganizeIncludes).But for mass downloads of Google/Yahooa maps in every resolution I use at time the free tool MapAway: http://www.iippo.net/jb/main/index.php(It's basicly thought to get calibrated maps for pathaway - but can also save as bmp.However, the development is finished and I'm afraid by time I have to look deeper inthings like this.Thanks for the Application,Reinhard
weaponx Posted February 26, 2009 Posted February 26, 2009 I think the Google Static Maps API would make this is a lot easier now, which requires an API key.
ReFran Posted February 26, 2009 Posted February 26, 2009 I think the Google Static Maps API would make this is a lot easier now, which requires an API key.Thanks for the URLs. Yes, I think that is the way to go, especially if you want to have calibrated maps for use with GPS.Best regards, Reinhard
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now