ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or site / Controls, windows and pages / Controls: Available types / Map control
  • Overview
  • Initializing a map
  • Displaying a map
  • Managing advanced parameters (WEBDEV)
  • The following functions can be used with the Map controls
  • Remarks
  • Properties specific to Map controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
WINDEV, WEBDEV and WINDEV Mobile allow you to handle a Map control through programming. To do so, use the variable of the Map control in the code.
The variable of the Map control corresponds to the name of the Map control.
This help page explains how to handle a Map control through programming.
Remark: Several WLanguage functions are specific to the management of Map controls. For more details, see Map control functions.
Initializing a map

Displaying a map

When the window containing a Map control is opened, a world map is automatically displayed: the map is centered on Europe, with minimum zoom level.
You can display the last position: you just need to select "Remember last position displayed" in the "General" tab of the Map control description window. In this case, the last position is displayed with the same zoom level.
To display a map corresponding to a specific location, use:
  • the MapDisplayPosition function: This function can be used with a specific position (geoPosition variable), or on a town or a monument.
    For example:
    // Centers the map displayed by the "MAP_Position" control
    // on a geographical location
    MyPosition is géoPosition
    MapDisplayPosition(MAP_Position, MyPosition)

    // Centers the map displayed by the "MAP_Position" control on a city
    // from its name
    MapDisplayPosition(MAP_Position, "Montpellier, France")

    // Centers the map displayed by the "MAP_Position" control on a monument
    // from its name
    MapDisplayPosition(MAP_Position, "Eiffel Tower")
  • a direct assign command with a specific position. In this case, the position is displayed without any animation.
    Example:
    // Centers the map displayed by the "MAP_Position" control
    // on a geographical location
    MyPosition is geoPosition
    MAP_Position = MyPosition
Managing advanced parameters (WEBDEV)
The following functions can be used with the Map controls
The WLanguage functions that can be used with the Map controls can be classified in several categories:
  • The functions used to manage the positions on the map:
    MapDisplayPositionCenters the map displayed in a Map control on a geographical position or on a specific location.
    MapGetPositionReturns the geographical position of the point located in the center of the map currently displayed in a Map control.
    MapInfoPositionReturns the coordinates (in pixels) of the point corresponding to a geographical position (latitude and longitude).
    MapInfoXYReturns the geographical position (latitude and longitude) corresponding to a point in a Map control.
  • The functions used to follow the movements of the device:
    MapEndOfMoveStops following the device movement in a Map control.
    MapFollowMovementDisplays the current location of the device in a Map control and updates the location as it moves.
  • The functions used to manage the markers on the map. These functions use the Marker variables to define the characteristics of these markers.
    MapAddMarkerAdds a new marker onto a map displayed in a Map control.
    MapDeleteAllDeletes the following from a Map control:
    • all markers,
    • all shapes,
    • all images.
    MapDeleteMarkerDeletes a marker from a map displayed by a Map control.
    MapModifyMarkerModifies a marker displayed in a Map control.
  • The functions used to manage the itineraries on the map.
    MapAddItineraryAdds an itinerary onto a Map control.
    MapDeleteItineraryDeletes an itinerary from a Map control.
  • The functions used to handle the additional options of the Google API for map management:
    MapConfigureGglAPIDeclares additional parameters for the Map control that will be transmitted to the Google API.
    MapExecuteJSRuns the native code of Google Maps API in a Map control in JavaScript.
    MapGetJSObjectReturns the instance of the API of Map control.

Remarks

  • WINDEV MapLicenseGgl allows you to specify the Google identifier required for using a Map control with the Google Map API for Work option. For more details, check the user license of Google Maps API.
  • Universal Windows 10 App MapLicenseBing is used to specify the Bing key required for using the Map control in an application in Universal Windows 10 app mode.
Properties specific to Map controls
The following properties are used to manage a Map control through programming:
MapModeReturns or modifies the display mode of the map in the Map control.
ValueUsed to center the map on the position corresponding to the specified geoPosition variable.
ZoomReturns or modifies the zoom level used to display the map.

For a complete list of WLanguage properties that can be used with a Map control, see Properties associated with Map controls.
Minimum version required
  • Version 17
This page is also available for…
Comments
Errors that may occur in Maps not working:
A) in the Google developer environment, a valid credit/debit card must be registered in the billing method of payment. If you do not have a card that has valid usage data, it may also give an error.
B) environment changes may be necessary to create new api key.
C) the api is not ok, because for the maps it has a
Different web and mobile apis, minus watching an updated tutorial.
D) ocorre erro também quando o WX (Windev, Webdev e Windev Mobile) esta desatualizado e usando a versão antiga do internet explorer. Solução mudei pra o google/edge.
E) informeo apikey válido do googlemaps.
Boller
30 Aug. 2023

Last update: 01/26/2023

Send a report | Local help