def transform(src_crs, dst_crs, xs, ys, zs=None, **options): """Transform vectors from source to target coordinate reference system. Transform vectors of x, y and optionally z from source coordinate reference system into target. Parameters ------------ src_crs: CRS or dict Source coordinate reference system, as a rasterio CRS object. Example: CRS({'init': 'EPSG:4326'}) dst_crs: CRS or dict Target coordinate reference system. xs: array_like Contains x values. Will be cast to double floating point values. ys: array_like Contains y values. zs: array_like, optional Contains z values. Assumed to be all 0 if absent. Returns --------- out: tuple of array_like, (xs, ys, [zs]) Tuple of x, y, and optionally z vectors, transformed into the target coordinate reference system. """ with Env(**options): return _transform(src_crs, dst_crs, xs, ys, zs)
def transform(src_crs, dst_crs, xs, ys, zs=None): """ Transform vectors of x, y and optionally z from source coordinate reference system into target. Parameters ------------ src_crs: dict Source coordinate reference system, in rasterio dict format. Example: {'init': 'EPSG:4326'} dst_crs: dict Target coordinate reference system. xs: array_like Contains x values. Will be cast to double floating point values. ys: array_like Contains y values. zs: array_like, optional Contains z values. Assumed to be all 0 if absent. Returns --------- out: tuple of array_like, (xs, ys, [zs]) Tuple of x, y, and optionally z vectors, transformed into the target coordinate reference system. """ return _transform(src_crs, dst_crs, xs, ys, zs)
def transform(src_crs, dst_crs, xs, ys, zs=None): """Transform vectors from source to target coordinate reference system. Transform vectors of x, y and optionally z from source coordinate reference system into target. Parameters ------------ src_crs: CRS or dict Source coordinate reference system, as a rasterio CRS object. Example: CRS({'init': 'EPSG:4326'}) dst_crs: CRS or dict Target coordinate reference system. xs: array_like Contains x values. Will be cast to double floating point values. ys: array_like Contains y values. zs: array_like, optional Contains z values. Assumed to be all 0 if absent. Returns --------- out: tuple of array_like, (xs, ys, [zs]) Tuple of x, y, and optionally z vectors, transformed into the target coordinate reference system. """ if len(xs) != len(ys): raise TransformError("xs and ys arrays must be the same length") elif zs is not None and len(xs) != len(zs): raise TransformError("zs, xs, and ys arrays must be the same length") if len(xs) == 0: return ([], [], []) if zs is not None else ([], []) else: return _transform(src_crs, dst_crs, xs, ys, zs)