GXMAP class

class geosoft.gxapi.GXMAP
MAPs are containers for MVIEW objects. A view is a 3-D translation
and a clip window on a map. Graphic entities can be drawn in an MVIEW.
It is recommended that the MAP class be instantiated by first creating
an EMAP object and calling the geosoft.gxapi.GXEMAP.lock()() function.
(See the explanation on the distinction between the MAP and EMAP classes).
agg_list((GXLST)arg1, (int)arg2) → None:
Get a list of all aggregates in this map.
Parameters:
  • arg1 (geosoft.gxapi.GXLST) – list to hold the views (allow up to 96 characters)
  • arg2 (int) – 0 - view/agg only 1 - view/agg/layer
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

List items are returned as view/agg/layer.
The layer name is optional

See also

geosoft.gxapi.GXLST class.

agg_list_ex((GXLST)arg1, (int)arg2, (int)arg3) → None:
Get a list of aggregates in this map based on a mode
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.1.2.

Note:

List items are returned as view/agg/layer.
The layer name is optional

See also

geosoft.gxapi.GXLST class.

clean() → None:
Clean up empty groups in all views in map.
Returns:Nothing
Return type:None

New in version 5.0.0.

commit() → None:
Commit any changes to a map.
Returns:Nothing
Return type:None

New in version 5.0.0.

copy_map_to_view((str)arg1, (str)arg2) → None:
Copy entire map into one view in output map.
Parameters:
  • arg1 (str) – Destination MAP name
  • arg2 (str) – Name of View
Returns:

Nothing

Return type:

None

New in version 5.1.8.

crc_map((int_ref)arg1, (str)arg2) → None:
Generate an XML CRC of a MAP
Parameters:
Returns:

Nothing

Return type:

None

New in version 6.0.0.

static create((str)arg1, (int)arg2) → GXMAP:
Create a MAP.
Parameters:
Returns:

MAP Object

Return type:

geosoft.gxapi.GXMAP

New in version 5.0.0.

create_linked_3d_view((GXMVIEW)arg1, (str)arg2, (float)arg3, (float)arg4, (float)arg5, (float)arg6) → None:
Create a 3D View in this map that is linked to a MVIEW in a 3D View file.
Parameters:
  • arg1 (geosoft.gxapi.GXMVIEW) – 3DV’s 3D MVIEW
  • arg2 (str) – New view name
  • arg3 (float) – X minimum in mm
  • arg4 (float) – Y minimun in mm
  • arg5 (float) – X maximum in mm
  • arg6 (float) – Y maximum in mm
Returns:

nothing

Return type:

None

New in version 9.2.0.

static current() → GXMAP:
This method returns the Current map opened.
Returns:MAP Object
Return type:geosoft.gxapi.GXMAP

New in version 5.0.0.

Note:

If there is no current map, and running interactively,
the user is prompted to open a map.
delete_view((str)arg1) → None:
Deletes a view in this map.
Parameters:arg1 (str) – View Name to delete
Returns:Nothing
Return type:None

New in version 5.0.0.

Note:

If the view does not exist, nothing happens.
discard() → None:
Discard all changes made to the map.
Returns:Nothing
Return type:None

New in version 5.0.0.

dup_map((GXMAP)arg1, (int)arg2) → None:
Duplicate copy of current map.
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

Before version 6.2 text in maps were displayed with a character set
defining how characters above ASCII 127 would be displayed. 6.2 introduced
Unicode in the core montaj engine that eliminated the need for such a setting and
greatly increased the number of symbols that can be used. The only caveat
of the new system is that text may appear corrupted (especially with GFN fonts) in
versions prior to 6.2 that render maps created in version 6.2 and later.
The constant DUPMAP_COPY_PRE62 provides a way to create maps that can be
distributed to versions prior to 6.2.
duplicate_view((str)arg1, (str_ref)arg2, (bool)arg3) → None:
Duplicate an entire view
Parameters:
  • arg1 (str) – Name of view to duplicate
  • arg2 (geosoft.gxapi.str_ref) – Name of new view created (pass in “” and the new name is returned)
  • arg3 (bool) – Copy all groups bool
