Seite 1 von 1

Google Maps Bild speichern

Verfasst: 02.07.2012 22:01
von Mr.L
Hier ein simples Programm mit dem man GoogleMaps-Karten als Bilddatei speichern kann.

Code: Alles auswählen

EnableExplicit
If InitNetwork() = 0
	MessageRequester("", "InitNetwork failed")
	End
EndIf

Procedure SaveGoogleMapImage(destinationPath$, location$, zoom = 15, maptype$ = "satellite", format$ = "jpg-baseline", width = 640, height = 640)
	; destinationPath$:	save image to this path
	; location:			(latitude,longitude) or address
	; zoom:				0 - 21 (depending on location)
	; mapType$:			roadmap, satellite, hybrid, terrain
	; format;			png32,png8,png,gif,jpg,jpg-baseline
	; width/height:		max. 640x640
	
	Protected url$
	
	url$ = "http://maps.googleapis.com/maps/api/staticmap?center=%LOC%&size=%WID%x%HIG%&format=%FMT%&zoom=%ZOM%&scale=2&maptype=%MPT%&sensor=false";&markers=%LOC%"
	url$ = ReplaceString(url$, "%LOC%", location$)
	url$ = ReplaceString(url$, "%WID%", Str(width))
	url$ = ReplaceString(url$, "%HIG%", Str(height))
	url$ = ReplaceString(url$, "%FMT%", format$)
	url$ = ReplaceString(url$, "%ZOM%", Str(zoom))
	url$ = ReplaceString(url$, "%MPT%", maptype$)
	
	ProcedureReturn ReceiveHTTPFile(url$, destinationPath$)
EndProcedure

SaveGoogleMapImage("C:\Test.jpg", "-33.892351,151.27600",18)