easyidp.geotools.convert_proj3d#
- easyidp.geotools.convert_proj3d(points_np, crs_origin, crs_target, is_xyz=True)#
Transform a point or points from one CRS to another CRS, by pyproj.CRS.Transformer function
- パラメータ:
points_np (np.ndarray) -- the nx3 3D coordinate points
crs_origin (pyproj.CRS object) -- the CRS of points_np
crs_target (pyproj.CRS object) -- the CRS of target
is_xyz (bool, default false) -- The format of points_np; True: x, y, z; False: lon, lat, alt
- 戻り値の型:
np.ndarray
メモ
point_np
andfmt
parameterspoints_np in this format:
x y z 0 1 2 3
points_np in this format:
lon lat alt 0 1 2 3 1 4 5 6
注意
pyproj.CRS order: (lat, lon, alt) points order in EasyIDP are commonly (lon, lat, alt)
But if is xyz format, no need to change order
サンプル
Data prepare
>>> import pyproj >>> import numpy as np >>> import easyidp as idp >>> test_data = idp.data.TestData()
The geodetic 3D coordinate
>>> geocentric = np.array([-3943658.7087006606, 3363404.124223561, 3704651.3067566575]) >>> geo_c = pyproj.CRS.from_dict({"proj": 'geocent', "ellps": 'WGS84', "datum": 'WGS84'})
And the same point in 3D geocentric coordaintes, order in columns=['lon', 'lat', 'alt']
>>> geodetic = np.array([139.54033578028609, 35.73756358928734, 96.87827569602781]) >>> geo_d = pyproj.CRS.from_epsg(4326)
Then do the transformation:
>>> out_c = idp.geotools.convert_proj3d(geodetic, geo_d, geo_c, is_xyz=True) array([-3943658.71530418, 3363404.13219933, 3704651.34270485]) >>> out_d = idp.geotools.convert_proj3d(geocentric, geo_c, geo_d, is_xyz=False) array([139.5403358 , 35.73756338, 96.849 ])