Returns:

Nothing

Return type:

None

New in version 5.1.2.

exist_view((str)arg1) → int:
Checks to see if a view exists.
Parameters:arg1 (str) – View name
Returns:0 view does not exist. 1 view exists.
Return type:int

New in version 5.0.0.

export_all_in_view((str)arg1, (str)arg2, (float)arg3, (float)arg4, (int)arg5, (int)arg6, (str)arg7, (str)arg8) → None:
Export the entire map in view units to an external format. View and Group names are removed and plane spatial coordinates will be in the units of the map.
Parameters:
  • arg1 (str) – File Name To Export
  • arg2 (str) – View to export coordinates in
  • arg3 (float) – Resolution in view units of one pixel (or dummy, will be used if DPI is dummy)
  • arg4 (float) – Resolution in DPI (will override view resolution if not dummy, map page size will be used to determine pixel size of output)
  • arg5 (int) – MAP_EXPORT_BITS constants
  • arg6 (int) – MAP_EXPORT_METHOD constants
  • arg7 (str) – MAP_EXPORT_FORMAT constants
  • arg8 (str) – Extended Options String (format specific)
Returns:

Nothing

Return type:

None

New in version 7.1.0.

export_all_raster((str)arg1, (str)arg2, (int)arg3, (int)arg4, (float)arg5, (int)arg6, (int)arg7, (str)arg8, (str)arg9) → None:
Export the entire map to map to a non-geo raster format.
Parameters:
  • arg1 (str) – File Name To Export
  • arg2 (str) – View to export coordinates in
  • arg3 (int) – Number of Pixels in X (X or Y should be specified the other should be 0 and computed by export, or both can be 0 and DPI defined)
  • arg4 (int) – Number of Pixels in Y (X or Y should be specified the other should be 0 and computed by export, or both can be 0 and DPI defined)
  • arg5 (float) – Resolution in DPI (will override X and Y if not dummy, map page size will be used to determine pixel size of output)
  • arg6 (int) – MAP_EXPORT_BITS constants
  • arg7 (int) – MAP_EXPORT_METHOD constants
  • arg8 (str) – MAP_EXPORT_RASTER_FORMAT constants
  • arg9 (str) – Extended Options String (format specific)
Returns:

Nothing

Return type:

None

New in version 7.1.0.

export_area_in_view((str)arg1, (str)arg2, (float)arg3, (float)arg4, (int)arg5, (int)arg6, (float)arg7, (float)arg8, (float)arg9, (float)arg10, (str)arg11, (str)arg12) → None:
Export an area of a map in view units to an external format
Parameters:
  • arg1 (str) – File Name To Export
  • arg2 (str) – View to export coordinates in
  • arg3 (float) – Resolution in view units of one pixel (or dummy, will be used if DPI is dummy)
  • arg4 (float) – Resolution in DPI (will override view resolution if not dummy, map page size will be used to determine pixel size of output)
  • arg5 (int) – MAP_EXPORT_BITS constants
  • arg6 (int) – MAP_EXPORT_METHOD constants
  • arg7 (float) – Area To Export Min X location in view units
  • arg8 (float) – Area To Export Min Y location in view units
  • arg9 (float) – Area To Export Max X location in view units
  • arg10 (float) – Area To Export Max Y location in view units
  • arg11 (str) – MAP_EXPORT_FORMAT constants
  • arg12 (str) – Extended Options String (format specific)
Returns:

Nothing

Return type:

None

New in version 7.1.0.

