Skip to content

temperatio/django-cities

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

django-cities - Place models and data for Django apps
=====================================================

This project includes country, region, city, and district models and is
prepopulated with data from GeoNames. The GeoNames import script
is also included if you'd like to re-import the data yourself, or change
the way in which it gets cleaned up.

Includes 234 counties, 2,610 regions, 97,949 cities and 606 districts

For more information and examples see http://www.coderholic.com/django-cities-countries-regions-cities-and-districts-for-django/

Examples:
=========
Finding all London boroughs:

>>> london = City.objects.filter(country__name='United Kingdom').get(name='London')
>>> boroughs = District.objects.filter(city=london)

Nearest city to a given lat,lon:

>>> City.objects.nearest_to(51, 1)
<City: Dymchurch, Kent, United Kingdom>

5 Nearest cities to London:

>>> london = City.objects.filter(country__name='United Kingdom').get(name='London')
>>> nearest = City.objects.distance(london.location).exclude(id=london.id).order_by('distance')[:5]

About

Countries and cities of the world for Django projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published