GXPJ class

class GXPJ(handle=0)

GXPJ class.

The GXPJ object is created from two GXIPJ objects, and is used for converting data in an OASIS database or map object from one map coordinate (projection) system to another.

clip_ply(min_x, min_y, max_x, max_y, max_dev, pply)

Create a clip polygon from a projected area.

Parameters:
  • min_x (float) – Min X (or Longitude...)
  • min_y (float) – Min Y (or Latitude...)
  • max_x (float) – Max X
  • max_y (float) – Max Y
  • max_dev (float) – Max deviation in degrees
  • pply (GXPLY) – GXPLY to be filled

New in version 5.0.

License: Geosoft Open License

Note: A rectangular area from (MinX, MinY) to (MaxX, MaxY) is projected throught the GXPJ. The resulting (non-rectangular) area is then digitized along its edges, then thinned to remove near-collinear points. The thinning is done to any point whose neighbors subtend an angle greater than (180 degrees - maximum deviation). (i.e. if max. dev = 0, only co-linear points would be removed).

convert_vv(vv_x, vv_y)

Convert VVx/VVy from input projection to output projection.

Parameters:
  • vv_x (GXVV) – VVx
  • vv_y (GXVV) – VVy

New in version 5.0.

License: Geosoft Open License

Note: This function is equivalent to GXVV.project.

convert_vv3(vv_x, vv_y, vv_z)

Convert VVx/VVy/VVz projections

Parameters:
  • vv_x (GXVV) – VVx
  • vv_y (GXVV) – VVy
  • vv_z (GXVV) – VVz

New in version 5.0.

License: Geosoft Open License

Note: This function is equivalent to GXVV.project_3d.

convert_xy(x, y)

Convert X, Y from input projection to output projection.

Parameters:

New in version 5.0.

License: Geosoft Open License

convert_xy_from_xyz(x, y, z)

Convert X, Y from input projection to output projection, taking Z into account

Parameters:
  • x (float_ref) – X (or Longitude)
  • y (float_ref) – Y (or Latitude)
  • z (float) – Z (or Depth - unchanged)

New in version 7.3.

License: Geosoft Open License

Note: This function is used (for instance) when projecting voxel model locations where the user expects that the vertical position will not change. The regular convert_xyz may result in shifts of hundreds, even a thousand meters in case where you are going from the geoid to an ellipsoid. The value of Z can have an important effect on the accuracy of the results, as the normal convert_xy assumes a value of Z=0 internally and calls convert_xyz.

convert_xyz(x, y, z)

Convert X,Y,Z from input projection to output projection.

Parameters:

New in version 6.3.

License: Geosoft Open License

classmethod create(input, output)

This method creates a projection object.

Parameters:
  • input (str) – Input PRJ file name, “” for geodetic
  • output (str) – Ouput PRJ file name, “” for geodetic
Returns:

GXPJ Object

Return type:

GXPJ

New in version 5.0.

License: Geosoft Open License

classmethod create_ipj(ip_jin, ip_jout)

This method creates a projection object from IPJs.

Parameters:
  • ip_jin (GXIPJ) – Input Projection, (GXIPJ)0 for long/lat
  • ip_jout (GXIPJ) – Output Projection, (GXIPJ)0 for long/lat
Returns:

GXPJ Object

Return type:

GXPJ

New in version 5.0.

License: Geosoft Open License

Note: If converting to/from long/lat in the natural coordinate system of the source/target, only the long/lat system can be passed as (GXIPJ)0.

classmethod create_rectified(lon, lat, x, y, rot, scl, dir)

Create a rectified GXPJ from lon,lat,rotation

Parameters:
  • lon (float) – Longitude at (X,Y) origin
  • lat (float) – Latitude at (X,Y) origin
  • x (float) – (X,Y) origin
  • rot (float) – Coordinate Y relative to geographic N (deg azm)
  • scl (float) – Scale to convert X,Y to m.
  • dir (int) – PJ_RECT constants
Returns:

GXPJ Object

Return type:

GXPJ

New in version 5.0.

License: Geosoft Open License

Note: Given an X,Y coordinate system, the lat/lon origin and angle of the coordinate system, this will create a GXPJ to convert between X,Y coordinates and Lon,Lat. The Lon/Lat is determined using a Transverse Mercator projection with central meridian through the center of the coordinates on a WGS 84 datum.

elevation()

Get elevation correction method

Returns:PJ_ELEVATION constants
Return type:int

New in version 5.1.

License: Geosoft Open License

Note: To determine the model in use, refer to the datum_trf column in the usercsvdatumtrf.csv file. The datum and geoid model are named in the sqare brackets following the transform name as follows:

name [datum_model:geoid]

The datum_model is the name of the datum transformation model which will be in a file with extension .ll2 in the etc directory. The geoid is the name of the geoid model which will be in a grid file with extension .grd in the etc directory. If the geoid model is missing, this method will return PJ_ELEVATION_NONE and elevation coordinates will not be changed.

