Skip to content

Instantly share code, notes, and snippets.

@andrewjennings
Created July 26, 2011 21:04
Show Gist options
  • Save andrewjennings/1108035 to your computer and use it in GitHub Desktop.
Save andrewjennings/1108035 to your computer and use it in GitHub Desktop.
Index: /projects/publicmapping/trunk/django/publicmapping/redistricting/models.py
===================================================================
--- /projects/publicmapping/trunk/django/publicmapping/redistricting/models.py (revision 1404)
+++ /projects/publicmapping/trunk/django/publicmapping/redistricting/models.py (working copy)
@@ -413,19 +413,19 @@
# Searching inside the boundary
if level != base_geolevel:
# Search by geometry
- q_geom = Q(geom__within=boundary)
+ q_geom = Q(geom__within=boundary.buffer(1))
else:
# Search by centroid
- q_geom = Q(center__intersects=boundary)
+ q_geom = Q(center__intersects=boundary.buffer(1))
results = Geounit.objects.filter(q_ids, q_geom)
else:
# Searching outside the boundary
if level != base_geolevel:
# Search by geometry
- q_geom = Q(geom__within=boundary)
+ q_geom = Q(geom__within=boundary.buffer(1))
else:
# Search by centroid
- q_geom = Q(geom__within=boundary)
+ q_geom = Q(geom__within=boundary.buffer(1))
results = Geounit.objects.filter(q_ids).exclude(q_geom)
if settings.DEBUG:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment