]> gitweb.michael.orlitzky.com - dead/census-tools.git/commitdiff
Fixed the Block class initialization so that it converts intptlat/intptlon to real...
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 12 Sep 2009 22:37:45 +0000 (18:37 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 12 Sep 2009 22:37:45 +0000 (18:37 -0400)
src/SummaryFile1.py

index bfc62582f2d80db6c9b96f6d57b8386838d4e065..d646b07e70df62fd9bc0c7d478626840fe91ab7d 100644 (file)
@@ -45,9 +45,19 @@ class Block:
         self.arealand = float(geo_record.arealand)
         self.areawatr = float(geo_record.areawatr)
 
+        # Both latitude and longitude are given to six digits of
+        # precision (i.e. after the decimal point). But, there are no
+        # decimal points in the intptlon/intptlat fields, so we need
+        # to add them.
+        #
+        # By default, the coordinates will be parsed as integers. For
+        # example, +12345678 will be parsed as 12345678.0. So, we need
+        # to "move" that decimal point 6 places to the left. We know
+        # how to do that.
+        #
         self.coordinates = GPS.Coordinates()
-        self.coordinates.latitude = float(geo_record.intptlat)
-        self.coordinates.longitude = float(geo_record.intptlon)
+        self.coordinates.latitude = (float(geo_record.intptlat) / (10**6))
+        self.coordinates.longitude = (float(geo_record.intptlon) / (10**6))
 
 
     def tiger_blkidfp00(self):