Menu

Mirrored TraverseMercator seems to be flawed

Anonymous
2022-06-27
2022-07-07
  • Anonymous

    Anonymous - 2022-06-27

    Hi everybody,
    i am using geographiclib to convert coordinates from wgs84 usingTraverseMercator and have currently the problem that i have given two coordinates coord_1, coord_2.
    I first want to use coord_1 as central meridian and convert coord_2 and then vice versa

    Here is a snippet:

    GeographicLib::TransverseMercator mercator_{ GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f(), 1.0};
    
    double easting = 0.0;
    double northing = 0.0;
    mercator_.Forward(coord_1.Longitude(), coord_2.Latitude(), coord_2.Longitude(), easting, northing);
    
    mercator_.Forward(coord_2.Longitude(), coord_1.Latitude(), coord_1.Longitude(), easting, northing);
    

    I would expect that easting and northing are the same (except the sign) after the two calls, but they differ by quite some distance, can someone help me understand this?

    Best
    Richard

     
  • Charles Karney

    Charles Karney - 2022-06-27

    You'll only get the behavior you expect if

    fabs(coord_1.Latitude()) = fabs(coord_2.Latitude())
    

    A degree separation in longitude corresponds to a shorter distance at higher latitudes. The origin for the northing is the equator and so, obviously, the northings will only match if the latitudes match.

     
  • Anonymous

    Anonymous - 2022-06-28

    Hi Charles and thanks a lot for the answer!
    However, i am still not getting my head around that it makes a different if i use coord_1 as central meridian and project to coord_2, or i use coord_2 as central meridian and project it to coord_1.
    "In my head" that should be an identical northing/easting (except sign) since its the same projection

     
  • Charles Karney

    Charles Karney - 2022-06-28

    You're right -- up to a point. You still need to make sure that the latitudes of the two point match (apart from a sign). If you're still having problems, set the central longitude to 0 and plot lines of equal latitude and longitude in TM coordinates. Make sure you understand this before worrying about changing the central longitude.

     
  • Charles Karney

    Charles Karney - 2022-06-28

    Sorry, I accidentally deleted your recent post requiring moderation...

     
  • Charles Karney

    Charles Karney - 2022-06-28

    To answer your question about why the same latitude value results in different northings, you need to examine the latitude/longitude lines for TM, e.g., as given in the Wikipedia article on TM.

     
  • Anonymous

    Anonymous - 2022-07-07

    Thanks a lot! I think i got it now :)

     

Anonymous
Anonymous

Add attachments
Cancel