Jump to content

Google Map Tool


archrival
 Share

Recommended Posts

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.

; 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 by Jon
Link to comment
Share on other sites

  • 7 months later...

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 "

; 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!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

  • 3 years later...

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.htm

It tells you what to include for the specific styles.

Cheers,

Brett

Link to comment
Share on other sites

  • 2 weeks later...

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 in

things like this.

Thanks for the Application,

Reinhard

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...