Finding the world position of the first point of a grid

Options
LotfiMira
LotfiMira Posts: 9 Calcite Rank Badge
edited May 2023 in Oasis montaj
Hi,

I have a grid .grd and .gi files. The coordinate system is UTM.

How can i compute the UTM location of the first point of the grid?

In the following example, i fetched the following properties:
SAMPLE GRID

GXIPJ::get_orientation_info()
- plane origin (x; y; z) = (0; 6.678.350; 0)
- azimuth = 90
- swing = 0

GXIMG::get_info()
- x y location of first point = (410.225; 4.125)
- x axis rotation = 0

GXIPJ::has_section_orientation()
- section orientation = TRUE

When I open the grid in Oasis viewer, the location of the bottom left corner is roughly:
x = 410.256
y = 6.678.350
z = 4.119


I assume plane origin (0; 6.678.350; 0) is UTM.
Then I need to add location of first point (X = 410.225; Y = 4.125).
But why add X to the 1st term and Y to the 3rd term? I can't figure out.

Also, what is the difference between rotation, azimuth and swing?

Thanks.

Lotfi Mira

Comments

  • StephenCheesman
    StephenCheesman Posts: 6 Calcite Rank Badge
    edited December 2016
    Options
    Hello Lotfi

    A grid by nature is a two-dimensional arrangement of point locations, with its own attached two-dimensional coordinate system, whose axes we will call X’ and Y’. Normally its rows line up with X’ and its columns with Y’.

    In order to properly locate a grid in “real” three-dimensional XYZ space, we make use of an “orientation” object, which defines where the grid’s coordinate system origin is anchored, and where the grid axes point. In short, it defines the location and orientation of the infinite plane on which the grid is located.
    The plane origin is the XYZ location in real-world coordinates of the plane origin point, that is (0, 0) in the grid coordinates. From this anchor point extend the grid coordinate axes.

    In your example, this is the location X = 0, Y = 6678350, and Z = 0.

    For (most) section grids, the grid’s X-coordinate axis runs parallel to the ground, and the direction it points is defined by the section azimuth, which is the angle the X-axis makes with the real-world Y (northing) axis, measured clockwise from north (the original version of this note was incorrect!).

    Because your grid azimuth is 90°, the grid’s X’-axis is parallel to the world X-axis, and because the grid X’-origin is found at X = 0, all the grid X’ locations line up with the world X-axis (easting) values. This also means that the grid first point location X’ = 410.256 corresponds to X = 410.256.

    The section swing is defined as the angle the grid’s Y’ axis makes with Z (vertical), measured counter-clock-wise looking along the grid’s X’ axis. For a vertical section, the swing is 0°. Because your grid is vertical, and because the grid Y’ axis origin is located at Z = 0, all the grid Y’ locations line up with the world Z-axis (elevation) values. This also means that the grid first point location Y’ = 4.125 corresponds to Z = 4.125.
    Finally, because the grid is vertical and runs E-W, the entire grid coordinate plane has the same Y value, which is the same as the plane origin Y value, Y = 6678350.

    So, in summary, for your grid, the first point is at (410.225, 6678350, 4.125).

    For vertical section grids (swing = 0), we can use the following formula to find the first point location:

    X = X0 + XG * sin ( azimuth )
    Y = Y0 + XG * cos ( azimuth )
    Z = Z0 + YG

    Where

    (X0, Y0, Z0) is the plane origin
    (XG, YG) is the grid origin (first point location)

    Note that in this context the grid “origin” is a confusing term, as it is not an origin in the (0, 0) sense, but in the sense that it is the start of the grid. In most cases the grid origin and the grid axis origin are two entirely different things.

    For non-zero values of swing the level of complication increases substantially and deserves its own discussion. For instance, the Y’-axis is stretched so that grid Y-axis values continue to be able to represent real-world elevations.

    You will notice that in the above discussion I never made reference to the grid rotation. The grid rotation is defined as a clock-wise rotation of the grid about its starting (origin) point. Because grid rotation introduces an additional complication on top of the grid-plane orientation, you will never find a Geosoft-produced grid that combines both a 3-dimensional orientation with a grid rotation. It is Geosoft practice, instead, to leave the grid rotation angle at zero and put all the grid location and orientation information into the orientation object. For your purposes you can simply ignore it.

    Sincerely,

    Stephen Cheesman
    Senior Application Architect,
    Geosoft Inc.

  • LotfiMira
    Options
    Hi Stephen,

    thank you for your very detailed answer.
    I just have a couple more questions:

    1- Are .gi files used with vertical grids only?

    2- Here is an horizontal and rotated grid.
    SAMPLE
    It seems Oasis generates a .gi file as soon as I import this grid.
    But the gi file azimuth and swing are set to 0.
    If a user was to provide me the .grd along with this .gi file, how can i figure that I should ignore the .gi file?

    Thank you.

    Lotfi
  • StephenCheesman
    StephenCheesman Posts: 6 Calcite Rank Badge
    edited December 2016
    Options
    Hello Lotfi

    1. Geosoft’s *.gi files contain projection and orientation information that cannot be stored in the file itself. So grids in any orientation – rotated or non-rotated, horizontal, vertical or angled, will usually have a *.gi file, and any grid to which a geographical or projected coordinate has been applied will certainly have one.

    2. Geosoft grids can have their own "native" rotation angle, so even in the absence of a *.gi file they can show a rotation when displayed in a plan map. But using the grid rotation property to show rotation is really the “old” way of doing things, and using an orientation object (with or without an accompanying projection) is a much more general and powerful way to orient a grid in space, and that information requires the *.gi file for storage. We would discourage trying to combine the native grid rotation with an orientation definition, as the results may not be well-defined (which is a delicate way of stating we have not spent a great deal of time testing the combination throughout all aspects of the code). So create a grid without setting its rotation angle, determine which earth projection you are using, then orient the grid with respect to the projected coordinate system by defining an orientation, which is a local coordinate system defined with respect to the projected coordinate system.

    You should never try to modify or deconstruct a *.gi file (which is not a text file anyway); always use the GX developer library methods to get and set projection and orientation information.

    Sincerely,
    Stephen
  • LotfiMira
    Options
    Hi Stephen,

    thanks for your reply. I have another question relative to this file.

    Here is the orientation info I extracted:
    plane origin: [0, 0, 0]
    1st point: [192270.0 , 2499950.0]
    azimuth: 0
    swing: 0
    hasSectionOrientation: false

    1) We have swing = 0 (vertical) and hasSectionOrientation == false (horizontal)
    Which one am I to trust? Seems this grid is horizontal in Oasis.

    2) azimuth = 0 means grid's X' is aligned with world's Y
    So first point's world coordinates should be [-2499950.0, 192270.0]
    Yet in Oasis 1st point's world coordinates are [192270.0 , 2499950.0]

    So I am lost again.
    It seems for this example I am to completely ignore azimuth and swing.
    But how do I know when I should use it or not?

    Thank you.

    Lotfi
This discussion has been closed.