ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / Google functions / Managing Google Maps
  • Saving the Google map
  • Key for Google Static Map
  • Possible error cases
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
GglGetStaticMap (Function)
In french: GglRécupèreCarte
Retrieves the map of a specific location via the Google Maps service.
MaCléGoogle is string
MaCléGoogle = "Exemple de clé Google"
MonImage is Image
MonImage = GglGetStaticMap(MaCléGoogle, 40.714728, 73.998672, 14, 400, 400)
// Code permettant d'afficher un trajet
MaCléGoogle is string
MaCléGoogle = "Exemple de clé Google"
MonImage is Image 
Point is gglMapParameter
Coord is gglCoordinate
Marq is gglMarker
Point.Path.Color = LightYellow
Point.Path.Thickness = 6
Point.Path.Opacity = 100
FOR EACH ROW i OF TABLE_Table1
	Coord.Latitude = COL_Latitude
	Coord.Longitude = COL_Longitude
	ArrayAdd(Point.Path.Point, Coord)
END
Point.Format = gglPNG32
MonImage = GglGetStaticMap(MaCléGoogle, 40.6423, -73.7959, 12, 600, 600, gglHybrid, Point)
IMG_Image2 = MonImage
Syntax

Retrieving a map with configuration of centering Hide the details

<Result> = GglGetStaticMap(<Google key> , <Latitude> , <Longitude> , <Zoom> , <Image width> , <Image height> [, <Type of map> [, <Advanced settings>]])
<Result>: Image variable
Name of the Image variable containing the map. The map is returned to the specified dimensions.
<Google key>: Character string or Secret string
Authentication key for the Google Maps service. This key is supplied by Google.
New in version 2025
Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI or Unicode string".
To learn more about secret strings and how to use the vault, see Secret string vault.
New in version 2025
AndroidAndroid Widget Secret strings are not available for this parameter in Android/Android widget applications.
Note The Google key is only required for advanced use (paid use for more than 25,000 requests per day).
<Latitude>: Real
Latitude of the central point of the map.
<Longitude>: Real
Longitude of the central point of the map.
<Zoom>: Integer
Zoom level. This parameter can correspond to:
  • an integer included between 0 (most distant zoom) and 19 (very close zoom, scale of a building for instance).
  • the gglAutoZoom constant. In this case, the zoom is automatically chosen according to the markers or the area defined in <Advanced settings>. A WLanguage error occurs if this constant is used without <Advanced settings>.
<Image width>: Integer
Width (in pixels) of the image of the map to retrieve. The maximum width is set to 640 pixels. This limit is defined by the Google Maps service at the date of publication of this page.
<Image height>: Integer
Height (in pixels) of the image of the map to retrieve. The maximum height is set to 640 pixels. This limit is defined by the Google Maps service at the date of publication of this page.
<Type of map>: Optional character string constant
Type of map to retrieve. This parameter can correspond to one of the following constants:
gglHybridCombine the road map and the satellite view.
gglMobileDeviceMap optimized for the constraints specific to the display on a Mobile device
gglRoadmap
(Default value)
Roadmap.
gglSatelliteSatellite view.
gglTerrainGeographical map displaying the relief and the vegetation.
<Advanced settings>: Optional gglMapParameter variable
Name of the gglMapParameter variable containing the advanced settings of the map. If this parameter is not specified, the map will be in Gif format and it will contain no marker, no path and no area.

Retrieving a map with automatic centering Hide the details

<Result> = GglGetStaticMap(<Google key> , <Image width> , <Image height> , <Type of map> , <Advanced settings>)
<Result>: Image variable
Name of the Image variable containing the map. The map is returned to the specified dimensions.
<Google key>: Character string or Secret string
Authentication key for the Google Maps service. This key is supplied by Google.
New in version 2025
Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI or Unicode string".
To learn more about secret strings and how to use the vault, see Secret string vault.
New in version 2025
AndroidAndroid Widget Secret strings are not available for this parameter in Android/Android widget applications.
Note The Google key is only required for advanced use (paid use for more than 25,000 requests per day).
<Image width>: Integer
Width (in pixels) of the image of the map to retrieve. The maximum width is set to 640 pixels. This limit is defined by the Google Maps service at the date of publication of this page.
<Image height>: Integer
Height (in pixels) of the image of the map to retrieve. The maximum height is set to 640 pixels. This limit is defined by the Google Maps service at the date of publication of this page.
<Type of map>: Character String constant
Type of map to retrieve. This parameter can correspond to one of the following constants:
gglHybridCombine the road map and the satellite view.
gglMobileDeviceMap optimized for the constraints specific to the display on a Mobile device
gglRoadmapRoadmap.
gglSatelliteSatellite view.
gglTerrainGeographical map displaying the relief and the vegetation.
<Advanced settings>: gglMapParameter variable
Name of the gglMapParameter variable containing the advanced settings of the map.
This syntax is obsolete since June 11th 2018. From now on, as the Google license has evolved, only the syntax using the Google key must be used.

Retrieving a map with configuration of centering Hide the details

