isladogs
MVP / VIP
- Local time
- Today, 16:20
- Joined
- Jan 14, 2017
- Messages
- 18,578
This is another of my 'unusual' questions.
Can current location data (latitude/longitude) be extracted using VBA?
I feel I should already know how to do this ... but its eluding me :banghead:
Background:
A recent thread by Dick7Access was asking how to get exact location using GPS for an unusual reason
See https://www.access-programmers.co.uk/forums/showthread.php?t=299459
The suggestion was to use one of the many phone apps e.g. LatLong (for iPhone)
This got me thinking about ways of pulling the geolocation data that many Windows 8 & 10 devices can obtain (providing users give permission)
Both my laptop & Windows tablet can obtain this info accurately
My desktop just gets the approximate location specified by my IP address (approx 100 miles from me) though I can specify the actual location manually
This info (accurate or otherwise) can be displayed using various free apps from the Microsoft Store such as Geolocator & SensorList:
What I want to do is use VBA to extract this geolocation data in Access rather than type it in manually
The geolocation is then used to get the nearest postcodes
However I'm getting nowhere with doing this using code
My only ideas so far are to try & adapt GetElementByID HTML code - see https://www.w3schools.com/html/html5_geolocation.asp
or adapt Windows UWP code - see https://docs.microsoft.com/en-us/uwp/api/Windows.Devices.Geolocation
Can anyone help me get this info using VBA?
Can current location data (latitude/longitude) be extracted using VBA?
I feel I should already know how to do this ... but its eluding me :banghead:
Background:
A recent thread by Dick7Access was asking how to get exact location using GPS for an unusual reason
See https://www.access-programmers.co.uk/forums/showthread.php?t=299459
The suggestion was to use one of the many phone apps e.g. LatLong (for iPhone)
This got me thinking about ways of pulling the geolocation data that many Windows 8 & 10 devices can obtain (providing users give permission)
Both my laptop & Windows tablet can obtain this info accurately
My desktop just gets the approximate location specified by my IP address (approx 100 miles from me) though I can specify the actual location manually
This info (accurate or otherwise) can be displayed using various free apps from the Microsoft Store such as Geolocator & SensorList:
What I want to do is use VBA to extract this geolocation data in Access rather than type it in manually
The geolocation is then used to get the nearest postcodes
However I'm getting nowhere with doing this using code
My only ideas so far are to try & adapt GetElementByID HTML code - see https://www.w3schools.com/html/html5_geolocation.asp
Code:
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
Can anyone help me get this info using VBA?