s2d2.mapping_tools
Module Contents
Functions
|
transforms angles to map coordinates (that is 2D) in a projection frame |
|
transforms map coordinates (that is 2D) in a projection frame to angles |
|
transform 3D cartesian Earth Centered Earth fixed coordinates, to |
|
transform 3D cartesian Earth Centered Earth fixed coordinates, to |
|
get the UTM zone for a specific location |
- s2d2.mapping_tools.ll2map(ll, spatial_ref)[source]
transforms angles to map coordinates (that is 2D) in a projection frame
- Parameters:
llh (np.array, size=(m,2), unit=(deg,deg)) – np.array with spherical coordinates. In the following form: [[lat, lon], [lat, lon], … ]
spatial_ref (osgeo.osr.SpatialReference) – target projection system
- Returns:
xyz – np.array with 2D coordinates. In the following form: [[x, y], [x, y], … ]
- Return type:
np.array, size=(m,2), unit=meter
Examples
Get the Universal Transverse Mercator (UTM) cooridnates from spherical coordinates:
>>> import numpy as np >>> from osgeo import osr >>> proj = osr.SpatialReference() >>> proj.SetWellKnownGeogCS('WGS84') >>> lat, lon = 52.09006426183974, 5.173794246145571# Utrecht University >>> proj.SetUTM(32, lat>0)
>>> xy = ll2map(np.array([[lat, lon]]), proj) >>> xy array([[ 237904.03625329, 5777964.65056734, 0. ]])
- s2d2.mapping_tools.map2ll(xy, spatial_ref)[source]
transforms map coordinates (that is 2D) in a projection frame to angles
- Parameters:
xy (np.array, size=(m,2), unit=meter) – np.array with 2D coordinates. In the following form: [[x, y], [x, y], … ]
spatial_ref (osgeo.osr.SpatialReference) – target projection system
- Returns:
ll – np.array with spherical coordinates. In the following form: [[lat, lon], [lat, lon], … ]
- Return type:
np.array, size=(m,2), unit=(deg,deg)
- s2d2.mapping_tools.ecef2llh(xyz)[source]
transform 3D cartesian Earth Centered Earth fixed coordinates, to spherical angles and height above the ellipsoid
- Parameters:
xyz (np.array, size=(m,3), unit=meter) – np.array with 3D coordinates, in WGS84. In the following form: [[x, y, z], [x, y, z], … ]
- Returns:
llh – np.array with angles and height. In the following form: [[lat, lon, height], [lat, lon, height], … ]
- Return type:
np.array, size=(m,2), unit=(deg,deg,meter)
- s2d2.mapping_tools.ecef2map(xyz, spatial_ref)[source]
transform 3D cartesian Earth Centered Earth fixed coordinates, to map coordinates (that is 2D) in a projection frame
- Parameters:
xyz (np.array, size=(m,3), float) – np.array with 3D coordinates, in WGS84. In the following form: [[x, y, z], [x, y, z], … ]
spatial_ref (osgeo.osr.SpatialReference) – target projection
- Returns:
xyz – np.array with planar coordinates, within a given projection frame
- Return type:
np.array, size=(m,2), float