Permalink
Browse files

mapit_import: show a percentage representing change in the boundaries

When --verbose is specified, this will also show the percentage
difference between (a) the area of the symmetric difference
between the old boundary and the new boundary and (b) the area
of the old boundary.  This is a reasonable indication of how
much an area with the same name / code has changed from one
generation to the next.
  • Loading branch information...
1 parent 804d1a7 commit c86ef0e38f0f31e4da9ebd3e81d7183d98e30c13 @mhl mhl committed Jan 15, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 mapit/management/commands/mapit_import.py
@@ -220,6 +220,8 @@ def verbose(*args):
previous_geos_geometry = previous_geos_geometry.simplify(tolerance=0)
new_geos_geometry = g.geos.simplify(tolerance=0)
create_new_area = not previous_geos_geometry.equals(new_geos_geometry)
+ p = previous_geos_geometry.sym_difference(new_geos_geometry).area / previous_geos_geometry.area
+ verbose(" change in area is:", "%.03f%%" % (100 * p,))
if create_new_area:
verbose(" the area", m, "has changed, creating a new area due to --preserve")
else:

0 comments on commit c86ef0e

Please sign in to comment.