Esempio n. 1
0
 def test_float_output(self):
     """
     Test case for a floating point output.
     """
     self.assertAlmostEqual(units.km_to_meters(0.5001),
                            500.1,
                            delta=0.00000001)
Esempio n. 2
0
 def get_radius(self):
     """
     Returns a Location based on the object's radius.
     """
     return Location(geom=self.centroid,
                     buffer_m=units.km_to_meters(self.radius_km),
                     name=self.name + '-radius',
                     created_by=self.created_by)
Esempio n. 3
0
 def factor_by_radius_km(self, radius_km):
     """
     Takes a Location and a radius in kilometers. Returns a list of Locations
     representing circles of the specified radius that together cover the
     area of the original Location.
     """
     assert self.shape != 'Other', 'Shape must be Point, Polygon, or ' + \
                                   'Muiltpolygon'
     polygon = self.bbox
     points = shapes.factor_polygon_into_circles(polygon, radius_km)
     radius = units.km_to_meters(radius_km)
     return [self._create_radius(point, radius) for point in points]
Esempio n. 4
0
 def test_10_kilometers(self):
     """
     Test case for 10 kilometers.
     """
     self.assertEqual(units.km_to_meters(10), 10000)
Esempio n. 5
0
 def test_0_kilometers(self):
     """
     Test case for 0 kilometers.
     """
     self.assertEqual(units.km_to_meters(0), 0)