Written by James Date : 10/27/2009 11:48 a.m.
There are also a few options to help you filter the results should you be in a contract-heavy area like DC, it is possible to filter by amount or search by name if you’re trying to find larger contracts or contracts for a certain nearby recipient.
This data is taken from the recovery.gov Where Is The Money Going? map which provides a KML file containing all recipient reported Contracts. As of October 30th this data will be updated with the final contract, grants, and loans.
How We Made It
If you’re a developer you might be interested in how we made this. Fortunately Layar makes it quite easy and we’ve taken a further step to make it even easier if you’re already using Django.
The first step was just a quick script to load the data from this KML file into a PostGIS database. Once the data was in a database I developed a reusable Django application that makes it easy to serve data in the format that Layar expects. The reusable Django application we’ve made available as django-layar.
If you want to see the specific usage of django-layar that powers this particular layer it is short and simple:
from django.contrib.gis.geos import Pointfrom django.contrib.gis.measure import Dfrom django.contrib.humanize.templatetags.humanize import intcommafrom layar import POI, LayarViewfrom recovery.models import AwardSiteclass RecoveryLayarView(LayarView):def get_recoverygov_queryset(self, latitude, longitude, radius,search_query, slider_value, **kwargs):qs = AwardSite.objects.filter(location__distance_lt=(Point(longitude, latitude),D(m=radius)))if slider_value:qs = qs.filter(amount__gte=float(slider_value))if search_query:qs = qs.filter(name__icontains=search_query)return qsdef poi_from_recoverygov_item(self, item):return POI(id=item.id, lat=item.location.y, lon=item.location.x, title=item.name,line2='Amount: $%s' % intcomma(item.amount), line3='Distance: %distance%')recovery_layar = RecoveryLayarView()