GXMAP class

class GXMAP(handle=0)

GXMAP class.

MAPs are containers for GXMVIEW objects. A view is a 3-D translation and a clip window on a map. Graphic entities can be drawn in an GXMVIEW. It is recommended that the GXMAP class be instantiated by first creating an GXEMAP object and calling the GXEMAP.lock function. (See the explanation on the distinction between the GXMAP and GXEMAP classes).

agg_list(lst, optn)

Get a list of all aggregates in this map.

Parameters:
  • lst (GXLST) – List to hold the views (allow up to 96 characters)
  • optn (int) – 0 - view/agg only 1 - view/agg/layer

New in version 5.0.

License: Geosoft Open License

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

See also

GXLST class.

agg_list_ex(lst, optn, mode)

Get a list of aggregates in this map based on a mode

Parameters:
  • lst (GXLST) – List to hold the views (allow up to 96 characters)
  • optn (int) – 0 - view/agg only 1 - view/agg/layer
  • mode (int) – MAP_LIST_MODE constants

New in version 5.1.2.

License: Geosoft Open License

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

See also

GXLST class.

clean()

Clean up empty groups in all views in map.

New in version 5.0.

License: Geosoft Open License

commit()

Commit any changes to a map.

New in version 5.0.

License: Geosoft Open License

copy_map_to_view(dest_map, dest_view)

Copy entire map into one view in output map.

Parameters:
  • dest_map (str) – Destination GXMAP name
  • dest_view (str) – Name of View

New in version 5.1.8.

License: Geosoft Open License

crc_map(crc, file)

Generate an XML CRC of a GXMAP

Parameters:
  • crc (int_ref) – CRC returned
  • file (str) – Name of xml to generate (.zip added)

New in version 6.0.

License: Geosoft Open License

classmethod create(name, mode)

Create a GXMAP.

Parameters:
Returns:

GXMAP Object

Return type:

GXMAP

New in version 5.0.

License: Geosoft Open License

create_linked_3d_view(mview, view_name, min_x, min_y, max_x, max_y)

Create a 3D View in this map that is linked to a GXMVIEW in a 3D View file.

Parameters:
  • mview (GXMVIEW) – GX3DV‘s 3D GXMVIEW
  • view_name (str) – New view name
  • min_x (float) – X minimum in mm
  • min_y (float) – Y minimun in mm
  • max_x (float) – X maximum in mm
  • max_y (float) – Y maximum in mm

New in version 9.2.

License: Geosoft Open License

classmethod current()

This method returns the Current map opened.

Returns:GXMAP Object
Return type:GXMAP

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: If there is no current map, and running interactively, the user is prompted to open a map.

delete_view(name)

Deletes a view in this map.

Parameters:name (str) – View Name to delete

New in version 5.0.

License: Geosoft Open License

Note: If the view does not exist, nothing happens.

discard()

Discard all changes made to the map.

New in version 5.0.

License: Geosoft Open License

dup_map(ma_pd, content)

Duplicate copy of current map.

Parameters:

New in version 5.0.

License: Geosoft Open License

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(view, n_view, copy)

Duplicate an entire view

Parameters:
  • view (str) – Name of view to duplicate
  • n_view (str_ref) – Name of new view created (pass in “” and the new name is returned)
  • copy (bool) – Copy all groups

New in version 5.1.2.

License: Geosoft Open License

exist_view(name)

Checks to see if a view exists.

Parameters:name (str) – View name
Returns:0 view does not exist. 1 view exists.
Return type:int

New in version 5.0.

License: Geosoft Open License

export_all_in_view(name, view, pix_size, dpi, bits, dither, format, options)

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:
  • name (str) – File Name To Export
  • view (str) – View to export coordinates in
  • pix_size (float) – Resolution in view units of one pixel (or dummy, will be used if DPI is dummy)
  • dpi (float) – Resolution in DPI (will override view resolution if not dummy, map page size will be used to determine pixel size of output)
  • bits (int) – MAP_EXPORT_BITS constants
  • dither (int) – MAP_EXPORT_METHOD constants
  • format (str) – MAP_EXPORT_FORMAT constants
  • options (str) – Extended Options String (format specific)