export_area_raster((str)arg1, (str)arg2, (float)arg3, (float)arg4, (float)arg5, (float)arg6, (int)arg7, (int)arg8, (float)arg9, (int)arg10, (int)arg11, (str)arg12, (str)arg13) → None:
Export an area of a map to a non-geo raster format.
Parameters:
  • arg1 (str) – File Name To Export
  • arg2 (str) – View to export coordinates in
  • arg3 (float) – Area To Export Min X location in view units
  • arg4 (float) – Area To Export Min Y location in view units
  • arg5 (float) – Area To Export Max X location in view units
  • arg6 (float) – Area To Export Max Y location in view units
  • arg7 (int) – Number of Pixels in X (X or Y should be specified the other should be 0 and computed by export, or both can be 0 and DPI defined)
  • arg8 (int) – Number of Pixels in Y (X or Y should be specified the other should be 0 and computed by export, or both can be 0 and DPI defined)
  • arg9 (float) – Resolution in DPI (will override X and Y if not dummy, map page size will be used to determine pixel size of output)
  • arg10 (int) – MAP_EXPORT_BITS constants
  • arg11 (int) – MAP_EXPORT_METHOD constants
  • arg12 (str) – MAP_EXPORT_RASTER_FORMAT constants
  • arg13 (str) – Extended Options String (format specific)
Returns:

Nothing

Return type:

None

New in version 7.1.0.

get_class_name((str)arg1, (str_ref)arg2) → None:
Get a class name.
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

Map class names are intended to be used to record the
names of certain view classes in the map, such as the
"Data", "Base" and "Section" views.

There can only be one name for each class, but it can
be changed.  This lets the "Data" class name change,
for example, so plotting can select which class to plot
to.

If a name is not set, the class name is set and
returned.
get_data_proj() → int:
Get the projection type of the Data view of a map.
Returns:Project type as an integer
Return type:int

New in version 8.3.0.

get_file_name((str_ref)arg1) → None:
Get the name of the map.
Parameters:arg1 (geosoft.gxapi.str_ref) – returned map file name
Returns:Nothing
Return type:None

New in version 5.0.0.

get_lpt() → GXLPT:
Get the LPT Object of a MAP.
Returns:LPT Object
Return type:geosoft.gxapi.GXLPT

New in version 5.0.0.

get_map_name((str_ref)arg1) → None:
Get the Map Name of the Map.
Parameters:arg1 (geosoft.gxapi.str_ref) – returned map name
Returns:Nothing
Return type:None

New in version 5.0.0.

get_map_scale() → float:
Get the current map scale
Returns:The current map scale
Return type:float

New in version 5.0.0.

Note:

If there is a "Data" view, the scale is derived from
this view.

If their is no data view, the scale is derived
from the first view that is not scaled in mm.
otherwise, the scale is 1000 (mm).

All views must be closed, or open read-only.
get_map_size((float_ref)arg1, (float_ref)arg2, (float_ref)arg3, (float_ref)arg4) → None:
Get the size of the Map.
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

get_meta() → GXMETA:
Get the map's META
Returns:META Object
Return type:geosoft.gxapi.GXMETA

New in version 5.1.8.

Note:

If the map has no META, an empty META will be created.
get_reg() → GXREG:
Get the map's REG
Returns:REG Object
Return type:geosoft.gxapi.GXREG

New in version 5.0.0.

Note:

If the map has no REG, an empty REG will be created.
group_list((GXLST)arg1) → None:
Get a list of all views/groups in this map.
Parameters:arg1 (geosoft.gxapi.GXLST) – list to hold the view/groups. Names may be up to 2080 characters in length.
Returns:Nothing
Return type:None

New in version 5.0.0.

Note:

Returns all groups in the form "ViewNameGroupName"
To get a LST of groups in a specific map view, use
the geosoft.gxapi.GXMVIEW.list_groups() function.
group_list_ex((GXLST)arg1, (int)arg2) → None:
Get a list of views/groups in this map for this mode
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.1.2.

See also

geosoft.gxapi.GXLST class.

