- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 07:23 AM
My client uses the Locations table in order to provide a mapping of all servicable assets for our technicians. However, a new request has come in to be able to search for these locations based on the input of coordinates. They are asking to narrow down to locations nearest to inputted coordinates with maximum distance of 500 meters.
Is there a script that can help calculate distance and convert that to meters?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 08:44 AM
Check if this is helpful
https://stackoverflow.com/questions/5260423/torad-javascript-function-throwing-error
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 07:50 AM
Hi
Try Geolocation>Administration>geolocation properties.
you can set the maximum distance to 500 (it is defaulted in meters)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 08:00 AM
This doesn't quite answer my question for two reasons:
1) we use two different standards for this, as while we want to be able to search for locations within 500 meters, we already have code that auto assigns based on distance of 200 meters.
2) we are looking to filter a list of locations so that said list is limited to those within 500 meters. So the obvious approach would be to modify the reference but don't know how to filter the list based on coordinates.
Please advise.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 08:15 AM
You may activate the Geolocation plugin, which can help achieve this.
https://docs.servicenow.com/bundle/kingston-servicenow-platform/page/administer/geolocation/concept/c_Geolocation.html?cshalt=yes
You can then refer the client script on task table to build your code.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2018 09:04 AM
We already have the geolocation plugin turned on. Which is why we are using location tracking.
However as I said earlier, there is no logic to filter a location reference based on coordinates and output the logic into a list. I want to be able to input a longitude and latitude, then select a location (that also has longitude and latitude) based on those sets of coordinates. I therefore need a script include plugged into the reference definition but unsure how to convert the coordinates and determine if the location in question is within a 500 meter radius.