Global Mapper v25.0

Points along geodesic do not fall on straight line in Gnomonic projection

Jake
Jake Global Mapper UserTrusted User
edited April 2013 in Bug Report
Windows 7
GM 13.2.2 5 October 2012 64 bit

I am trying to figure out why points along a geodesic do not fall on the line. I may be doing something wrong so I have attached the GMW so you can see for yourself.

The Problem
Draw a geodesic line from "A" at 45N, 75W 200 nautical miles along an azimuth of 90° to point "C".
Project the workspace to Gnomonic with lat0 = 45N and lon0 = 72.5W.

The 1/3, 1/2 and 2/3 points of the line I have computed with matlab and pctrans. They agree within 1mm of each other. However, the Global Mapper AC line is about 9 m south of these points.

After a little testing it would seem that the gnomonic line AC is based on a spherical earth. Can you confirm this?

I realize GM V14 is out but I suspect the same issue is present there as well. I am in the process of getting the V14 upgrade.

Comments

  • global_mapper
    global_mapper Administrator
    edited March 2013
    The calculations to find where the end point is some given bearing and distance from another point is done by default along the great circle path. If I start at A and go separate 50, 100, and 150 NM I get right to the points that you have from Matlab and PCTrans. However the great circle line from one point to another is not typically a line of constant bearing (that's a rhumb line), so the shortest path from A to point C won't likely pass through the points that were some shorter distance out unless they are along the same line of latitude.

    The projection that you are in doesn't really matter for calculating the end point projected some distance in great circle mode. Those calculations are always done on the ellipsoid with lat/lon values, then reprojected as necessary. Do keep in mind that if you calculate 2 points in lat/lon, then reproject, only the vertices themselves and reprojected, so the line between the vertices will always be straight in the current view projection. If you want it to curve you would need to add more vertices along the line before reprojecting so that each vertex can be reprojected.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • Jake
    Jake Global Mapper User Trusted User
    edited March 2013
    We know the Gnomonic projection draws geodesics as straight lines. Therefore, the 2 point line AC will follow the path of the geodesic, if the display is set to gnomonic. It will be a straight line.

    I calculated points along the geodesic in matlab and pctrans. However, they do not match Global Mapper's straight geodesic line. As you mentioned the GM COGO points match matlab and pctrans. However, I want the line to match the points.

    Let me put it this way. When I am starting at a point with a fixed initial azimuth there is only one path I can take if I am to follow a geodesic. Whether the distance is 10 NM or 1000NM, the first 10NM will follow exactly the same path. If I did not specify an azimuth then I would have to specify the end of the path. That would then dictate my initial azimuth.

    What I found is if I use a spherical model in matlab for the earth, the geodesic points fall on the GM line. So this would seem to indicate GM is not using the reference ellipsoid but instead a spherical model.

    I have one other software that can produce points along the geodesic. I will add that to the comparison tomorrow.

    Thanks for looking into this.
  • global_mapper
    global_mapper Administrator
    edited March 2013
    Looking at this more closely I do see what you are saying. The great circle path generated in Global Mapper does indeed use a spherical model of the earth and not generic geodesics along the ellipsoid. I suppose the Gnomonic projection could be used to generate a geodesic path that is the shortest distance along the ellipsoid, it's just never come up until now as the difference is typically quite minor and not significant for navigation.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • Jake
    Jake Global Mapper User Trusted User
    edited March 2013
    Thanks Mike. What I am trying to determine is what impact this will have on some resulting intersections, if any. And if GM can be used in some scenarios for my work. I agree for navigation it is not an issue but when you create depictions it causes problems. In my example the difference was 9 metres. Often times I need to compute the intersection of two lines (geodesics). So far I have not found a way around GM's accuracy limitation. Unfortunately 9 m is too large for my work. I ideally need to reach centimeter level.

    I have tried to use the "Create Point Features Spaced Along the Selected Feature" function but that unfortunately resulted in the points being the same 9 metres off. So it is using a sphere as well.

    Is there any way you know of in GM to add points or vertices on a geodesic (ellipsoid) path? Or is the great circle (spheroid) path the only option? COGO is not always an option since the lines are defined by end points and not start point plus azimuth.

    Regards.
  • global_mapper
    global_mapper Administrator
    edited March 2013
    If a straight line in the Gnomonic projection is supposed to be along a geodesic can you create the line with your projection set to Gnomonic, then resample that line to add a bunch of points so that when reprojecting the shape is maintained?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • Jake
    Jake Global Mapper User Trusted User
    edited March 2013
    I tried that Mike but the points are still offset about 9 meters at the midpoint. They do fall on the line but the line in not where it should be. See the image attached.

    I made sure the layer that containing the line was gnomonic, then I added 5 points via the "Create Point Features Spaced Along the Selected Feature". The result at the middle is the point GNO_3 that you can see. I can also see that the segment distance is slightly shorter too and that is why it is shifted slightly to the left.

    Regards.
  • global_mapper
    global_mapper Administrator
    edited March 2013
    I looked at the low-level code for the Gnomonic projection which is based on an old library from the USGS. It turns out the Gnomonic projection calculations are all done on a sphere. I also checked an alternative projection library (Proj4) and it also calculates Gnomonic on a sphere only. Apparently it is either impossible or extremely difficult to do Gnomonic projection calculations on an ellipsoid.

    So it may not be possible to generate the geodesic directly. To get the points you would have to do the trick with projecting the point some distance/bearing from the start point, then keep going from that start point out the distance and bearing. Then you would connect those points into a line (there is a tool to connect points into a line in the Digitizer Tool).

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • Jake
    Jake Global Mapper User Trusted User
    edited March 2013
    OK thanks Mike for looking into it. As an alternative could you add an option to the "Create Point Features Spaced Along the Selected Feature" whereby it will use the Vincenty direct formula (which you already use I believe) to generate points along the geodesic? That would solve the problem and would not require you to tinker with the underlying USGS code.

    Regards.
  • global_mapper
    global_mapper Administrator
    edited March 2013
    Oh I've got good news for you! I decided to just update the computation of the great circle path between 2 points to use the Vincenty formulas for bearing and distance and just calculate the initial bearing between the points, then project a point various distances along the geodesic to build the path rather than using the spherical earth model. This gives exactly the points you are after!

    I have placed a new build at http://www.bluemarblegeo.com/downloads/global-mapper/global_mapper14.zip with the latest changes for you to try. Simply download that file and extract the contents into your existing v14.xx installation folder to give it a try. If you are using the 64-bit v14 version there is a new build at http://www.bluemarblegeo.com/downloads/global-mapper/global_mapper14_64bit.zip .

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • Jake
    Jake Global Mapper User Trusted User
    edited March 2013
    Good news? I am ecstatic! Plus I just got my V14 license yesterday. It is now installed and I will be moving on up. Thanks a 10^6.

    Your changes are done with such speed and efficiency it boggles the mind. I hope other people appreciate this (and find the functionality useful) as much I do.
  • Jake
    Jake Global Mapper User Trusted User
    edited March 2013
    Perhaps I am doing something wrong but the points are still 9 m off after applying the update. If you check against the MATLAB2 coordinate you should see this.

    I am going to test again just to make sure.
  • Jake
    Jake Global Mapper User Trusted User
    edited March 2013
    Windows 7 64 bit
    GM 14.1.3 B032113 64 bit

    OK so retesting shows the same 9 meter offset at point MATLAB2. I tested using the,

    Resample/Split Select Feature at Specified Spacing function

    and

    Create Point Features Spaced Along Selected Feature

    They both gave the same answer. About 9 m south of MATLAB2 and PCTRANS2. The GM COGO solution is much closer and it only 0.15 m away from MATLAB2 and PCTRANS2.
  • global_mapper
    global_mapper Administrator
    edited March 2013
    The new change wouldn't affect the resampling as that is still along a line in the projection. Where you get the new path is if you use the Measure Tool to draw a line from point A to point C and you have your distance measurement set to Great Circle (the default). The generated path will now be along the geodesic. When I created such a line it went perfectly through the intermediate points rather than 9 meters below them as before.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • Jake
    Jake Global Mapper User Trusted User
    edited March 2013
    OK I understand now. So you saying the 2 point line in the gnomonic projection will still show the offset? And a re-sampled line will still show the offset?

    A line in the gnomonic projection should follow the same path as the measure tool.


    Thanks.
  • global_mapper
    global_mapper Administrator
    edited March 2013
    Yes the Gnomonic line would still show the offset since the Gnomonic math is spherical. Only places where the path is created along the great circle and builds a multi-point path from the great circle will have this. Currently this is only when creating a line with the Measure Tool. It won't matter what projection you are in as the start and end points are converted to lat/lon, the great circle geodesic path found, then all of those points are converted back to the current projection.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/
  • tjhb
    tjhb Global Mapper User Trusted User
    edited March 2013
    This is interesting to follow!

    In New Zealand we like to think we can fix anything with No.8 wire. My suggestion has very much that flavour. Brits might call it a Heath Robinson suggestion.

    If you need to find exact intersections between great circle paths over an ellipsoid, rather than a sphere, would there be anything wrong in practice with pre-stretching the source data in the latitudinal axis [I first though pre-shrinking], at a guess by cos(90 - |φ|) * 1/f for each vertex, before projecting to Gnomonic?

    Since we are using geodetic latitude, I think the mapping between spherical and ellipsoidal latitude will be linear.

    Would this work, thus remapping positions over the ellipsoid into positions over the sphere, exactly?

    I think Snyder would elegantly term this kludge the use of an "aposphere".

    (BTW Snyder does say that the Gnomonic is "used only in the spherical form", and gives only a set of spherical formulae.)

    Tim Baigent
  • global_mapper
    global_mapper Administrator
    edited March 2013
    Tim,

    I would hesitate to say for sure if that will work, the math makes my head hurt :) I imagine if it was that simple to get right then the Gnomonic formulas would have just incorporated that and been ellipsoidal to start with, so there is probably more to it than that.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/products/global-mapper.php
  • tjhb
    tjhb Global Mapper User Trusted User
    edited March 2013
    Mike,

    I'm certain you're right. I was being much too naïve.

    A great circle path on a sphere is a circle (an embedded straight line), while a great circle path on an ellipsoid is a complex curve.

    These are two different things. I wouldn't be surprised if there's only an approximate, iterative translation between the two.

    Mapping latitudes in spherical space to latitudes in ellipsoidal space is neither here nor there, irrelevant to that relationship.

    Thanks for even thinking about it at all.

    Tim
  • Jake
    Jake Global Mapper User Trusted User
    edited April 2013
    Just getting caught up. I will be testing in the coming weeks to quantify the differences between the great circle path used in the gnomonic projection in Global Mapper and a geodesic path as it relates to my particular scenario. So far it seems acceptable. I did use the GM measure tool (to draw a multi-vertex geodesic) and the results compared with a millimetre of of my manual calculations.


    Also, I have been skimming information on an ellipsoidal implementation of the gnomonic projection. If you are interested you can find the article by Karney it in the Journal of Geodesy, January 2013, Volume 87, Issue 1, pp 43-55.
  • global_mapper
    global_mapper Administrator
    edited April 2013
    If you can find a couple hundred additional users with interest in the ellipsoidal Gnomonic I can throw it in there :)

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.bluemarblegeo.com/products/global-mapper.php
  • tjhb
    tjhb Global Mapper User Trusted User
    edited April 2013
    That looks a great article, written with a generous amount of explanation so that even someone with my level of maths can follow along. And generous of Springer to make it available for free.

    I thought I'd just add a direct link to the volume: here.
  • Jake
    Jake Global Mapper User Trusted User
    edited April 2013
    Mike if there is an asteroid hurtling towards earth and the fate of mankind relies on calculating the intersection of two ellipsoidal great circles I will call you. :) And if anyone is reading this in the next millennia after the great apocalypse you can minimize the great circle/great ellipse intersection difference by placing the origin of the gnomonic projection at or near the intersection point.

    Here is a direct link to the article in the volume. :)

    http://link.springer.com/article/10.1007%2Fs00190-012-0578-z
    8 Ellipsoidal gnomonic projection
    As an application of the differential properties of geodesics,
    I derive a generalization of the gnomonic projection
    to the ellipsoid. The gnomonic projection of the sphere has
    the property that all geodesics on the sphere map to straight
    lines (Snyder 1987, §22). Such a projection is impossible for
    an ellipsoid because it does not have constant Gaussian curvature
    (Beltrami 1865, §18); nevertheless, a projection can
    be constructed in which geodesics are very nearly straight.