Skip to main content
Solved

How to calculate the shortest distance between two geo code positions in mobile client

  • November 5, 2021
  • 3 replies
  • 129 views

Forum|alt.badge.img+6

Hi All,

I have to compare the distance  between task geocode(lat,long) and place(lat,long). Based on the distance( let’s say 300mtr) I need to enable one user_def field. Can anyone help me on this. 

Is there any out of box feature available? Can anyone help me on this?

 

Thanks & Regards

Rajat

Best answer by brian.gummin

I am fairly sure there is no baseline feature for this within the mobile client.  Unless someone can figure out an extremely clever way to do this with client scripting?  

View original
Did this topic help you find an answer to your question?

3 replies

brian.gummin
Hero (Employee)
Forum|alt.badge.img+15
  • Hero (Employee)
  • 161 replies
  • Answer
  • November 5, 2021

I am fairly sure there is no baseline feature for this within the mobile client.  Unless someone can figure out an extremely clever way to do this with client scripting?  


SanjeewaJ
Superhero (Employee)
Forum|alt.badge.img+12
  • Superhero (Employee)
  • 89 replies
  • November 8, 2021

Hi @TatRajatM

As Brian confirmed there is no straight forward approach to do a location comparison only with configs (Client scripts). For a customer, who really needed similar functionality, we did a mobile code level customization. (Mobile Geo Fencing)

Regards,
Sanjeewa


AdrianEgley
Hero (Customer)
Forum|alt.badge.img+14
  • Hero (Customer)
  • 169 replies
  • November 9, 2021

Hi @TatRajatM,

 

Not sure if this would help, but some SQL scripting we have used in the past to compare our location to a customer location for distance.

 

DECLARE @orig_lat DECIMAL(12, 9)
DECLARE @orig_lng DECIMAL(12, 9)
SET @orig_lat=(select address_geocode_lat from place_address_view where place_id = 'TN2') 
set @orig_lng=(select address_geocode_long from place_address_view where place_id = 'TN2')

DECLARE @orig geography = geography::Point(@orig_lat, @orig_lng, 4326);

SELECT 
    @orig.STDistance(geography::Point(a.geocode_lat, a.geocode_long, 4326))/1000 
       AS distance
--INTO #includeDistances
FROM address as a 
where address_id = '4629156'
 

Maybe a chance to do something on database level to get those values. I believe this defaults to straight line distance in KM’s.

 

Ady


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings