Skip to content
Browse files

Tweaked the set_polygons function so the SRID is right from the get-go.

  • Loading branch information...
1 parent 8c98274 commit ad634609ffb771c11e8bba62afc3067228363125 @palewire palewire committed Dec 14, 2010
Showing with 6 additions and 4 deletions.
  1. +4 −3 us_counties/load.py
  2. +2 −1 us_counties/models.py
View
7 us_counties/load.py
@@ -133,15 +133,16 @@ def extras():
obj.slug = u'%s-%s' % (slugify(obj.full_name), slugify(obj.state))
# .. the full set of polygons...
obj.set_polygons()
+ obj.set_simple_polygons()
# ... the square miles ...
obj.square_miles = obj.get_square_miles()
# ... save the changes ...
obj.save()
# ... and then loop again to set the simple polygons to avoid a weird bug
# I've had when I do them right after the polygons.
- for obj in queryset_iterator(County.objects.all()):
- obj.set_simple_polygons()
- obj.save()
+# for obj in queryset_iterator(County.objects.all()):
+# obj.set_simple_polygons()
+# obj.save()
def queryset_iterator(queryset, chunksize=100):
View
3 us_counties/models.py
@@ -126,8 +126,9 @@ def set_polygons(self, canonical_srid=4269):
# Update the rest of the fields
srid_list.remove(canonical_srid)
for srid in srid_list:
+ copy = canonical_data.transform(srid, clone=True)
this_field = 'polygon_%s' % str(srid)
- setattr(self, this_field, canonical_data)
+ setattr(self, this_field, copy)
return True
def set_simple_polygons(self, tolerance=500):

0 comments on commit ad63460

Please sign in to comment.
Something went wrong with that request. Please try again.