<Result> = GglGetStaticMap(<Latitude> , <Longitude> , <Zoom> , <Image width> , <Image height> [, <Type of map> [, <Advanced settings>]])
<Result>: Image variable
Name of the Image variable containing the map. The map is returned to the specified dimensions.
<Latitude>: Real
Latitude of the central point of the map.
<Longitude>: Real
Longitude of the central point of the map.
<Zoom>: Integer
Zoom level. This parameter can correspond to:
  • an integer included between 0 (most distant zoom) and 19 (very close zoom, scale of a building for instance).
  • the gglAutoZoom constant. In this case, the zoom is automatically chosen according to the markers or the area defined in <Advanced settings>. A WLanguage error occurs if this constant is used without <Advanced settings>.
<Image width>: Integer
Width (in pixels) of the image of the map to retrieve. The maximum width is set to 640 pixels. This limit is defined by the Google Maps service at the date of publication of this page.
<Image height>: Integer
Height (in pixels) of the image of the map to retrieve. The maximum height is set to 640 pixels. This limit is defined by the Google Maps service at the date of publication of this page.
<Type of map>: Optional character string constant
Type of map to retrieve. This parameter can correspond to one of the following constants:
gglHybridCombine the road map and the satellite view.
gglMobileDeviceMap optimized for the constraints specific to the display on a Mobile device
gglRoadmap
(Default value)
Roadmap.
gglSatelliteSatellite view.
gglTerrainGeographical map displaying the relief and the vegetation.
<Advanced settings>: Optional gglMapParameter variable
Name of the gglMapParameter variable containing the advanced settings of the map. If this parameter is not specified, the map will be in Gif format and it will contain no marker, no path and no area.
This syntax is obsolete since June 11th 2018. From now on, as the Google license has evolved, only the syntax using the Google key must be used.

Retrieving a map with automatic centering Hide the details

<Result> = GglGetStaticMap(<Image width> , <Image height> , <Type of map> , <Advanced settings>)
<Result>: Image variable
Name of the Image variable containing the map. The map is returned to the specified dimensions.
<Image width>: Integer
Width (in pixels) of the image of the map to retrieve. The maximum width is set to 640 pixels. This limit is defined by the Google Maps service at the date of publication of this page.
<Image height>: Integer
Height (in pixels) of the image of the map to retrieve. The maximum height is set to 640 pixels. This limit is defined by the Google Maps service at the date of publication of this page.
<Type of map>: Character String constant
Type of map to retrieve. This parameter can correspond to one of the following constants:
gglHybridCombine the road map and the satellite view.
gglMobileDeviceMap optimized for the constraints specific to the display on a Mobile device
gglRoadmapRoadmap.
gglSatelliteSatellite view.
gglTerrainGeographical map displaying the relief and the vegetation.
<Advanced settings>: gglMapParameter variable
Name of the gglMapParameter variable containing the advanced settings of the map.
Remarks

Saving the Google map

To save the Google map in a file, you can:

Key for Google Static Map

To get the key required for using the Google Maps service, go to the following address:
Caution: the address of this page may have changed since this page was written.

Possible error cases

The Google Maps service may not be able to return a valid image according to the location or to the requested zoom.
No data is returned if the limitations defined by the Google Maps service are exceeded (size of the image too large, too many points in a path, and so on). A "HttpBadRequest" error is returned.
For more details, see the documentation about the gglMapParameter variables.
Related Examples:
The GglGetStaticMap function Unit examples (WINDEV): The GglGetStaticMap function
[ + ] Using gglGetMap to display a Google map in an Image control.
The GglGetStaticMap function Unit examples (WEBDEV): The GglGetStaticMap function
[ + ] Using GglGetStaticMap function to display a Google map in an Image control.
Business / UI classification: Business Logic
Component: wd300ggl.dll
Minimum version required
  • Version 14
This page is also available for…
Comments
Exemplo Ws_EnderecoDasCoordenadas
PROCEDURE Ws_EnderecoDasCoordenadas(pLatitude is string, pLongitude is string)

bufPersonalJson is Variant

//Chave API Key Paga o valor de uso pelo console do developer Google Billing
//##########################################################################
ApiGoogle is string = "AIzaSyAsLFFziG-F6p1mCGVltvUGxJyXy1N7V3E"
//##########################################################################

ChangeCharset(charsetOccidental)

sUrl is string = "https://maps.googleapis.com/maps/api/geocode/json?latlng="+pLatitude +","+pLongitude+"&key="+ApiGoogle

ok is boolean = HTTPRequest(sUrl)

bufPersonalJson = HTTPGetResult()

bufPersonalJson = JSONToVariant(bufPersonalJson)

arrMyAddress is array of ANSI string

IF bufPersonalJson.STATUS = "OK"

Add(arrMyAddress,bufPersonalJson.results[1].address_components[2].long_name..Value)

Add(arrMyAddress,bufPersonalJson.results[1].address_components[1].long_name..Value)

END

RESULT arrMyAddress
BOLLER
03 Dec. 2018

Last update: 05/16/2025

Send a report | Local help