PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Managing locks
  • Browsers allowing the geolocation
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Retrieves information about the current device position.
Versions 16 and later
WEBDEV - Browser code This function is now available in Browser code.
New in version 16
WEBDEV - Browser code This function is now available in Browser code.
WEBDEV - Browser code This function is now available in Browser code.
Versions 22 and later
Windows This function is now available for the WINDEV applications.
New in version 22
Windows This function is now available for the WINDEV applications.
Windows This function is now available for the WINDEV applications.
Example
MyPosition is geoPosition
MyPosition = GPSGetPosition()
// Checks the position validity with ErrorOccurred
IF ErrorOccurred THEN RETURN
Info(" Latitude : " + MyPosition..Latitude) 
Info(" Longitude : " + MyPosition..Longitude)
Versions 16 and later
WEBDEV - Browser code
// Geolocation from WEBDEV, a browser procedure is called.
// Process performed from a button whose action is "none"
GPSGetPosition(BrowserProc, 200)
// "BrowserProc" browser procedure
PROCEDURE BrowserProc(MyPosition is geoPosition, nMyError is int)
 
SWITCH nMyError
 
CASE gpsErrorOK
// No error was detected
PAGE_Page1.EDT_NoName1 = MyPosition..Altitude + " " + ...
MyPosition..Longitude
CASE gpsErrorRights
PAGE_Page1.EDT_NoName1 =  ...
"The browser has no sufficient rights " + ...
"to use the geolocation (or non-HTTPS site)."
CASE gpsErrorPosition
PAGE_Page1.EDT_NoName1 = "Unable to define the position " + ...
"(internal error of provider for example)."
CASE gpsErrorTimeout
PAGE_Page1.EDT_NoName1 =  ...
"The position was not retrieved " + ...
" within the alloted time."
OTHER CASE
PAGE_Page1.EDT_NoName1 = "Undefined error"
END
New in version 16
WEBDEV - Browser code
// Geolocation from WEBDEV, a browser procedure is called.
// Process performed from a button whose action is "none"
GPSGetPosition(BrowserProc, 200)
// "BrowserProc" browser procedure
PROCEDURE BrowserProc(MyPosition is geoPosition, nMyError is int)
 
SWITCH nMyError
 
CASE gpsErrorOK
// No error was detected
PAGE_Page1.EDT_NoName1 = MyPosition..Altitude + " " + ...
MyPosition..Longitude
CASE gpsErrorRights
PAGE_Page1.EDT_NoName1 =  ...
"The browser has no sufficient rights " + ...
"to use the geolocation (or non-HTTPS site)."
CASE gpsErrorPosition
PAGE_Page1.EDT_NoName1 = "Unable to define the position " + ...
"(internal error of provider for example)."
CASE gpsErrorTimeout
PAGE_Page1.EDT_NoName1 =  ...
"The position was not retrieved " + ...
" within the alloted time."
OTHER CASE
PAGE_Page1.EDT_NoName1 = "Undefined error"
END
WEBDEV - Browser code
// Geolocation from WEBDEV, a browser procedure is called.
// Process performed from a button whose action is "none"
GPSGetPosition(BrowserProc, 200)
// "BrowserProc" browser procedure
PROCEDURE BrowserProc(MyPosition is geoPosition, nMyError is int)
 
SWITCH nMyError
 
CASE gpsErrorOK
// No error was detected
PAGE_Page1.EDT_NoName1 = MyPosition..Altitude + " " + ...
MyPosition..Longitude
CASE gpsErrorRights
PAGE_Page1.EDT_NoName1 =  ...
"The browser has no sufficient rights " + ...
"to use the geolocation (or non-HTTPS site)."
CASE gpsErrorPosition
PAGE_Page1.EDT_NoName1 = "Unable to define the position " + ...
"(internal error of provider for example)."
CASE gpsErrorTimeout
PAGE_Page1.EDT_NoName1 =  ...
"The position was not retrieved " + ...
" within the alloted time."
OTHER CASE
PAGE_Page1.EDT_NoName1 = "Undefined error"
END
Syntax
WEBDEV - Browser code

Retrieving the information in browser code Hide the details

GPSGetPosition([<Procedure name> [, <Timeout>]])
<Procedure name>: Character string (with or without quotes)
Name of WLanguage procedure in browser code ("callback") called when the position is retrieved.
This procedure has the following format:
PROCEDURE <Procedure name>(<Position>,<Error>)
where:
  • <Error> is an Integer constant corresponding to the error code and that can take the following values:
    gpsErrorOKNo error was detected.
    gpsErrorRights
    • The browser has no sufficient rights to use geolocation.
    • The browser is recent and the site is not using the HTTPS secure protocol.
    gpsErrorPositionUnable to define the position (internal error of provider for example).
    gpsErrorTimeoutThe position could not be retrieved within the timeout.
<Timeout>: Optional integer or optional Duration
Maximum timeout (in hundredths of a second) for updating the device position.
  • If this timeout ends before the device position is updated, gpsErrorTimeOut is returned in the <Error> parameter of the WLanguage procedure.
  • If this parameter is not specified, the timeout is set to 1 minute.
Note: This parameter can correspond to:
  • an integer corresponding to the number of hundredths of a second,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (1 s or 10 ms for example).
    New in version 23
    the direct indication of duration (1 s or 10 ms for example).
    the direct indication of duration (1 s or 10 ms for example).
Remarks

Managing locks

GPSGetPosition is a locking function until the current device position was retrieved or until the timeout defined by the <Timeout> parameter has expired.
If the function is called in the main thread of the application, an hourglass will be displayed during the function execution. The message displayed by the hourglass can be specified via the <Message> parameter.
Otherwise, the execution of secondary thread will be locked during the function execution and no hourglass will be displayed.
WEBDEV - Browser code This function is not locking.
Note: To find out the last known device position without timeout, use GPSLastPosition. Caution, the positioning information that was retrieved may not correspond to the current device position if the device was moved while the GPS signal was not valid for example. To find out the date and time at which the position was calculated, use the ..MeasurementDate property of the geoPosition variable.
WEBDEV - Browser code

Browsers allowing the geolocation

Caution: The geo-localization is available for the most recent browsers only:
  • FireFox from version 3.5,
  • Chrome from version 5.0.342.1,
  • Opera from version 10.6,
  • Safari from version 5.0.
During the call to a geo-localization function, the browser requests the authorization to localize.
Note: From Chrome 50 (including on Android), GPSGetPosition can only be used on the sites secured via an SSL certificate for example. If the site is not secured, the function returns a result that cannot be used. During the test in local (localhost), the function operates properly.
Component : wd240java.dll
Minimum version required
  • Version 15
This page is also available for…
Comments
Video GpsGetPosition
https://youtu.be/4MqAx_qiFts

https://windevdesenvolvimento.blogspot.com/2019/01/dicas-1987-windev-mobile-dicas-14.html
amarildo
16 Jan. 2019
GPS Functions
https://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/519-busca-endereco-rota-endereco-das-coordendas-523/read.awp?hl=enderecodascoordenadas

https://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/2875-informatica-exemplo-google-maps-com-json-retornando-distancia/read.awp?lastview
BOLLER
10 Nov. 2018
Video Trajeto Mapa
https://youtu.be/bSk0ysOlacE
amarildo
03 Nov. 2018