Hi,Is there any way or any component to getCurrent location in Traditional web app.I have been trying to use 'reactiveGeoLocation' and 'location plugin' but it seems there support is only forReactive and mobile apps.
I want to get the location and then plot it on the map.
Akif Arfien wrote:
Mahesh Manchala wrote:
Hi,
I believe that you wanted to get current location(lat and long). So this you can achieve through HTML5 Geolocation method.
Follow these steps :
1. Create a Webscreen
2. go to the sidebar javascript option and add this js code over there :
if (navigator.geolocation) {navigator.geolocation.getCurrentPosition(getPosition);} else {x.innerHTML = "Geolocation is not supported by this browser."; }
function getPosition(position) {var lat = position.coords.latitude;var long = position.coords.longitude;alert(lat +" and " + long); }
3. Now publish and check it.
Hi Mahesh,Thanks alot I am able to get the lat and long with the same method you suggested but could you please suggest me a way to plot those coordinates on the map?
Google has an API that can help you: https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding
Microsoft also has this functionality: https://docs.microsoft.com/en-us/bingmaps/rest-services/locations/find-a-location-by-point
Also try below code snippet:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(getPosition);
console.log('Testing1');
} else {
}
function getPosition(position) {
console.log('Testing'2);
'"+ Latitude +"'= position.coords.latitude;
'"+ Longitude +"'= position.coords.longitude;
Thanks Mahesh.. That's really a great help.
Hi Akif,
Have you seen this component-
https://www.outsystems.com/forge/component-overview/680/google-maps
It is for traditional application
Regards
Rahul Sahu
you are most welcome Akif
Hi Mahesh,
I want to use lat and long value of showPosition function into myFunction. How i can do that. please find the attach png file for reference.