|
- Saving the Google map
- Key for Google Static Map
- Possible error cases
GglGetStaticMap (Function) In french: GglRécupèreCarte Retrieves the map of a specific location via the Google Maps service.
MyGoogleKey is string MyGoogleKey = "Google key example"
MyImage is Image MyImage = GglGetStaticMap(MyGoogleKey, 40.714728, 73.998672, 14, 400, 400)
// Code used to display a journey MyGoogleKey is string MyGoogleKey = "Google key example" MyImage is Image Point is gglMapParameter Coord is gglCoordinate Mark 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 MyImage = GglGetStaticMap(MyGoogleKey, 40.6423, -73.7959, 12, 600, 600, gglHybrid, Point) IMG_Image2 = MyImage
Syntax | This syntax is obsolete from version 2 of the mapping service: the Google key is not required anymore. |
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 parameters>]])
<Result>: Image variable Name of the Image variable containing the map. The map is returned to the specified dimensions. <Google key>: Character string (with quotes) Authentication key for the Google Maps service. This key is supplied by Google.Remark: Since version 2 of the Google service, this parameter has become obsolete and it is ignored.Remark: The Google key is required for an advanced use only (use with charge for more than 25000 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 example).
- the gglAutoZoom constant. In this case, the zoom is automatically chosen according to the markers or to the area defined in <Advanced parameters>. A WLanguage error occurs if this constant is used without <Advanced Parameters>.
<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:
| | gglHybrid | Combine the road map and the satellite view. | gglMobileDevice | Map optimized for the constraints specific to the display on a Mobile device | gglRoadmap (Default value) | Road map. | gglSatellite | Satellite view. | gglTerrain | Geographical map displaying the relief and the vegetation. |
<Advanced parameters>: Optional gglMapParameter variable Name of the gglMapParameter variable containing the advanced setting 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 from version 2 of the mapping service: the Google key is not required anymore. |
Retrieving a map with automatic centering Hide the details
<Result> = GglGetStaticMap(<Google key> , <Image width> , <Image height> , <Type of map> , <Advanced parameters>)
<Result>: Image variable Name of the Image variable containing the map. The map is returned to the specified dimensions. <Google key>: Character string (with quotes) Authentication key for the Google Maps service. This key is supplied by Google.Remark: Since version 2 of the Google service, this parameter has become obsolete and it is ignored.Remark: The Google key is required for an advanced use only (use with charge for more than 25000 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:
| | gglHybrid | Combine the road map and the satellite view. | gglMobileDevice | Map optimized for the constraints specific to the display on a Mobile device | gglRoadmap | Road map. | gglSatellite | Satellite view. | gglTerrain | Geographical map displaying the relief and the vegetation. |
<Advanced parameters>: gglMapParameter variable Name of the gglMapParameter variable containing the advanced setting 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 parameters>]])
<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 example).
- the gglAutoZoom constant. In this case, the zoom is automatically chosen according to the markers or to the area defined in <Advanced parameters>. A WLanguage error occurs if this constant is used without <Advanced Parameters>.
<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:
| | gglHybrid | Combine the road map and the satellite view. | gglMobileDevice | Map optimized for the constraints specific to the display on a Mobile device | gglRoadmap (Default value) | Road map. | gglSatellite | Satellite view. | gglTerrain | Geographical map displaying the relief and the vegetation. |
<Advanced parameters>: Optional gglMapParameter variable Name of the gglMapParameter variable containing the advanced setting 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 parameters>)
<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:
| | gglHybrid | Combine the road map and the satellite view. | gglMobileDevice | Map optimized for the constraints specific to the display on a Mobile device | gglRoadmap | Road map. | gglSatellite | Satellite view. | gglTerrain | Geographical map displaying the relief and the vegetation. |
<Advanced parameters>: gglMapParameter variable Name of the gglMapParameter variable containing the advanced setting of the map. Remarks To save the Google map in a file, you can: Key for Google Static Map | The Google key is no longer required from version 2 of the mapping service. |
To get the key required for using the Google Maps service, go to the following address: Caution: the address of this page may have been modified since the publication date of this page. 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. See the documentation about the gglMapParameter variables for more details.
Related Examples:
|
Unit examples (WINDEV): The GglGetStaticMap function
[ + ] Using gglGetMap to display a Google map in an Image control.
|
|
Unit examples (WEBDEV): The GglGetStaticMap function
[ + ] Using GglGetStaticMap function to display a Google map in an Image control.
|
Business / UI classification : Business Logic
This page is also available for…
|
|
|
| |
| 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
|
|
|
|
| |
| |
| |
| |
| |
| |
| | |
| |