geosoft.gxpy.ipj submodule¶
-
class
geosoft.gxpy.ipj.
GXipj
¶ Bases:
object
Class to work with Geosoft coordinate systems. This class wraps many of the functions found in geosoft.gxapi.GXIPJ.
._ipj is the GXIPJ handle to use when calling GXIPJ methods directly
Constructors: from_name: from a name string from_gxf: from a list of GXF strings from_dict: from a dictionary from_json: from a json string from_esri: from an ESRI wkt string New in version 9.1.
-
static
compare
(ipj1, ipj2)¶ Returns: True if two projections are the same
Parameters: - ipj1 – GXipj
- ipj2 – GXipj
New in version 9.1.
-
dict
()¶ Return IPJ dictionary
New in version 9.1.
-
classmethod
from_dict
(ipj_dict)¶ Create an IPJ from a ipj_dict
Parameters: ipj_dict – IPJ dictionary, or a valid name string New in version 9.1.
-
classmethod
from_esri
(esri_str)¶ Create an IPJ from an ESRI wkt coordinate string
Parameters: esri_str – ESRI coordinate definition string New in version 9.1.
-
classmethod
from_gxf
(gxfs)¶ Create IPJ from a set of GXF strings.
Params: gxfs: list of GXF strings. See GXFIPJ.set_gxf() reference. New in version 9.1.
-
classmethod
from_json
(jstr)¶ Create an IPJ from a string, which can be a valid coordinate system name string or a JSON format string that defines the coordinate system type and properties as follows:
LocalGrid: A local grid requires only the latitude and longitude of the local grid origin, though generally an azimuth of rotation the local grid axis with respect to true North is generally expected. Other properties may also be specified if further detail is known or desired. An “Oblique Stereographic” coordinate system is constructed centred on the local grid origin such that the stereographic plan touches the elipsoid of the earth at that point. The “scalefactor” can be used to adjust for intended area of use. The default scale factor ensures length units are comparable to UTM length units (0.9996).
{ "type": "LocalGrid" "properties": { "latitude": value or string in form "(+/-) deg.mm.ss.ss (N/S)" "longitude: value or string "azimuth": value (rotation in degrees azimuth, default is 0.0) "elevation": value (elevation of map plane, default is 0.0) "datum": string (name of the datum, default is "WGS 84") "ldatum": string (local datum transform, default determined from datum) "units": string (unit name, default is "m") "scalefactor": value (central scale factor, default is 0.9996) } }
EPSG: (http://spatialreference.org/)
{ "type": "EPSG" "properties": { "code": EPSG_code_number }, "orientation": "<x0,y0,z0,xR,yR,zR>" }
Geosoft: (http://www.geosoft.com/resources/goto/GXF-Grid-eXchange-File)
{ "type": "Geosoft", "properties": { "name": name "datum": datum "method": method "units": units "local_datum": local datum transform }, "orientation": "<x0,y0,z0,xR,yR,zR>" }
See see http://www.geosoft.com/resources/goto/GXF-Grid-eXchange-File for GXF string reference
ESRI: (http://webhelp.esri.com/arcgisserver/9.3/java/index.htm#geodatabases/the_ogc-607957855.htm)
{ "type": "ESRI", "properties": { "wkt": wkt format string, starts with "PROJCS[" or "GEOGCS[" }, "orientation": "<x0,y0,z0,xR,yR,zR>" }
“orientation”: Note
Only orientations of “<0, 0, 0, 0, 0, 0>” are supported in version 9.1. Oriented coordinate systems will be added at some point in the future. Oriented coordinates can be achieved using Oblique Stereographic.
FUTURE: In Geosoft coordinate systems, a cartesian system can be oriented arbitrarily in three dimensions relative to a base coordinate system. This requires the definition of the local origin location on the base system, and the rotation in degrees clockwise (azimuth in plan view) around each of the three base system axis, as defined by the “orientation” description, which is a set of 6 values within angle brackets:
"<oX,oY,oZ,rX,rY,rX>"
The orientation string can be appended to the name, or added as it’s own key “orientation”
For example, a local grid with origin at (550000,6250000) rotated at azimuth 15 degrees (clockwise) from the base “UTM zone 15N” Northings and Eastings on “WGS 84” would be:
{"type":"Geosoft","properties":{"name":"WGS 84 / UTM zone 15N <550000,6250000,0,0,0,15>"}}
or:
{"type":"Geosoft","properties":{"name":"WGS 84 / UTM zone 15N"}, "orientation":"<550000,6250000,0,0,0,15>"}
New in version 9.1.
-
classmethod
from_name
(name)¶ Create an IPJ from a projection name in the form “datum / projection <orientation>”.
Parameters: name – coordinate system name in the form “datum / projection <orientation>” New in version 9.1.
-
name
(what=None)¶ Return requested name.
Parameters: what – gxipj.NAMEgxipj.NAME_PCSgxipj.NAME_PROJECTIONgxipj.NAME_METHODgxipj.NAME_DATUMgxipj.NAME_ELLIPSOIDgxipj.NAME_LDATUMgxipj.NAME_UNITgxipj.NAME_UNIT_FULLgxipj.NAME_TYPEgxipj.NAME_LLDATUMgxipj.NAME_METHOD_PARMSgxipj.NAME_METHOD_LABELgxipj.NAME_DATUM_PARMSgxipj.NAME_LDATUM_PARMSgxipj.NAME_GEOIDgxipj.NAME_LDATUMDESCRIPTIONgxipj.NAME_METHOD_PARMS_NATIVEgxipj.NAME_ORIENTATIONIf ‘what’ is not specified, gxipj.NAME assumed, which returns the coordinate system display name.
Returns: The name requested New in version 9.1.
-
static
names
(what, datum_filter='')¶ Get a list of coordinate system names
Parameters: - what – gxipj.LIST_COORDINATESYSTEMgxipj.LIST_DATUMgxipj.LIST_PROJECTIONgxipj.LIST_UNITSgxipj.LIST_LOCALDATUMDESCRIPTIONgxipj.LIST_LOCALDATUMNAMEgxipj.LIST_UNITSDESCRIPTION
- datum_filter – name of a datum to filter results
Returns: sorted list of names
New in version 9.1.
- what –
-
to_gxf
()¶ Get GXF string list from ipj. Returns list of 5 GXF strings.
New in version 9.1.
-
to_json
()¶ Return a JSON formatted projection in the form:
{ "baseName": "DHDN / Okarito 2000", "datumName": "DHDN", "localDatumName": "DHDN to WGS 84 (1)", "name": "DHDN / Okarito 2000 <25000,1000000,50,90,0,15>", "orientation": "<25000,1000000,50,90,0,15>", "projectionName": "Okarito 2000", "projectionType": "Transverse Mercator", "properties": { "datum": "DHDN,6377397.155,0.0816968312225275,0", "local_datum": ""DHDN to WGS 84 (1)",582,105,414,1.04,0.35,-3.08,8.29999999996112", "name": "DHDN / Okarito 2000 <25000,1000000,50,90,0,15>", "projection": ""Transverse Mercator",-43.11,170.260833333333,1,400000,800000", "units": "m,1" }, "type": "Geosoft", "unitName": "m" }
New in version 9.1.
-
units
()¶ Returns: tuple (factor, abbreviation), where factor is multiplier to convert to metres New in version 9.1.
-
static
-
class
geosoft.gxpy.ipj.
GXpj
(ipj_from, ipj_to)¶ Bases:
object
Class to reproject coordinates.
Params ipj_from: GXipj from coordinate system Params ipj_to: GXipj to coordinate system New in version 9.1.
-
convert
(xyz)¶ Project data in array in which first columns are x,y or x,y,z.
Coordinates are reprojected in-place.
Parameters: xyz –
numpy array shape (,3+) for (x,y,z) conversionnumpy array shape (,2) for x,y conversionExample: Given an array shape (500,6), which represents 500 data records with 6 columns in which the first 3 columns are coordinates X, Y and Z.
data = np.zeros((10,5), dtype='float') #then fill the array with some data pj.convert(data[:,2]) #transform x,y pj.convert(data[:,3]) #transform x,y and z pj.convert(data) #transform x,y and z (same as previous line)
New in version 9.1.
-
-
exception
geosoft.gxpy.ipj.
IPJException
¶ Bases:
Exception
Exceptions from this module.
New in version 9.1.