Exemple #1
0
def test_set_coords_mixed_dimension(include_z):
    geoms = np.array([point, point_z], dtype=object)
    coords = get_coordinates(geoms, include_z=include_z)
    new_geoms = set_coordinates(geoms, coords * 2)
    if include_z:
        # preserve original dimensionality
        assert not shapely.has_z(new_geoms[0])
        assert shapely.has_z(new_geoms[1])
    else:
        # all 2D
        assert not shapely.has_z(new_geoms).any()
Exemple #2
0
 def z(self):
     """Return z coordinate."""
     if not shapely.has_z(self):
         raise DimensionError("This point has no z coordinate.")
     # return shapely.get_z(self) -> get_z only supported for GEOS 3.7+
     return self.coords[0][2]
Exemple #3
0
 def has_z(self):
     """True if the geometry's coordinate sequence(s) have z values (are
     3-dimensional)"""
     return bool(shapely.has_z(self))