Solved

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

  • 5 November 2021
  • 3 replies
  • 119 views

Userlevel 3
Badge +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

icon

Best answer by brian.gummin 5 November 2021, 13:25

View original

3 replies

Userlevel 5
Badge +15

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?  

Userlevel 5
Badge +12

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

Userlevel 5
Badge +14

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