utils.CoordinateTransformer.polygon_to_local_coords#
- CoordinateTransformer.polygon_to_local_coords(polygon: Polygon) Polygon#
Transform polygon from geographic coordinates to local coordinates.
- Parameters:
polygon – Shapely polygon.
- Returns:
x – Shapely polygon in local coordinates.
Examples
>>> from seismostats.utils import CoordinateTransformer >>> from shapely.geometry import Polygon
>>> ref_easting = 2642690 >>> ref_northing = 1205590 >>> ct = CoordinateTransformer(2056, ref_easting, ref_northing) >>> polygon = Polygon([(8.0, 47.0), (8.0, 48.0), (9.0, 48.0)]) >>> local_polygon = ct.polygon_to_local_coords(polygon) >>> x, y = local_polygon.exterior.xy >>> x array('d', [5.4201549254357815, -789.3621860183775, 73841.78791614715, 5.4201549254357815]) >>> y array('d', [0.5222872239537537, 111185.62139117694, 112195.20617892314, 0.5222872239537537])
See also
polygon_from_local_coords()