is_input_ll()

Is the input projection a lat/long.

Returns:1 - Yes 0 - No
Return type:int

New in version 5.0.

License: Geosoft Open License

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
is_output_ll()

Is the output projection a lat/long.

Returns:1 - Yes 0 - No
Return type:int

New in version 5.0.

License: Geosoft Open License

classmethod null()

A null (undefined) instance of GXPJ

Returns:A null GXPJ
Return type:GXPJ
project_bounding_rectangle(min_x, min_y, max_x, max_y)

Project a bounding rectangle.

Parameters:

New in version 5.1.4.

License: Geosoft Open License

Note: A rectangular area from (dMinX, dMinY) to (dMaxX, dMaxY) is projected throught the GXPJ. The resulting region area is then digitized along its edges and a new bounding rectangle is computed. If there is a lot of curve through the projection the resulting bounding region may be slightly smaller than the true region.

project_bounding_rectangle2(min_x, min_y, max_x, max_y, err)

Project a bounding rectangle with error tolerance.

Parameters:
  • min_x (float_ref) – Bounding Region Min X
  • min_y (float_ref) – Bounding Region Min Y
  • max_x (float_ref) – Bounding Region Max X
  • max_y (float_ref) – Bounding Region Max Y
  • err (float) – Maximum allowable projection error if <= 0.0, will use 0.005% of smallest dimension

New in version 6.0.1.

License: Geosoft Open License

Note: This is the same as project_bounding_rectangle except that the bounding rectangle will be limited to an area within which the projection can be performed to an accuracy better than the specified error tolerance.

project_bounding_rectangle_res(min_x, min_y, max_x, max_y, res)

Project a bounding rectangle with resolution.

Parameters:

New in version 5.1.8.

License: Geosoft Open License

Note: This function behaves just like ProjBoundingRectangle_PJ except that it also computes an approximate resolution at the reprojected coordinate system from a given original resolution.

project_bounding_rectangle_res2(min_x, min_y, max_x, max_y, res, err)

Project a bounding rectangle with resolution and error tolerance.

Parameters:
  • min_x (float_ref) – Bounding Region Min X
  • min_y (float_ref) – Bounding Region Min Y
  • max_x (float_ref) – Bounding Region Max X
  • max_y (float_ref) – Bounding Region Max Y
  • res (float_ref) – Resolution
  • err (float) – Maximum allowable projection error if <= 0.0, will use 0.005% of smallest dimension

New in version 6.0.1.

License: Geosoft Open License

Note: This is the same as project_bounding_rectangle_res except that the bounding rectangle will be limited to an area within which the projection can be performed to an accuracy better than the specified error tolerance.

project_limited_bounding_rectangle(min_xl, min_yl, max_xl, max_yl, min_x, min_y, max_x, max_y)

Project a bounding rectangle with limits.

Parameters:
  • min_xl (float) – Output limited bounding region Min X
  • min_yl (float) – Min Y
  • max_xl (float) – Max X
  • max_yl (float) – Max Y
  • min_x (float_ref) – Bounding Region Min X
  • min_y (float_ref) – Min Y
  • max_x (float_ref) – Max X
  • max_y (float_ref) – Max Y

New in version 6.0.

License: Geosoft Open License

Note: The bounding rectangle will be limited to no larger than the area specified in the output projection. This is useful when projecting from limits that are unreasonable in the target projection.

setup_ldt()

Setup the GXPJ with LDT check.

New in version 6.2.

License: Geosoft Open License

Note: By default, a GXPJ on the same datum will not apply a LDT, is intended for transformations between datums. However, in some instances you might want to convert between LDTs on the same datum, such as when you have two sets of coordinates that you KNOW came from WGS84 and were placed on this datum using differnt LDT’s. If you want to combine such coordinate systems, one or the other should be converted to the other’s LDT. Note that a more logical way to do this would be to convert both sets back to their original WGS84 coordinates and combine in WGS84.

PJ_ELEVATION constants

Elevation correction method

PJ_ELEVATION_NONE

Elevation transform not supported.

gxapi.PJ_ELEVATION_NONE = 0
PJ_ELEVATION_GEOCENTRIC

elevation transformation uses earth-centre shift and is not accurate.

gxapi.PJ_ELEVATION_GEOCENTRIC = 1
PJ_ELEVATION_GEOID

elevation transformation uses a geoid model and is as accurate as the geoid data.

gxapi.PJ_ELEVATION_GEOID = 2

PJ_RECT constants

Conversion direction

PJ_RECT_XY2LL

Xy2ll

gxapi.PJ_RECT_XY2LL = 0
PJ_RECT_LL2XY

Ll2xy

gxapi.PJ_RECT_LL2XY = 1