Get Current Latitude Longitude
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 02:51 PM
Hi,
Can we get the current position latitude and longtude through scripts?
I can see geolocation is getting the current location, but i need to get lat long through script
Any idea?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 05:19 PM
If you'll be doing it through a client script or client controller on the service portal, you can use the HTML5 geolocation API. Even Internet Explorer supports it. Just a note, the users will be prompted that the page is trying to access their location. If you do it in a client script, you'll want to view the client script in list view and set "isolate scope" to false so you'll have access to the dom.
You can open f12 tools in your browser and paste the following script into the console to try it out.
function showPosition(position) {
console.log("Latitude: " + position.coords.latitude);
console.log("Longitude: " + position.coords.longitude);
}
(function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
console.log("Geolocation is not supported by this browser.");
}
}())
I found the above information here:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 09:34 PM
Hi Faizeal,
I have found one Article that might help you get solution for the same.
I have share the link please go through that.
To get latitude, longitude,timezone and UTC offset on the basis of location address
Regards,
Priyanka A.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 05:52 AM
I saw this article, in that we need to pass street name to get the lat long, without street name as parameter, is possible to get lat long?.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2020 06:56 AM
Try the below link
Geo Locating for Latitude and Longitude
Mark helpful or correct based on impact.
Regards,
Priyanka A.