Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I use latitude and longitude values to find near by records

Hi community,

I have attached a sample QVW file that I need some direction on.  In the QVW file, I've loaded some sample retail account information for the San Francisco area.  What I would like to do is be able to search and select one (or more) stores/accounts and then have another chart (straight  table) display all the accounts that are within X distance from the selections.

Does anybody know how to do this?  I have the latitude and longitude information for each account as part of the sample data.

Location question.jpg

18 Replies
Not applicable
Author

Hi mpejskar,

I've been trying to do exactly this for my build.

At the moment I have a Google Maps extension on my screen which pin points any company that is selected onto the map.

I also have a table which shows the surrounding companies of the selected company.

What I am trying to achieve is to also have the surrounding companies show up on the map.

Would you be able to provide any insight into how you went in achieving this?

Is it a matter of altering the Google maps expressions?

Any help on this matter will be greatly appreciated.

Tony.

Not applicable
Author

Hi Mike, May I know how did you capture the latitude and logitude information for each account here?

Not applicable
Author

Hey Tony,

I think I'm trying to do just what you do. Would you mind uploading your qvw document or send it to me? I'd be thankful.

Thanks,

Netanel

Not applicable
Author

Hi Swuehl,

I am trying to implement your logic in script level, but in my case I have lack of data if I do outer join it's going to hang stage and even computer takes 100% memory and system is going to hang.

In my scenario I have to give radius dynamically for pickup city & Delivery city in the two separate input boxs.

kindly suggest me some alternative solution.

Thanks,

Ashok.

swuehl
MVP
MVP

You would need to give some more details about your setting to understand the difference between yours and the one discussed here.

And why do you use two input boxes (two radii) for the two cities? Are you trying to find other cities that are located in the intersecting area?

Not applicable
Author

Hi

I have latitude and longitude for both pick up city and delivery city, and the scenario is I need to calculate radius for both pickup and delivery & both radius should change dynamically.. so how shall I proceed wid this.

swuehl
MVP
MVP

Sorry, I don't understand how you want to calculcate the radius.

I would suggest that you create a new thread, and post as much information as possible:

Your current data model, some sample lines of data, your current chart and your expected result for the sample data.

Not applicable
Author

Hi Swuehl,

As u provided formula for km is below one

atan2(sqrt(sqr(sin((only({1}Latitude)*PI()/180-vLat1)/2))+cos(vLat1)*cos(only({1}Latitude)*PI()/180)*sqr(sin((only({1}Longitude)*PI()/180-vLon1)/2)))

      ,sqrt(1-(sqr(sin((only({1}Latitude)*PI()/180-vLat1)/2))

              +cos(vLat1)*cos(only({1}Latitude)*PI()/180)*sqr(sin((only({1}Longitude)*PI()/180-vLon1)/2)))))*2*6371

My requirement is user will enter miles instead of kilometers,so what should i do change in above formula.

Thanks,

Ashok.

Not applicable
Author

Hi Stefan,

I have data a below, i want to calculate the distance using latitude and longitude, please help me out.

I tried the way you did but by distance in expression is showing zero

Please help me out wite below link

Calculating distance using Latitude and Longitude

   

employeidnamestateDistrictLatitudeLongitude
1johnasdnewyork22.37114.12
2rickyadsdcarolina22.36114.13
3patrikaffdfWDC22.32114.21
4michealagffsfLondon22.32114.16
5harryaddsdsdfsHong Kong22.28114.18