django-census-places

Import and utilize place boundaries provided by the United States Census
Download

django-census-places Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Adam Coddington
  • Publisher web site:
  • http://bitbucket.org/latestrevision/

django-census-places Tags


django-census-places Description

django-census-places is a Django app for utilizing city and place boundaries provided by the United States Census.IntroductionDo you have GPS data that you would like to populate with City & State information? This Django application allows you to import census-designated place shapefiles provided by the United States Census, and then utilize that data to find the city and state for any given point within the United States.UseFor a point named point, you can find which (if any) city or census designated place the point is within by finding which PlaceBoundary object overlaps this point, like:from census_places.models import PlaceBoundarytry: city = PlaceBoundary.objects.get( geog__covers=point )except PlaceBoundary.DoesNotExist: city = NoneSometimes, though, you might be in the uncivilized parts, and your point may not be within a census designated place; if you happen to be gathering data from places that might not be within a census designated place, you might have a desire to gather the nearest city to any given point:from census_places.models import PlaceBoundarydef get_nearest_city(point, buffer=0.1, buffer_interval=0.1, buffer_maximum=10): buffered_point = point.buffer(buffer) cities = PlaceBoundary.objects.filter(geog__bboverlaps=buffered_point)\ .distance(point)\ .order_by('distance') if cities.count() > 0: return cities else: buffer = buffer + buffer_interval if buffer : Download the specified state or protectorate's shapefile (or 'all' available shapefiles), and import the data into your application.Commandsimport_places < State/Protectorate Name|FIPS code|'all' >: Download the specified state or protectorate's shapefile (or 'all' available shapefiles), and import the data into your application.ExamplesIf you, perhaps, live in Portland, Oregon, and are using this application to identify the city name for any points gathered from Google Latitude or another service, you may desire to import data for only Washington and Oregon. To do that you would run:python manage.py import_places Oregonpython manage.py import_places WashingtonBut if you happen using this location information for data that could be from any state, you would instead run::python manage.py import_places allProduct's homepage


django-census-places Related Software