Ejemplo n.º 1
0
 def test_multipoint_geojson(self):
     expected = {
         "coordinates": [[-155.5, 19.6], [-156.2, 20.7], [-157.9, 21.4]],
         "type": "MultiPoint"
     }
     mp = geo.MultiPoint([[-155.5, 19.6], [-156.2, 20.7], [-157.9, 21.4]])
     self.assertEqual(sorted(json.dumps(expected)), sorted(mp.geojson()))
Ejemplo n.º 2
0
 def test_multipoint_to_dict(self):
     expected = {
         "coordinates": [[-155.5, 19.6], [-156.2, 20.7], [-157.9, 21.4]],
         "type": "MultiPoint"
     }
     mp = geo.MultiPoint([[-155.5, 19.6], [-156.2, 20.7], [-157.9, 21.4]])
     self.assertEqual(expected, mp.to_dict())
Ejemplo n.º 3
0
 def test_building_multipoints(self):
     the_dict = {"coordinates": [[-155.5, 19.6], [-156.2, 20.7], [-157.9, 21.4]],
                 "type": "MultiPoint"}
     expected = geo.MultiPoint([[-155.5, 19.6], [-156.2, 20.7], [-157.9, 21.4]])
     result = geo.GeometryBuilder.build(the_dict)
     self.assertIsInstance(result, geo.MultiPoint)
     self.assertEqual(expected.latitudes.sort(), result.latitudes.sort())
     self.assertEqual(expected.longitudes.sort(), result.longitudes.sort())
Ejemplo n.º 4
0
 def test_multipoint_from_points(self):
     expected = geo.MultiPoint([(34, -56.3), (35, 8), (36, 12)])
     list_of_points = [
         geo.Point(34, -56.3),
         geo.Point(35, 8),
         geo.Point(36, 12)]
     result = geo.MultiPoint.from_points(list_of_points)
     self.assertIsInstance(result, geo.MultiPoint)
     self.assertEqual(expected.as_dict(), result.as_dict())
Ejemplo n.º 5
0
 def test_multipoint_properties(self):
     expected_longitudes = [-155.5, -156.2, -157.9]
     expected_latitudes = [19.6, 20.7, 21.4]
     mp = geo.MultiPoint([[-155.5, 19.6], [-156.2, 20.7], [-157.9, 21.4]])
     self.assertEqual(expected_longitudes, mp.longitudes)
     self.assertEqual(expected_latitudes, mp.latitudes)