is_null() → bool

Check if the instance of geosoft.gxapi.GXMAP is null (undefined)

Returns:True if this is a null instance of geosoft.gxapi.GXMAP, False otherwise.
Return type:bool`
static null() → GXMAP

A null (undefined) instance of geosoft.gxapi.GXMAP

Returns:A null geosoft.gxapi.GXMAP
Return type:geosoft.gxapi.GXMAP
pack_files() → None:
Pack all files in the map so that it can be mailed.
Returns:Nothing
Return type:None

New in version 5.0.0.

packed_files() → int:
The number of packed files in the current map.
Returns:The number of packed files in map.
Return type:int

New in version 6.4.0.

render((str)arg1) → None:
Render a map to file/device.
Parameters:arg1 (str) – Plot file/device
Returns:Nothing
Return type:None

New in version 5.0.0.

render_bitmap((str)arg1, (float)arg2, (float)arg3, (float)arg4, (float)arg5, (str)arg6, (int)arg7) → None:
Render a map to a bitmap.
Parameters:
  • arg1 (str) – View we exporting units in
  • arg2 (float) – MinX
  • arg3 (float) – MinY
  • arg4 (float) – MaxX
  • arg5 (float) – MaxY
  • arg6 (str) – File to generate (ext forced to BMP)
  • arg7 (int) – Maximum resolution in either direction, -1 for none (will change the pixel density of image if exceeded)
Returns:

Nothing

Return type:

None

New in version 6.0.0.

resize_all() → None:
Resize a map to the extents of all views.
Returns:Nothing
Return type:None

New in version 5.0.0.

Note:

This is the same as geosoft.gxapi.GXMAP.resize_all_ex() with
MVIEW_EXTENT_CLIP.
resize_all_ex((int)arg1) → None:
geosoft.gxapi.GXMAP.resize_all() with selection of view extent type selection.
Parameters:arg1 (int) – MVIEW_EXTENT constants
Returns:Nothing
Return type:None

New in version 6.3.0.

Note:

MVIEW_EXTENT_VISIBLE gives a more "reasonable" map size, and won't
clip off labels outside a graph window.
save_as_mxd((str)arg1) → None:
Save as ArcGIS MXD
Parameters:arg1 (str) – Geosoft map file name
Returns:Nothing
Return type:None

New in version 7.0.0.

set_class_name((str)arg1, (str)arg2) → None:
Set a class name.
Parameters:
  • arg1 (str) – class
  • arg2 (str) – name
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

Map class names are intended to be used to record the
names of certain view classes in the map, such as the
"Data", "Base" and "Section" views.

There can only be one name for each class, but it can
be changed.  This lets the "Data" class name change,
for example, so plotting can select which class to plot
to.

If a name is not set, the class name is set and
returned.
set_current() → None:
Sets the current map to this map.
Returns:Nothing
Return type:None

New in version 5.0.0.

set_map_name((str)arg1) → None:
Set the Map Name of the Map.
Parameters:arg1 (str) – Map Name
Returns:Nothing
Return type:None

New in version 5.0.0.

set_map_scale((float)arg1) → None:
Set the current map scale
Parameters:arg1 (float) – new map scale (must be > 0).
Returns:Nothing
Return type:None

New in version 5.0.0.

Note:

All views in the map will be resized for the new
map scale.
set_map_size((float)arg1, (float)arg2, (float)arg3, (float)arg4) → None:
Set the size of the Map.
Parameters:
  • arg1 (float) – X minimum in mm
  • arg2 (float) – Y minimun in mm
  • arg3 (float) – X maximum in mm
  • arg4 (float) – Y maximum in mm
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

The map size is area on the MAP that contains graphics
to be plotted.  The area can be bigger or smaller that
the current views.  In the absense of any other information
only the area defined by the map size is plotted.

See also

SetSizeViews_MAP

set_meta((GXMETA)arg1) → None:
Write a META to a map.
Parameters:arg1 (geosoft.gxapi.GXMETA) – META to write to map
Returns:Nothing
Return type:None

New in version 5.1.8.

set_reg((GXREG)arg1) → None:
Write a REG to a map.
Parameters:arg1 (geosoft.gxapi.GXREG) – REG to write to map
Returns:Nothing
Return type:None

New in version 5.0.0.

static sync((str)arg1) → None:
Syncronize the Metadata
Parameters:arg1 (str) – Geosoft map file name
Returns:Nothing
Return type:None

New in version 7.0.0.

un_pack_files() → None:
UnPack all files from map to workspace.
Returns:Nothing
Return type:None

New in version 5.0.0.

un_pack_files_ex((int)arg1, (str_ref)arg2) → None:
UnPack all files from map to workspace.
Parameters:
  • arg1 (int) – (0 - Produce errors, 1 - Force overwrites)
  • arg2 (geosoft.gxapi.str_ref) – List of files that are problematic returned
Returns:

Nothing

Return type:

None

New in version 6.4.0.

Note:

The option to force will simply overwrite the files.
When the non-force option is in effect the method will
stop if any files are going to be overwritting. These
file names will end up in the Errors string.
un_pack_files_to_folder((int)arg1, (str)arg2, (str_ref)arg3) → None:
UnPack all files from map to workspace.
Parameters:
  • arg1 (int) – (0 - Produce errors, 1 - Force overwrites)
  • arg2 (str) – Directory to place unpacked files in.
  • arg3 (geosoft.gxapi.str_ref) – List of files that are problematic returned
Returns:

Nothing

Return type:

None

New in version 7.3.0.

view_list((GXLST)arg1) → None:
Get a list of all views in this map.
Parameters:arg1 (geosoft.gxapi.GXLST) – list to hold the views. View names may be up to 2080 characters in length.
Returns:Nothing
Return type:None

New in version 5.0.0.

See also

geosoft.gxapi.GXLST class.

view_list_ex((GXLST)arg1, (int)arg2) → None:
Get a list of views of certain types in this map
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.1.2.

DUPMAP constants

Duplicate Modes
gxapi.DUPMAP_BLANK = 0
Blank
gxapi.DUPMAP_COPY = 1
Copy all current contents
gxapi.DUPMAP_COPY_PRE62 = 2
Copy all current contents and save text for pre-6.2 versions.

MAP_EXPORT_BITS constants

Color Types
gxapi.MAP_EXPORT_BITS_24 = 24
24 Bit Color
gxapi.MAP_EXPORT_BITS_GREY8 = 9
8 Bit Gray Scale
gxapi.MAP_EXPORT_BITS_8 = 8
8 Bit Color
gxapi.MAP_EXPORT_BITS_GREY4 = 5
4 Bit Gray Scale
gxapi.MAP_EXPORT_BITS_4 = 4
4 Bit Color
gxapi.MAP_EXPORT_BITS_GREY1 = 1
1 Bit Gray Scale
gxapi.MAP_EXPORT_BITS_DEFAULT = 0
Default Resolution

MAP_EXPORT_FORMAT constants

Export Formats
Format   Description                  Type
=======  ==========================   ====
gxapi.MAP_EXPORT_FORMAT_PLT = 'PLT'
"PLT"    Geosoft Plot (\ `*`\ .plt)         Plot
gxapi.MAP_EXPORT_FORMAT_SHP = 'SHP'
"SHP"    ArcView Shapfile (\ `*`\ .shp)     Plot
gxapi.MAP_EXPORT_FORMAT_DXF12 = 'DXF12'
"DXF12"  AutoCad12 (\ `*`\ .dxf)            Plot
gxapi.MAP_EXPORT_FORMAT_DXF13 = 'DXF13'
"DXF13"  AutoCad13 (\ `*`\ .dxf)            Plot
gxapi.MAP_EXPORT_FORMAT_GTIFF = 'GTIFF'
"GTIFF"  GeoTIFF (\ `*`\ .tif),             Color Image
gxapi.MAP_EXPORT_FORMAT_MTIFF = 'MTIFF'
"MTIFF"  MapInfo TIFF (\ `*`\ .tif)         Color Image
gxapi.MAP_EXPORT_FORMAT_ATIFF = 'ATIFF'
"ATIFF"  ArcView TIFF (\ `*`\ .tif)         Color Image
gxapi.MAP_EXPORT_FORMAT_GEO = 'GEO'
"GEO"    Geosoft COLOR grid (\ `*`\ .grd)   Color Image
gxapi.MAP_EXPORT_FORMAT_ERM = 'ERM'
"ERM"    ER Mapper RGB (\ `*`\ .ers)        Color Image
gxapi.MAP_EXPORT_FORMAT_KMZ = 'KMZ'
"KMZ"    Keyhole Markup (\ `*`\ .kmz)       Zipped XML/Image files

MAP_EXPORT_METHOD constants

Dithering Methods
gxapi.MAP_EXPORT_METHOD_STANDARD = 0
Standard Dither
gxapi.MAP_EXPORT_METHOD_DIFFUSE = 1
Error Diffusion Dither
gxapi.MAP_EXPORT_METHOD_NONE = 2
No Dither

MAP_EXPORT_RASTER_FORMAT constants

Export Raster Formats
.
Format  Description                      Type           B/W  B/W  COL  B/W  COL  COL
======= ==========================       ===========    ===  ===  ===  ===  ===  ===
gxapi.MAP_EXPORT_RASTER_FORMAT_EMF = 'EMF'
"EMF"   Enhanced Metafile (\ `*`\ .emf)        Plot
gxapi.MAP_EXPORT_RASTER_FORMAT_BMP = 'BMP'
"BMP"   Bitmap (\ `*`\ .bmp)                   Color Image     X    X    X    X    X    X
gxapi.MAP_EXPORT_RASTER_FORMAT_JPEGL = 'JPEGL'
"JPEGL" JPEG Low Quality (\ `*`\ .jpg)         Color Image                              X
gxapi.MAP_EXPORT_RASTER_FORMAT_JPEG = 'JPEG'
"JPEG" JPEG (\ `*`\ .jpg)                     Color Image                              X
gxapi.MAP_EXPORT_RASTER_FORMAT_JPEGH = 'JPEGH'
"JPEGH" JPEG High Quality (\ `*`\ .jpg)        Color Image                              X
gxapi.MAP_EXPORT_RASTER_FORMAT_GIF = 'GIF'
"GIF"   GIF (\ `*`\ .gif)                      Color Image     X    X    X    X    X
gxapi.MAP_EXPORT_RASTER_FORMAT_PCX = 'PCX'
"PCX"   PCX (\ `*`\ .pcx)                      Color Image     X    X    X    X    X    X
gxapi.MAP_EXPORT_RASTER_FORMAT_PNG = 'PNG'
"PNG"   PNG (\ `*`\ .png)                      Color Image     X    X    X    X    X    X
gxapi.MAP_EXPORT_RASTER_FORMAT_EPS = 'EPS'
"EPS"   Encasulated PostScript (\ `*`\ .eps)   Color Image                    X
gxapi.MAP_EXPORT_RASTER_FORMAT_TIFF = 'TIFF'
"TIFF"  TIFF (\ `*`\ .tif)                     Color Image     X    X    X    X    X    X

MAP_LIST_MODE constants

Map List modes
gxapi.MAP_LIST_MODE_ALL = 0
gxapi.MAP_LIST_MODE_3D = 1
gxapi.MAP_LIST_MODE_NOT3D = 2

MAP_OPEN constants

Open Modes
gxapi.MAP_WRITENEW = 1
gxapi.MAP_WRITEOLD = 2