New in version 7.1.

License: Geosoft Open License

export_all_raster(name, view, size_x, size_y, dpi, bits, dither, format, options)

Export the entire map to map to a non-geo raster format.

Parameters:
  • name (str) – File Name To Export
  • view (str) – View to export coordinates in
  • size_x (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)
  • size_y (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)
  • dpi (float) – Resolution in DPI (will override X and Y if not dummy, map page size will be used to determine pixel size of output)
  • bits (int) – MAP_EXPORT_BITS constants
  • dither (int) – MAP_EXPORT_METHOD constants
  • format (str) – MAP_EXPORT_RASTER_FORMAT constants
  • options (str) – Extended Options String (format specific)

New in version 7.1.

License: Geosoft Open License

export_area_in_view(name, view, pix_size, dpi, bits, dither, min_x, min_y, max_x, max_y, format, options)

Export an area of a map in view units to an external format

Parameters:
  • name (str) – File Name To Export
  • view (str) – View to export coordinates in
  • pix_size (float) – Resolution in view units of one pixel (or dummy, will be used if DPI is dummy)
  • dpi (float) – Resolution in DPI (will override view resolution if not dummy, map page size will be used to determine pixel size of output)
  • bits (int) – MAP_EXPORT_BITS constants
  • dither (int) – MAP_EXPORT_METHOD constants
  • min_x (float) – Area To Export Min X location in view units
  • min_y (float) – Area To Export Min Y location in view units
  • max_x (float) – Area To Export Max X location in view units
  • max_y (float) – Area To Export Max Y location in view units
  • format (str) – MAP_EXPORT_FORMAT constants
  • options (str) – Extended Options String (format specific)

New in version 7.1.

License: Geosoft Open License

export_area_raster(name, view, min_x, min_y, max_x, max_y, size_x, size_y, dpi, bits, dither, format, options)

Export an area of a map to a non-geo raster format.

Parameters:
  • name (str) – File Name To Export
  • view (str) – View to export coordinates in
  • min_x (float) – Area To Export Min X location in view units
  • min_y (float) – Area To Export Min Y location in view units
  • max_x (float) – Area To Export Max X location in view units
  • max_y (float) – Area To Export Max Y location in view units
  • size_x (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)
  • size_y (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)
  • dpi (float) – Resolution in DPI (will override X and Y if not dummy, map page size will be used to determine pixel size of output)
  • bits (int) – MAP_EXPORT_BITS constants
  • dither (int) – MAP_EXPORT_METHOD constants
  • format (str) – MAP_EXPORT_RASTER_FORMAT constants
  • options (str) – Extended Options String (format specific)

New in version 7.1.

License: Geosoft Open License

get_class_name(cl, name)

Get a class name.

Parameters:
  • cl (str) – Class
  • name (str_ref) – Name

New in version 5.0.

License: Geosoft Open License

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()

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.

License: Geosoft Open License

get_file_name(name)

Get the name of the map.

Parameters:name (str_ref) – Returned map file name

New in version 5.0.

License: Geosoft Open License

get_lpt()

Get the GXLPT Object of a GXMAP.

Returns:GXLPT Object
Return type:GXLPT

New in version 5.0.

License: Geosoft Open License

get_map_name(name)

Get the Map Name of the Map.

Parameters:name (str_ref) – Returned map name

New in version 5.0.

License: Geosoft Open License

get_map_scale()

Get the current map scale

Returns:The current map scale
Return type:float

New in version 5.0.

License: Geosoft Open License

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(xmin, ymin, xmax, ymax)

Get the size of the Map.

Parameters:

New in version 5.0.

License: Geosoft Open License

get_meta()

Get the map’s GXMETA

Returns:GXMETA Object
Return type:GXMETA

New in version 5.1.8.

License: Geosoft Open License

Note: If the map has no GXMETA, an empty GXMETA will be created.

