Pre-calculating is pretty expensive: 81939*81938/2 = 3,356,958,891 entries make 
a pretty big table. Calculating on the fly is probably not horribly expensive 
and you could calculate and save, thereby caching values which have been used 
before.

Anyway, geodjango might be what you need. Plus the info on the geodetic 
coordinates for each zip code of course.

hth

- Tom

> On Feb 16, 2021, at 8:27 PM, Ram <ram.mullap...@gmail.com> wrote:
> 
> Hi,
> 
> We've USA ZIP codes table with the following values. and we have a total of 
> 81,939 ZIP codes.
> 
> INSERT INTO pages_zip_code (id, zip, city, st) VALUES
> (1, '00501', 'Holtsville', 'NY'),
> (2, '00544', 'Holtsville', 'NY'),
> (3, '00601', 'Adjuntas', 'PR'),
> (4, '00602', 'Aguada', 'PR'),
> (5, '00603', 'Aguadilla', 'PR'),
> .......................................
> 
> We need to calculate the distance between each zip code and save the distance 
> value in table like "zip_codes_distance" with the following table columns
> 
> zip_codes_distance table
> id | from_zip | to_zip | distancev
> 
> We're looking for an appropriate library that might be available in 
> Python/Django to calculate the distance easily instead of using any API. We 
> know we can use Google's distance API with allowable requests, but we are 
> trying to see if any Python library out there that is capable of doing the 
> same calculation.
> 
> I would appreciate expert advice on this.
> 
> Best regards
> ~Ram
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CA%2BOi5F1-E-70zWo-8EPu0%2BrWD%2BCjFqZaCVaUEtbb9mRNKjpMNQ%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CA%2BOi5F1-E-70zWo-8EPu0%2BrWD%2BCjFqZaCVaUEtbb9mRNKjpMNQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6921E387-014E-4C71-AAB8-80295C7A5C5D%40gmail.com.

Reply via email to