ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Map functions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Centers the map displayed in a Map control on a geographical position or on a specific location. An animation is automatically performed.
At the end of the animation, the "Whenever changing position" event of the Map control will be run. This event will not be run if the positioning on the map is canceled by the user before the end of the animation.
// Centre la carte affichée par le champ "CARTE_Position" sur une position géographique 
MaPosition is geoPosition
MapDisplayPosition(CARTE_Position, MaPosition)

// Syntaxe équivalente (sans animation) : CARTE_Position = MaPosition
WINDEV
// Centre la carte affichée par le champ "CARTE_Position" sur une ville à partir de son nom
MapDisplayPosition(CARTE_Position, "Montpellier, France")

// Centre la carte affichée par le champ "CARTE_Position" sur un monument à partir de son nom 
MapDisplayPosition(CARTE_Position, "Tour Eiffel")
Syntax
WINDEV

Displaying a geographical location Hide the details

<Result> = MapDisplayPosition(<Map control> , <Position>)
<Result>: Boolean
  • True if the map was positioned on the specified position,
  • False otherwise. To get more details on the error, use ErrorInfo.
<Map control>: Control name
Name of the Map control to be used. If this parameter corresponds to an empty string (""), the Map control to which the current event belongs will be used.
<Position>: geoPosition variable or character string
Description of the location on which the map will be centered. This description can correspond to:
  • the name of the geoPosition variable describing the geographical position on which the map will be centered.
  • to a character string containing an address, a town, the name of a monument, etc.
  • a variable of type Address.
WINDEV

Displaying a geographical location with check procedure Hide the details

MapDisplayPosition(<Map control> , <Position> [, <WLanguage procedure>])
<Map control>: Control name
Name of the Map control to be used. If this parameter corresponds to an empty string (""), the Map control to which the current event belongs will be used.
<Position>: geoPosition variable or character string
Description of the location on which the map will be centered. This description can correspond to:
  • the name of the geoPosition variable describing the geographical position on which the map will be centered.
  • to a character string containing an address, a town, the name of a monument, etc.
  • a variable of type Address.
<WLanguage procedure>: Optional procedure name
Name of the WLanguage procedure ("callback" procedure) called once the new geographical position is displayed. This procedure has the following format:
PROCEDURE <Procedure name> (<Change performed>)

where <Change performed> is a boolean:
  • True if the position was modified,
  • False otherwise.
Remarks
  • WINDEV The MapDisplayPosition function uses Google's geolocation service. The positions define from the description of a location depend on the quantity and on the precision of the information supplied in this description. If the same description correspond to several locations, the geolocation service will return the most suitable correspondences.
  • The zoom level of the map is not modified when changing position.
  • To center the map on a given position without animationyou can directly assign a geoPosition variable to the Value property of a Map control.
  • WINDEV To find out the position currently displayed in the center of the Map control, use MapGetPosition.
Related Examples:
The Map control Unit examples (WEBDEV): The Map control
[ + ] This example explains how to use the Map control of WEBDEV.
It can be used to display a map that includes markers as well as an itinerary.
The Map control Unit examples (WINDEV): The Map control
[ + ] Using the Map control of WINDEV.
It is used to display a map that includes markers as well as an itinerary.
Component: wd300obj.dll
Minimum version required
  • Version 17
This page is also available for…
Comments
Example
MapLicenseGgl("AIzaSyDbSVKYPwB1a-_vPbDzAr6LgAfIj4iW2hc")

PositionWx is geoPosition
PositionWx.Latitude = -25.4401779
PositionWx.Longitude = -49.2118695

MarkerWx is Marker
MarkerWx.Description = "WX INFORMATICA"
MarkerWx.Name = "WX INFORMATICA"
MarkerWx.Position = PositionWx

MapAddMarker(GoogleMaps,MarkerWx)

GoogleMaps.DisplayPosition(PositionWx)
GoogleMaps..Zoom = 18
BOLLER
13 Jul. 2018

Last update: 03/27/2025

Send a report | Local help