get_reg()

Get the map’s GXREG

Returns:GXREG Object
Return type:GXREG

New in version 5.0.

License: Geosoft Open License

Note: If the map has no GXREG, an empty GXREG will be created.

group_list(lst)

Get a list of all views/groups in this map.

Parameters:lst (GXLST) – List to hold the view/groups. Names may be up to 2080 characters in length.

New in version 5.0.

License: Geosoft Open License

Note: Returns all groups in the form “ViewNameGroupName” To get a GXLST of groups in a specific map view, use the GXMVIEW.list_groups function.

See also

GXLST class. GXMVIEW.list_groups

group_list_ex(lst, mode)

Get a list of views/groups in this map for this mode

Parameters:

New in version 5.1.2.

License: Geosoft Open License

See also

GXLST class.

is_null()

Check if this is a null (undefined) instance

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

A null (undefined) instance of GXMAP

Returns:A null GXMAP
Return type:GXMAP
pack_files()

Pack all files in the map so that it can be mailed.

New in version 5.0.

License: Geosoft Open License

packed_files()

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.

License: Geosoft Open License

render(name)

Render a map to file/device.

Parameters:name (str) – Plot file/device

New in version 5.0.

License: Geosoft Open License

render_bitmap(view, min_x, min_y, max_x, max_y, file, max_res)

Render a map to a bitmap.

Parameters:
  • view (str) – View we exporting units in
  • min_x (float) – MinX
  • min_y (float) – MinY
  • max_x (float) – MaxX
  • max_y (float) – MaxY
  • file (str) – File to generate (BMP or PNG, otherwise extension forced to BMP)
  • max_res (int) – Maximum resolution in either direction, -1 for none (will change the pixel density of image if exceeded)

New in version 6.0.

License: Geosoft Open License

resize_all()

Resize a map to the extents of all views.

New in version 5.0.

License: Geosoft Open License

Note: This is the same as resize_all_ex with MVIEW_EXTENT_CLIP.

resize_all_ex(ext)

resize_all with selection of view extent type selection.

Parameters:ext (int) – MVIEW_EXTENT constants

New in version 6.3.

License: Geosoft Open License

Note: MVIEW_EXTENT_VISIBLE gives a more “reasonable” map size, and won’t clip off labels outside a graph window.

save_as_mxd(mxd)

Save as ArcGIS GXMXD

Parameters:mxd (str) – Geosoft map file name

New in version 7.0.

License: Geosoft End-User License

set_class_name(cl, name)

Set a class name.

Parameters:
  • cl (str) – Class
  • name (str) – Name

New in version 5.0.

License: Geosoft Open License

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()

Sets the current map to this map.

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

set_map_name(name)

Set the Map Name of the Map.

Parameters:name (str) – Map Name

New in version 5.0.

License: Geosoft Open License

set_map_scale(scale)

Set the current map scale

Parameters:scale (float) – New map scale (must be > 0).

New in version 5.0.

License: Geosoft Open License

Note: All views in the map will be resized for the new map scale.

set_map_size(xmin, ymin, xmax, ymax)

Set the size of the Map.

Parameters:
  • xmin (float) – X minimum in mm
  • ymin (float) – Y minimun in mm
  • xmax (float) – X maximum in mm
  • ymax (float) – Y maximum in mm

New in version 5.0.

License: Geosoft Open License

Note: The map size is area on the GXMAP 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(meta)

Write a GXMETA to a map.

Parameters:meta (GXMETA) – GXMETA to write to map

New in version 5.1.8.

License: Geosoft Open License

set_reg(reg)

Write a GXREG to a map.

Parameters:reg (GXREG) – GXREG to write to map

New in version 5.0.

License: Geosoft Open License

classmethod sync(map)

Syncronize the Metadata

Parameters:map (str) – Geosoft map file name

New in version 7.0.

License: Geosoft End-User License

un_pack_files()

UnPack all files from map to workspace.

New in version 5.0.

License: Geosoft Open License

un_pack_files_ex(force, errors)

