Community Forum
ANVEL Licensing Options

WGS84 to Point Discrepancy?



  • I just started using the API for Anvel and I found something that seems odd. In the following Python Code, I am just doing a simple conversion of a LatLonAlt to the Anvel Point3 and back to LatLonAlt. The initial LatLonAlt is not the same as the LatLonAlt after the Point3 Conversion in the API, using the ConvertWSG84ToPoint and ConvertPointToWGS84. I am curious to know if there is something that I am missing or another potential issue.

    The "api" is what I am using for the AnvelApi call.

    originLL = LatLonAlt(44.619124308304833,-84.898965336441734,0)
    print("Intial Origin in LatLongAlt")
    print(originLL)
    originPosition = api.ConvertWGS84ToPoint(originLL)
    print("Origin Position after convert to ANVEL Point3")
    print(originPosition)
    originLLafter = api.ConvertPointToWGS84(originPosition)
    print("Origin Position after Anvel Point 3 to WSG84")
    print(originLLafter)

    Here is an example output:
    Intial Origin in LatLongAlt
    LatLonAlt(lat=44.61912430830483, alt=0, lon=-84.89896533644173)
    Origin Position after convert to ANVEL Cartesian
    Point3(y=-4048202.309135899, x=-4485663.547508538, z=4320542.911326641)
    Origin Position after Anvel to WSG84
    LatLonAlt(lat=0.6368271580477353, alt=0.0, lon=3.065628964072463)



  • Hi.
    Thank you for your question! It appears your input value is in degrees while ConvertPointToWGS84 is expecting signed radians. Changing your input to signed radians should resolve the issue.

    This is noted in the description for LatLonAlt in the API documentation.

    Sincerely,
    The ANVEL Support Team



  • So after fixing the issue with the Degrees to Radians I am still seeing some issues with the WGS84 to Point3 conversion. I have my own conversion functions that I am using in an ANVEL plugin and I am able to get proper locations onto my environment. I am taking my origin point and using that to control my offset for location within the environment. Here are a small batch of numbers from a data set:

    My Custom Function:
    y=545.558874, x=759.965060, z=350
    y=545.558874, x=759.965060, z=350
    y=545.558874, x=759.965060, z=350
    y=545.558874, x=759.965060, z=350
    y=545.558874, x=759.965060, z=350
    y=545.556652, x=759.965118, z=350
    y=545.554431, x=759.965118, z=350
    y=545.554431, x=759.965118, z=350
    y=545.554431, x=759.965118, z=350
    y=545.554431, x=759.965118, z=350

    From the API function using the same LatLon:
    Point3(y=718.6968418652829, x=-491.46594097070005, z=-342.36939018512703)
    Point3(y=718.6968418652829, x=-491.46594097070005, z=-342.36939018512703)
    Point3(y=718.6968418652829, x=-491.46594097070005, z=-342.36939018512703)
    Point3(y=718.6946036106858, x=-491.4628610900591, z=-342.37168417086525)
    Point3(y=718.6946036106858, x=-491.4628610900591, z=-342.37168417086525)
    Point3(y=718.6946036106858, x=-491.4628610900591, z=-342.37168417086525)
    Point3(y=718.6946036106858, x=-491.4628610900591, z=-342.37168417086525)
    Point3(y=718.6946036106858, x=-491.4628610900591, z=-342.37168417086525)
    Point3(y=718.6946036106858, x=-491.4628610900591, z=-342.37168417086525)
    Point3(y=718.6946036106858, x=-491.4628610900591, z=-342.37168417086525)

    Here are the LatLons I am using:
    LatLonAlt(lat=44.6238558, alt=0, lon=-84.88921482)
    LatLonAlt(lat=44.6238558, alt=0, lon=-84.88921482)
    LatLonAlt(lat=44.6238558, alt=0, lon=-84.88921482)
    LatLonAlt(lat=44.62385576, alt=0, lon=-84.88921482)
    LatLonAlt(lat=44.62385576, alt=0, lon=-84.88921482)
    LatLonAlt(lat=44.62385576, alt=0, lon=-84.88921482)
    LatLonAlt(lat=44.62385576, alt=0, lon=-84.88921482)
    LatLonAlt(lat=44.62385576, alt=0, lon=-84.88921482)
    LatLonAlt(lat=44.62385576, alt=0, lon=-84.88921482)
    LatLonAlt(lat=44.62385576, alt=0, lon=-84.88921482)

    The 350 for the z in the first Data set was set by me for manipulating the vehicle to a better height for placement on the ground. So that number can be assumed to be 0 for this case just like in the provided LatLons. What I am finding strange is that when providing a 0 for alt the Conversion function returns -342m.

    In addition, I have also found that the environment I am using has the Anvel origin point under the environment ground by about 340m in ANVEL. When I compare how my environment is built to the Eastern Mountains provided by ANVEL, the interesting thing is that the origin point is just above the ground in the Eastern Mountains. Would that explain the -340m I am seeing from the API?



  • Hi.
    I would agree that the origin position would affect your results. You may wish to look at your Environment definition file and adjust the origin.

    Under <terrain> <grid> look for <position>.

    If you wish to set the origin to the center, simply calculate the size of the grid (e.g. numCellsX * cellSize ) and divide by 2 for the x position. And do the same to find the y position. z would normally be 0 unless you have reason to set it otherwise.

    Within ANVEL, you can view the origin value under Environment -> TerrainGridRoot -> TerrainGrid

    Please let us know if this resolves your issue.

    Sincerely,
    ANVEL Support Team



  • Hello,
    While our earlier response dealt with the origin aspect of your recent question, one of our engineers offers this analysis on the conversion aspect.

    Here's a simple test to confirm the most basic functionality of the API's geodetic coordination transform routines.

    The environment's definition file includes the origin of ANVEL's local Cartesian world frame under the "location" tag. For Eastern Mountains, this looks like:
    <location elevation="0" latitude="33.333300000000001" longitude="44.433329999999998" type="latlong" utcOffset="3"/>.

    The same data are also shown, albeit with reduced precision, in the Properties pane of the Config panel under Environment. These can be used as well but result in more position error.

    With Eastern Mountains loaded in the connected ANVEL instance, converting this geodetic position into the ANVEL local coordinates should produce the origin:

    In[16]: origGeo = LatLonAlt(lat=33.333300000000001 * pi / 180, lon=44.433329999999998 * pi / 180, alt=0)
    In[17]: anv.ConvertWGS84ToPoint(origGeo)
    Out[17]: Point3(y=3.578986409256757e-12, x=6.585122997589916e-10, z=-5.441591367249506e-12)
    which is the origin (to sub-nanometer accuracy).
    
    The reverse transform should also work:
    In[18]: origGeo = anv.ConvertPointToWGS84(Point3(0, 0, 0))
    
    In[19]: origGeo.lat * 180 / pi
    Out[19]: 33.3333
    
    In[20]: origGeo.lon * 180 / pi
    Out[20]: 44.43332999999999
    
    In[21]: origGeo.alt
    Out[21]: 9.313225746154785e-10
    which is the expected geodetic position.
    

    Any conversions that are unable to round-trip the origin and produce the expected results are doing something other than a pure transformation between the two coordinate frames.

    Thank you.

    ANVEL Support Team