Geolocation , i am not able to get latitude and longitude value

I create a button and map component, when i click on the button get the live location latitude values and longitude values and it map to the live location.
self.session.props.geolocation.enabled=true //getting latitude value //getting latitude value
self.getSibling(“Map”) //assign values to latitudee
self.getSibling(“Map”) //assign values to longitude and the
location is so in the map

whats not working, any logs / errors?
does your device have geolocation…
did you accept the prompt/granted permission?

I am not able to get latitude and longitude values. Geolocation is enable. I not get any popup for grant permission. In the button instead of getting live location, i give the latitude and longitude values it will map and show that location in map. //getting latitude value //getting latitude value
If the value is store in the a and b latitude and longitude values, the module is work fine.

Is there any script for getting latitude and longitude values of current location

You should turn this on in a different location. As it prompts the user to click something so this should happen before centering the map. (unless you are looping through it i guess)

you will have to check your browser if it allowes geolocation, This might be somewhere else in the settings turned off to.

The geolocation is turned on only, I think it may be code issue think so. Is there any way to get latitude and longitude values. Any script related this.

the session props are the way to get the lat and lng.

But actualy what you are doing wont actually work anyways cuz you are setting up the “init” of the map, so it want “move” to it when you press the button.

you should bind the init values to the session props and set the location to true from the start

I already try that one but its not getting lat and long values, if it is get means when click on the button, i bind the values to map

im getting the values no problem so its probaly your device/browser that is blocking geolocation

can u send the script, that you write in the button

	lat =
	lng =


works fine in chrome after enabling location. there really isnt much that can go wrong with the script xd

okay thank you, I dont know why its not working on my script.

because its not the script but your security settings.
location can get blocked (else every website can track your location without permission… or atleast make it harder to track you cuz they can track you anyways but eh xd)

yes, I looking in every settings but i am not able to find where the issue is.

what are you using to try it out? chrome? on windows or an andoird? apple?

I am trying in chrome as well as android, it asking allow the location too

I allow the location till, its not working

then what is the problem? after that it should work

your script in the button wont do anything tho, setting the init values after the map already has been loaded does nothing.. like i said, bind them to the init props of the map

yeah its now working , i try it in android. Thank you bro

1 Like

I cleared the cache memory and i execute, its working fine now. Thank you victordcq

1 Like