Hi,
hier mal eine googlemap-UDF für die static-Map-Version:
Spoiler anzeigen
; #FUNCTION# ;===============================================================================;; Name...........: _googlemaplink; Description ...: Create googlemap-imagelink; AutoIt Version : V3.3.8.0; Syntax.........: _googlemaplink($place[, $zoom = "12"[, $x = "512"[, $y = "512"[, $type = "roadmap"[, $format = "jpg"]]]]]); Parameters ....: $place - Mapplace (Cityname/Road/Housenumber or coordinates); $zoom - Optional: (Default = "12") : Zoomlevel; $x - Optional: (Default = "512") : Mapwidth; $y - Optional: (Default = "512") : Mapheight; $type - Optional: (Default = "roadmap") : Maptype (roadmap, satellite, terrain, hybrid); $format - Optional: (Default = "png") : Mapformat (png, png32, gif, jpg, jpg-baseline); Return values .: Success - Returns : googlemap-imagelink; Failure - Returns 0 and Sets @Error:; |0 - No error.; |1 - No place set; |2 - Wrong maptype; |3 - Wrong format; Author ........: chip;; ;==========================================================================================; #FUNCTION# ;===============================================================================;; Name...........: _googlemapzoom; Description ...: Change zoomlevel; AutoIt Version : V3.3.8.0; Syntax.........: _googlemapzoom($link[, $zoom = "1"]); Parameters ....: $link - googlemaplink; $zoom - Optional: (Default = "1") : Zoomlevel; Return values .: Success - Returns : googlemap-imagelink; Failure - Returns 0 and Sets @Error:; |0 - No error.; |1 - No link set; Author ........: chip;; ;==========================================================================================; #FUNCTION# ;===============================================================================;; Name...........: _googlemapwidth; Description ...: Change width; AutoIt Version : V3.3.8.0; Syntax.........: _googlemapwidth($link[, $x = "512"]); Parameters ....: $link - googlemaplink; $x - Optional: (Default = "512") : Mapwidth; Return values .: Success - Returns : googlemap-imagelink; Failure - Returns 0 and Sets @Error:; |0 - No error.; |1 - No link set; Author ........: chip;; ;==========================================================================================; #FUNCTION# ;===============================================================================;; Name...........: _googlemapheigth; Description ...: Change heigth; AutoIt Version : V3.3.8.0; Syntax.........: _googlemapheigth($link[, $y = "512"]); Parameters ....: $link - googlemaplink; $y - Optional: (Default = "512") : Mapheigth; Return values .: Success - Returns : googlemap-imagelink; Failure - Returns 0 and Sets @Error:; |0 - No error.; |1 - No link set; Author ........: chip;; ;==========================================================================================; #FUNCTION# ;===============================================================================;; Name...........: _googlemaptype; Description ...: Change type; AutoIt Version : V3.3.8.0; Syntax.........: _googlemaptype($link[, $type = "roadmap"]); Parameters ....: $link - googlemaplink; $type - Optional: (Default = "roadmap") : Maptype (roadmap, satellite, terrain, hybrid); Return values .: Success - Returns : googlemap-imagelink; Failure - Returns 0 and Sets @Error:; |0 - No error.; |1 - No link set; |2 - Wrong maptype; Author ........: chip;; ;==========================================================================================; #FUNCTION# ;===============================================================================;; Name...........: _googlemapformat; Description ...: Change format; AutoIt Version : V3.3.8.0; Syntax.........: _googlemapformat($link[, $format = "jpg"]); Parameters ....: $link - googlemaplink; $format - Optional: (Default = "jpg") : Mapformat (png, png32, gif, jpg, jpg-baseline); Return values .: Success - Returns : googlemap-imagelink; Failure - Returns 0 and Sets @Error:; |0 - No error.; |1 - No link set; |2 - Wrong mapformat; Author ........: chip;; ;==========================================================================================; #FUNCTION# ;===============================================================================;; Name...........: _googlemapaddstyle; Description ...: Add style; AutoIt Version : V3.3.8.0; Syntax.........: _googlemapaddstyle($link[, $feature = "all"[, $element = "all"[, $hue = ""[, $lightness = ""[, $saturation = ""[, $gamma = ""[, $inverse = ""[, $visibility = ""]]]]]]]]); Parameters ....: $link - googlemaplink; $feature - Optional: (Default = "all") : feature (http://code.google.com/intl/de-DE/api…tyleFeatureType); $element - Optional: (Default = "all") : element (all, geometry, lables); $hue - Optional: (Default = "") : color (RGB-HEX: 0xRRGGBB); $lightness - Optional: (Default = "") : lightness (-100 to 100); $saturation - Optional: (Default = "") : saturation (-100 to 100); $gamma - Optional: (Default = "") : gamma (0.01 to 10.0); $inverse - Optional: (Default = "") : lightness-inverse (1); $visibility - Optional: (Default = "") : element visibility (on, off, simplified); Return values .: Success - Returns : googlemap-imagelink; Failure - Returns 0 and Sets @Error:; |0 - No error.; |1 - No link set; |2 - Wrong hue value.; |3 - Wrong lightness value.; |4 - Wrong saturation value.; |5 - Wrong gamma value.; |6 - Wrong inverse value.; |7 - Wrong visibility value.; Author ........: chip;; ;==========================================================================================; #FUNCTION# ;===============================================================================;; Name...........: _googlemapaddmarker; Description ...: Add marker; AutoIt Version : V3.3.8.0; Syntax.........: _googlemapaddmarker($link, $place[, $size = "mid"[, $color = ""[, $label = ""]]]); Parameters ....: $link - googlemaplink; $place - Markerplace (Cityname/Road/Housenumber or coordinates, more markers with the same size/color/label separated with "|" example "Saarbrücker Straße,Berlin|Auguststraße,Berlin"); $size - Optional: (Default = "mid") : Markersize (tiny, mid, small); $color - Optional: (Default = "") : Markercolor (black, brown, green, purple, yellow, blue, gray, orange, red, white or 24-Bit example: 0xFFFFCC); $label - Optional: (Default = "") : Markerlabel (a single uppercase alpha-numeric characters, only available by Markersize mid); Return values .: Success - Returns : googlemap-imagelink; Failure - Returns 0 and Sets @Error:; |0 - No error.; |1 - No link set; |2 - No place set; |3 - Wrong size; Author ........: chip;; ;==========================================================================================; #FUNCTION# ;===============================================================================;; Name...........: _googlemapaddpath; Description ...: Add path; AutoIt Version : V3.3.8.0; Syntax.........: _googlemapaddpath($link, $place[, $color = "0xff0000FF"[, $weight = ""[, $fillcolor = ""]]]); Parameters ....: $link - googlemaplink; $place - List of a least to places ((Cityname/Road/Housenumber or coordinates, separated with "|" example "Auguststraße,Berlin|Almstadtstraße,Berlin|Saarbrücker Straße,Berlin")); $color - Optional: (Default = "0xff0000FF") : Pathcolor (black, brown, green, purple, yellow, blue, gray, orange, red, white or 24-Bit example: 0xFFFFCC); $weight - Optional: (Default = "") : path thickness; $fillcolor - Optional: (Default = "") : Fill color of the Path; Return values .: Success - Returns : googlemap-imagelink; Failure - Returns 0 and Sets @Error:; |0 - No error.; |1 - No link set; |2 - No place set; |3 - Wrong size; Author ........: chip;; ;==========================================================================================
[/autoit]Update: 05.03.2012
- Maker können hinzugefügt werden
- Pfade können hinzugefügt werden
- Flächen könnne ausgefüllt werden
- Es können jetzt zusätzlich zum Ort auch noch Straße und Hausnummer angegeben werden
- Funktion von Prog@ndy zum URL encoden hinzugefügt
- Beispielscript aktuallisiert
Hier mal ein kleines Beispiel noch (besonders schickt finde ich den Button Verkehrswege):
Spoiler anzeigen
#include <GDIPlus.au3>#include <googlemap.au3>#include <GUIConstantsEx.au3>#include <Inet.au3>#include <String.au3>$link = _googlemaplink("Berlin")down($link)#region ### START Koda GUI section ### Form=$Form1_1 = GUICreate("Form1", 808, 534, 192, 124)$Pic1 = GUICtrlCreatePic(@ScriptDir & "\googlemap.jpg", 8, 8, 512, 512)$zoombutton = GUICtrlCreateButton("Zoomen", 632, 16, 75, 25)$zoomlevel = GUICtrlCreateInput("", 528, 16, 97, 21)$typecombo = GUICtrlCreateCombo("roadmap", 528, 56, 145, 25)GUICtrlSetData(-1, "satellite|terrain|hybrid")$typebutton = GUICtrlCreateButton("Typ", 680, 56, 75, 25)$widthinput = GUICtrlCreateInput("", 528, 88, 121, 21)$widthbutton = GUICtrlCreateButton("Breite", 664, 88, 75, 25)$heightinput = GUICtrlCreateInput("", 528, 120, 121, 21)$heightbutton = GUICtrlCreateButton("Höhe", 664, 120, 75, 25)$stylebutton = GUICtrlCreateButton("Verkehrswege", 528, 160, 91, 25)$ich = GUICtrlCreateButton("meine Position", 528, 190, 91, 25)$marker = GUICtrlCreateButton("Marker", 528, 220, 91, 25)$marker2 = GUICtrlCreateButton("zwei Marker", 528, 250, 93, 25)GUICtrlSetState(-1, $GUI_DISABLE)$pfad = GUICtrlCreateButton("Pfad", 528, 280, 93, 25)GUICtrlSetState(-1, $GUI_DISABLE)$dreieck = GUICtrlCreateButton("Dreieck", 528, 310, 93, 25)GUICtrlSetState(-1, $GUI_DISABLE)GUISetState(@SW_SHOW)#endregion ### END Koda GUI section ###While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $zoombutton $link = _googlemapzoom($link, GUICtrlRead($zoomlevel)) down($link) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") Case $widthbutton $link = _googlemapwidth($link, GUICtrlRead($widthinput)) down($link) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\googlemap.jpg") $y = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() GUICtrlSetPos($Pic1, 8, 8, GUICtrlRead($widthinput), $y) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") Case $heightbutton $link = _googlemapheigth($link, GUICtrlRead($heightinput)) _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\googlemap.jpg") $x = _GDIPlus_ImageGetWidth($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() GUICtrlSetPos($Pic1, 8, 8, $x, GUICtrlRead($heightinput)) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") Case $typebutton $link = _googlemaptype($link, GUICtrlRead($typecombo)) down($link) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") Case $stylebutton $link = _googlemapaddstyle($link, "road.highway", "geometry", "0xff0022", -20, 60) $link = _googlemapaddstyle($link, "road.highway", "labels", "", "", 98, "", "", "on") $link = _googlemapaddstyle($link, "road.arterial", "geometry", "0x2200ff", -40, 30, "", "", "simplified") $link = _googlemapaddstyle($link, "road.local", "all", "0xf6ff00", "", 60, 0.7, "", "simplified") $link = _googlemapaddstyle($link, "water", "geometry", "", 40, 40) $link = _googlemapaddstyle($link, "administrative.locality", "labelsy", "0x0022ff", -10, 50, 0.9) $link = _googlemapaddstyle($link, "transit.line", "geometry", "0xff0000", -70, "", "", "", "on") down($link) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") Case $ich $ip = _GetIP() $data = InetRead("http://www.geoiptool.com/?IP" & $ip, 1) $data = BinaryToString($data) $wert = _StringBetween($data, '<table width="300" height="300" border="0" cellpadding="4" cellspacing="0" class="tbl_style">', '</table>') $final = _StringBetween($wert[0], 'class="arial_bold">', '</td>') For $i = 0 To UBound($final) - 1 If StringInStr($final[$i], "<a href=") Then $trim = _StringBetween($final[$i], '">', '</a>') $final[$i] = StringStripWS($trim[0], 1) EndIf Next $link = _googlemaplink($final[9] & "," & $final[8]) down($link) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") Case $marker $link = _googlemapaddmarker($link, "Almstadtstraße,Berlin", "mid", "blue", "B") $link = _googlemapzoom($link, 2) down($link) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") GUICtrlSetState($marker2, $GUI_ENABLE) GUICtrlSetState($pfad, $GUI_ENABLE) GUICtrlSetState($dreieck, $GUI_ENABLE) Case $marker2 $link = _googlemapaddmarker($link, "Saarbrücker Straße,Berlin|Auguststraße,Berlin", "mid", "orange", "A") down($link) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") Case $pfad $link = _googlemapaddpath($link, "Auguststraße,Berlin|Almstadtstraße,Berlin|Saarbrücker Straße,Berlin") down($link) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") Case $dreieck $link = _googlemapaddpath($link, "Auguststraße,Berlin|Almstadtstraße,Berlin|Saarbrücker Straße,Berlin", "0xff0000FF", "", "blue") down($link) GUICtrlSetImage($Pic1, @ScriptDir & "\googlemap.jpg") EndSwitchWEndFunc down($link) InetGet($link, @ScriptDir & "\googlemap.jpg")EndFunc ;==>down
[/autoit]