예제 #1
0
 def test_from_linestring(self):
     line = LineString(((1.0, 2.0), (3.0, 4.0)))
     copy = LineString(line)
     self.assertEqual(len(copy.coords), 2)
     self.assertEqual(copy.coords[:], [(1.0, 2.0), (3.0, 4.0)])
     self.assertEqual('LineString',
                      lgeos.GEOSGeomType(copy._geom).decode('ascii'))
예제 #2
0
 def test_from_linearring(self):
     coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)]
     ring = LinearRing(coords)
     copy = LineString(ring)
     self.assertEqual(len(copy.coords), 4)
     self.assertEqual(copy.coords[:], coords)
     self.assertEqual('LineString',
                      lgeos.GEOSGeomType(copy._geom).decode('ascii'))
예제 #3
0
 def test_from_linestring_z(self):
     coords = [(1.0, 2.0, 3.0), (4.0, 5.0, 6.0)]
     line = LineString(coords)
     copy = LineString(line)
     self.assertEqual(len(copy.coords), 2)
     self.assertEqual(copy.coords[:], coords)
     self.assertEqual('LineString',
                      lgeos.GEOSGeomType(copy._geom).decode('ascii'))
예제 #4
0
 def test_linearring_from_unclosed_linestring(self):
     coords = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 0.0)]
     line = LineString(coords[:-1])  # Pass in unclosed line
     ring = LinearRing(line)
     self.assertEqual(len(ring.coords), 4)
     self.assertEqual(ring.coords[:], coords)
     self.assertEqual('LinearRing',
                      lgeos.GEOSGeomType(ring._geom).decode('ascii'))
예제 #5
0
    def test_from_multilinestring_z(self):
        coords1 = [(0.0, 1.0, 2.0), (3.0, 4.0, 5.0)]
        coords2 = [(6.0, 7.0, 8.0), (9.0, 10.0, 11.0)]

        # From coordinate tuples
        ml = MultiLineString([coords1, coords2])
        copy = MultiLineString(ml)
        self.assertIsInstance(copy, MultiLineString)
        self.assertEqual('MultiLineString',
                         lgeos.GEOSGeomType(copy._geom).decode('ascii'))
        self.assertEqual(len(copy.geoms), 2)
        self.assertEqual(dump_coords(copy.geoms[0]), coords1)
        self.assertEqual(dump_coords(copy.geoms[1]), coords2)