UnPack all files from map to workspace.

Parameters:
  • force (int) – (0 - Produce errors, 1 - Force overwrites)
  • errors (str_ref) – List of files that are problematic returned

New in version 6.4.

License: Geosoft Open License

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(force, dir, errors)

UnPack all files from map to workspace.

Parameters:
  • force (int) – (0 - Produce errors, 1 - Force overwrites)
  • dir (str) – Directory to place unpacked files in.
  • errors (str_ref) – List of files that are problematic returned

New in version 7.3.

License: Geosoft Open License

view_list(lst)

Get a list of all views in this map.

Parameters:lst (GXLST) – List to hold the views. View names may be up to 2080 characters in length.

New in version 5.0.

License: Geosoft Open License

See also

GXLST class.

view_list_ex(lst, mode)

Get a list of views of certain types in this map

Parameters:

New in version 5.1.2.

License: Geosoft Open License

DUPMAP constants

Duplicate Modes

DUPMAP_BLANK

Blank

gxapi.DUPMAP_BLANK = 0
DUPMAP_COPY

Copy all current contents

gxapi.DUPMAP_COPY = 1
DUPMAP_COPY_PRE62

Copy all current contents and save text for pre-6.2 versions.

gxapi.DUPMAP_COPY_PRE62 = 2

MAP_EXPORT_BITS constants

Color Types

MAP_EXPORT_BITS_24

24 Bit Color

gxapi.MAP_EXPORT_BITS_24 = 24
MAP_EXPORT_BITS_GREY8

8 Bit Gray Scale

gxapi.MAP_EXPORT_BITS_GREY8 = 9
MAP_EXPORT_BITS_8

8 Bit Color

gxapi.MAP_EXPORT_BITS_8 = 8
MAP_EXPORT_BITS_GREY4

4 Bit Gray Scale

gxapi.MAP_EXPORT_BITS_GREY4 = 5
MAP_EXPORT_BITS_4

4 Bit Color

gxapi.MAP_EXPORT_BITS_4 = 4
MAP_EXPORT_BITS_GREY1

1 Bit Gray Scale

gxapi.MAP_EXPORT_BITS_GREY1 = 1
MAP_EXPORT_BITS_DEFAULT

Default Resolution

gxapi.MAP_EXPORT_BITS_DEFAULT = 0

MAP_EXPORT_FORMAT constants

Export Formats Format Description Type ======= ========================== ====

MAP_EXPORT_FORMAT_PLT

“PLT” Geosoft Plot (*.plt) Plot

gxapi.MAP_EXPORT_FORMAT_PLT = 'PLT'
MAP_EXPORT_FORMAT_SHP

GXSHP” ArcView Shapfile (*.shp) Plot

gxapi.MAP_EXPORT_FORMAT_SHP = 'SHP'
MAP_EXPORT_FORMAT_DXF12

“DXF12” AutoCad12 (*.dxf) Plot

gxapi.MAP_EXPORT_FORMAT_DXF12 = 'DXF12'
MAP_EXPORT_FORMAT_DXF13

“DXF13” AutoCad13 (*.dxf) Plot

gxapi.MAP_EXPORT_FORMAT_DXF13 = 'DXF13'
MAP_EXPORT_FORMAT_GTIFF

“GTIFF” GeoTIFF (*.tif), Color Image

gxapi.MAP_EXPORT_FORMAT_GTIFF = 'GTIFF'
MAP_EXPORT_FORMAT_MTIFF

“MTIFF” MapInfo TIFF (*.tif) Color Image

gxapi.MAP_EXPORT_FORMAT_MTIFF = 'MTIFF'
MAP_EXPORT_FORMAT_ATIFF

“ATIFF” ArcView TIFF (*.tif) Color Image

gxapi.MAP_EXPORT_FORMAT_ATIFF = 'ATIFF'
MAP_EXPORT_FORMAT_GEO

GXGEO” Geosoft COLOR grid (*.grd) Color Image

