[Web] Get Current Location

Hi, Is anyone know how to get current location using getCoordinate google maps ?

I have tried using HTML 5 Goodies Plugins., but I got an error : Error reading JToken from JsonReader. Path '', line 0, position 0.

What I have to do to resolve my problem ?

Best Regards,

Randy Ary P

Hi Randy,

Let me ask some questions:

  • You want to get the coordinates of your current location?
  • Or, you want to get the coordinates of a point in a map?




Hello Randy,

when you look in the forge https://www.outsystems.com/forge/component-discussions/507/HTML5+Goodies and then look at the discussion you will see that you are not the only one with this problem: https://www.outsystems.com/forums/discussion/16398/geolocation/

HTML5+ goodies comes with sample eSpace and in there you can see that getCoordinate is a webblock and a function that work togetter. Your error might be the result of only using the function. 

However to me It is also not clear how getCoordinate should work. When you look at the javascript that is used the function called is: navigator.geolocation.getCurrentPosition

More documentation on this function can be found: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition

Using the MDN documentation you can create your own function. For example: 

Create an action where you call: RunJavaScript, and then use the following script.

SyntaxEditor Code Snippet

function success(pos) {
  var crd = pos.coords;
  document.querySelector('[id$=LatitudeInput]').value = crd.latitude
document.querySelector('[id$=LongitudeInput]').value = crd.longitude ;

In this case the result is put in 2 input widgets (the name of the two widget are LatitudeInput and LongitudeInput). 

I hope this will help with your problem. 


Dear all, 

Thank you for your reply. I have resolved it. Thanks for your help. :)

Best Regards

Hey Randy,

I am also facing the same problem,

Error reading JToken from JsonReader. Path '', line 0, position 0.

I am not an expert in javascript, So can u please explain me how did you resolve that.