Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[geotf] ENU frame projection error #53

Open
rikba opened this issue Sep 30, 2022 · 3 comments
Open

[geotf] ENU frame projection error #53

rikba opened this issue Sep 30, 2022 · 3 comments

Comments

@rikba
Copy link
Contributor

rikba commented Sep 30, 2022

The orthographic projection causes a non-neglectable error when converting geodetic to ENU coordinates.

The current projection should be replaced by a topocentric projection, i.e.,

char enu_proj[250];
sprintf(enu_proj, "+proj=topocentric +ellps=WGS84 +lon_0=%.15f +lat_0=%.15f +h_0=%.15f", lon, lat, alt);
spatial_ref->importFromProj4(enu_proj);

See https://proj.org/operations/conversions/topocentric.html

Unfortunately, this is only available with PROJ4 >= 8.0.0 which is only available with Ubuntu 22.04.

For now one can use the deprecated geodetic_utils for example, but should correct the bug #36

@Jaeyoung-Lim
Copy link
Member

Jaeyoung-Lim commented May 1, 2023

@rikba I tried using the topocentric projection with gdal, but was not able to convert coordinates between WGS84 (EPSG:4326)

  local_spatial_ref_ = std::make_shared<OGRSpatialReference>();
  char enu_proj[250];
  sprintf(enu_proj, "+proj=topocentric +ellps=WGS84 +lon_0=%.15f +lat_0=%.15f +h_0=%.15f", global_reference_longitude_, global_reference_latitude_, global_reference_altitude_);
  local_spatial_ref_->importFromProj4(enu_proj);

  auto wgs84_ref = std::make_shared<OGRSpatialReference>();
  wgs84_ref->importFromEPSG(4326); // WGS84 EPSG 4326

  OGRPoint p;
  p.setX(msg.current.lat);
  p.setY(msg.current.lon);
  p.setZ(msg.current.alt);
  p.assignSpatialReference(wgs84_ref.get());

  p.transformTo(local_spatial_ref_.get());
  Eigen::Vector3d target_coordinates(p.getX(), p.getY(), p.getZ());

Error message:

 ERROR 1: PROJ: pipeline: Pipeline: Mismatched units between step 2 and 3

Any ideas / pointers you can suggest to solve this problem would be helpful!

@rikba
Copy link
Contributor Author

rikba commented May 3, 2023

Sorry, but I have not worked with it since them. You are testing it on 22.04?

@Jaeyoung-Lim
Copy link
Member

@rikba Yes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants