stringfellow / mongo-cities Goto Github PK
View Code? Open in Web Editor NEWThis project forked from lecs/mongo-cities
Countries and cities of the world for Django projects
License: MIT License
This project forked from lecs/mongo-cities
Countries and cities of the world for Django projects
License: MIT License
mongo-cities - Place models and data for MongoEngine ==================================================== Based on the django-cities project by Ben Dowling. - models: the models part has been migrated to use MongoEngine - fixtures_to_mongo: a little management command imports the fixtures provided within the project. The data is originally provided by GeoNames: - http://download.geonames.org/export/dump/countryInfo.txt - http://download.geonames.org/export/dump/admin1CodesASCII.txt - http://download.geonames.org/export/dump/cities1000.zip Includes 234 counties, 2,610 regions, 97,949 cities and 606 districts For more information and examples regarding the original django-cities see http://www.coderholic.com/django-cities-countries-regions-cities-and-districts-for-django/ Importing the fixtures: ======================= Import everthing >>> ./manage.py fixtures_to_mongo Import all objects for Luxembourg and Liechtenstein >>> ./manage.py fixtures_to_mongo LU,LI Querying: ========= Finding all London boroughs: >>> uk = Country.objects.get(code='GB') >>> london = City.objects.get(name='London', country=uk) >>> boroughs = District.objects.filter(city=london) Nearest city to a given lon, lat: >>> lonlat = ((51, 1)) >>> City.nearest(lonlat) <City: Dymchurch, Kent, United Kingdom> Distance of Berlin to a given lat, lon: >>> berlin = City.objects.get(name='Berlin') >>> lonlat_of_NY = ((-73.96751403808594, 40.78054143186031)) >>> berlin.distance_to(lonlat_of_NY) 6384.579236572246 Distance of Berlin to London: >>> berlin.distance_to(london) 932.8145043305717 5 Nearest cities to London: >>> City.near(london.location).filter(id__ne=london.id).order_by('distance')[:5]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.