Your current method for converting WGS84 coordinates to XYZ coordinates is a good start, but it’s essential to consider the intricacies of geodetic transformations. Let’s explore some improvements and alternatives:
- Geodetic to Geocentric Conversion:
- Your existing method calculates XYZ coordinates based on the WGS84 ellipsoid. However, for precise geospatial applications, you might want to use established libraries or tools.
- Consider using the pyproj library (Python) or similar tools that provide accurate geodetic-to-geocentric conversions.
- Pyproj allows you to transform between different coordinate systems, including WGS84 and local Cartesian.
- Similitude Transformation:
- To achieve better accuracy, you can perform a similitude transformation from your local Cartesian system to the geocentric system.
- The similitude transformation involves finding the parameters (scale, rotation, translation) that align your local coordinates with the global WGS84 system.
- I recommend referring to the math paper by Huaien Zeng et al. (2018) for details on this transformation1.
- Using Pyproj and Simil Module:
- Sample Code:
- Here’s an example of how you can use the pyproj library and the simil module to convert your local Cartesian points to WGS84 coordinates:
Python
from pyproj import CRS, Transformer
import numpy as np
import simil
# Local Cartesian [x, y, z] control points
local_ctrl_p = [[0, 0, 0], [0, 12.24, 0], [32.42, 6.79, 0]]
# Geodetic [lat, lon, h] control points
geodet_ctrl_p = [
[43.88072176381581, 11.072238294111774, 53],
[43.88099406334439, 11.072485923398222, 53],
[43.88080644977896, 11.072808964924704, 53]
]
# Perform similitude transformation
simil_params = simil.find_similitude(local_ctrl_p, geodet_ctrl_p)
transformer = Transformer.from_crs("EPSG:4326", "EPSG:4978") # WGS84 to geocentric
# Convert other points (local Cartesian) to geocentric
other_points_local = [...] # Add your other local points here
other_points_geocentric = [simil.apply_similitude(p, simil_params) for p in other_points_local]
# Convert geocentric points to geodetic (WGS84)
other_points_geodetic = [transformer.transform(p[0], p[1], p[2]) for p in other_points_geocentric]
# Now you have the WGS84 coordinates for your other points
print(other_points_geodetic)
KI-generierter Code. Überprüfen und sorgfältig verwenden. Weitere Informationen zu häufig gestellten Fragen.
Remember to adjust the code according to your specific dataset and requirements. The similitude transformation should help improve the accuracy of your conversions from local Cartesian to WGS84 coordinates1.
Keep in mind that geodetic transformations involve complex mathematical models, and using established libraries ensures better accuracy and consistency.
Weitere Informationen
1gis.stackexchange.com2gis.stackexchange.com3gis.stackexchange.com4coordinates-converter.com5github.com+3 mehr
Copilot: Copilot mit GPT-4 (bing.com)