Searching locations based on coordinates.

tahnalos
Kilo Sage

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?

1 ACCEPTED SOLUTION

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.

View solution in original post

10 REPLIES 10

tahnalos
Kilo Sage

I have a more significant question:

 

Does ServiceNow support Math libraries?  Do I need to include them in my script include?

See here for what I am trying to do:

https://www.movable-type.co.uk/scripts/latlong.html

Bump.  Does anyone know how to include the math library in Javascript for ServiceNow Script Include?

Thanks

Yes. ServiceNow supports math library. You dont need to include it. The calculation there in the link should work.


Please mark this response as correct or helpful if it assisted you with your question.

It doesn't.  Tracking the result of the toRadians function returns undefined.

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.