Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 217083

Calculate nearest points by geographical coordinates

$
0
0

Hello!

 

I have two tables. Table "Customers address" with my customers id, latitude and longitude (8 mln rows). And "Shop_table" with my shops id, latitude and longitude (500 rows).

 

The goal is to find the nearest shop to each of my customers. Fortunatly, I also have column "city" in both my tables. And fortunatly I know the formula to calculate the distance between two geographical points.

 

I take table  "Customers address" and make Table.NestedJoin with "Shop_table" by column "city". And expand it. After that I add column "Distance" with formula distance calculation . Finaly, I make Table.Group and calculate the minimal distance for each customer id.

 

But it takes a lot of time. Could you advise me a better way?

 

Dmitry


Viewing all articles
Browse latest Browse all 217083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>