gxapi.MAP_EXPORT_FORMAT_GEO = 'GEO'
MAP_EXPORT_FORMAT_ERM

“ERM” ER Mapper RGB (*.ers) Color Image

gxapi.MAP_EXPORT_FORMAT_ERM = 'ERM'
MAP_EXPORT_FORMAT_KMZ

“KMZ” Keyhole Markup (*.kmz) Zipped XML/Image files

gxapi.MAP_EXPORT_FORMAT_KMZ = 'KMZ'

MAP_EXPORT_METHOD constants

Dithering Methods

MAP_EXPORT_METHOD_STANDARD

Standard Dither

gxapi.MAP_EXPORT_METHOD_STANDARD = 0
MAP_EXPORT_METHOD_DIFFUSE

Error Diffusion Dither

gxapi.MAP_EXPORT_METHOD_DIFFUSE = 1
MAP_EXPORT_METHOD_NONE

No Dither

gxapi.MAP_EXPORT_METHOD_NONE = 2

MAP_EXPORT_RASTER_FORMAT constants

Export Raster Formats . Format Description Type B/W B/W COL B/W COL COL ======= ========================== =========== === === === === === ===

MAP_EXPORT_RASTER_FORMAT_EMF

“EMF” Enhanced Metafile (*.emf) Plot

gxapi.MAP_EXPORT_RASTER_FORMAT_EMF = 'EMF'
MAP_EXPORT_RASTER_FORMAT_BMP

“BMP” Bitmap (*.bmp) Color Image X X X X X X

gxapi.MAP_EXPORT_RASTER_FORMAT_BMP = 'BMP'
MAP_EXPORT_RASTER_FORMAT_JPEGL

“JPEGL” JPEG Low Quality (*.jpg) Color Image X

gxapi.MAP_EXPORT_RASTER_FORMAT_JPEGL = 'JPEGL'
MAP_EXPORT_RASTER_FORMAT_JPEG

“JPEG” JPEG (*.jpg) Color Image X

gxapi.MAP_EXPORT_RASTER_FORMAT_JPEG = 'JPEG'
MAP_EXPORT_RASTER_FORMAT_JPEGH

“JPEGH” JPEG High Quality (*.jpg) Color Image X

gxapi.MAP_EXPORT_RASTER_FORMAT_JPEGH = 'JPEGH'
MAP_EXPORT_RASTER_FORMAT_GIF

“GIF” GIF (*.gif) Color Image X X X X X

gxapi.MAP_EXPORT_RASTER_FORMAT_GIF = 'GIF'
MAP_EXPORT_RASTER_FORMAT_PCX

“PCX” PCX (*.pcx) Color Image X X X X X X

gxapi.MAP_EXPORT_RASTER_FORMAT_PCX = 'PCX'
MAP_EXPORT_RASTER_FORMAT_PNG

“PNG” PNG (*.png) Color Image X X X X X X

gxapi.MAP_EXPORT_RASTER_FORMAT_PNG = 'PNG'
MAP_EXPORT_RASTER_FORMAT_EPS

“EPS” Encasulated PostScript (*.eps) Color Image X

gxapi.MAP_EXPORT_RASTER_FORMAT_EPS = 'EPS'
MAP_EXPORT_RASTER_FORMAT_TIFF

“TIFF” TIFF (*.tif) Color Image X X X X X X

gxapi.MAP_EXPORT_RASTER_FORMAT_TIFF = 'TIFF'

MAP_LIST_MODE constants

Map List modes

MAP_LIST_MODE_ALL

All

gxapi.MAP_LIST_MODE_ALL = 0
MAP_LIST_MODE_3D

3d

gxapi.MAP_LIST_MODE_3D = 1
MAP_LIST_MODE_NOT3D

Not3d

gxapi.MAP_LIST_MODE_NOT3D = 2

MAP_OPEN constants

Open Modes

MAP_WRITENEW

Map writenew

gxapi.MAP_WRITENEW = 1
MAP_WRITEOLD

Map writeold

gxapi.MAP_WRITEOLD = 2