877
Views
10
Comments
How to get google maps current location in web app?
Question

Hi Team,


I need some help to get google maps current location in web app browser.


Regards,

Naga

2018-07-03 08-33-54
Tiago Gafeira
Champion

Hi Naga,

You can try using HTML5 Geolocation feature to obtain the coordinates to use in the Google maps widget.


Cheers,

Tiago.

2024-03-25 06-19-08
Harlin Setiadarma

HTML5 Location will only works in HTTPS. 

2018-07-03 08-33-54
Tiago Gafeira
Champion

Harlin Setiadarma wrote:

HTML5 Location will only works in HTTPS. 

Don't see it as a problem nowadays.


2024-03-25 06-19-08
Harlin Setiadarma

Yup, it was just for info.

UserImage.jpg
Gautam sharma

Tiago Gafeira wrote:

Hi Naga,

You can try using HTML5 Geolocation feature to obtain the coordinates to use in the Google maps widget.


Cheers,

Tiago.

Hi Tiago Gafeira, I am not getting that how can I use this javascript code in Outsytems, Can you please explain to me how to use this HTML5 Geolocation in Outsystems in order to display the current location on the map in the Web application.

I have already implemented the map and the marker on it based on interest point.

2018-06-19 04-11-44
Nitesh Pandey

Gautam sharma wrote:

Tiago Gafeira wrote:

Hi Naga,

You can try using HTML5 Geolocation feature to obtain the coordinates to use in the Google maps widget.


Cheers,

Tiago.

Hi Tiago Gafeira, I am not getting that how can I use this javascript code in Outsytems, Can you please explain to me how to use this HTML5 Geolocation in Outsystems in order to display the current location on the map in the Web application.

I have already implemented the map and the marker on it based on interest point.

Hi Gautam 

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. 




UserImage.jpg
Gautam sharma

Nitesh Pandey wrote:

Gautam sharma wrote:

Tiago Gafeira wrote:

Hi Naga,

You can try using HTML5 Geolocation feature to obtain the coordinates to use in the Google maps widget.


Cheers,

Tiago.

Hi Tiago Gafeira, I am not getting that how can I use this javascript code in Outsytems, Can you please explain to me how to use this HTML5 Geolocation in Outsystems in order to display the current location on the map in the Web application.

I have already implemented the map and the marker on it based on interest point.

Hi Gautam 

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. 


Thank You so much @Nitesh  pandey




UserImage.jpg
Preeti Gupta

Nitesh Pandey wrote:

Gautam sharma wrote:

Tiago Gafeira wrote:

Hi Naga,

You can try using HTML5 Geolocation feature to obtain the coordinates to use in the Google maps widget.


Cheers,

Tiago.

Hi Tiago Gafeira, I am not getting that how can I use this javascript code in Outsytems, Can you please explain to me how to use this HTML5 Geolocation in Outsystems in order to display the current location on the map in the Web application.

I have already implemented the map and the marker on it based on interest point.

Hi Gautam 

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 Nitesh,

I want to get the current location of the user and pass it as origin address to the Map to create route.

How can I do that?

Please give me some idea.

Thanks,

Preeti

2020-09-21 08-42-47
Vincent Koning

Preeti Gupta wrote:

[… large wall of text .]


Hi Nitesh,

I want to get the current location of the user and pass it as origin address to the Map to create route.

How can I do that?

Please give me some idea.

Thanks,

Preeti

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


UserImage.jpg
Lovish Goyal

SyntaxEditor 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;
       
       }"


I have used this javascript in runjavascript action. Still the longitude and latitude value is not set. Please help me out

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.