GXMAP class¶
- class GXMAP(handle=0)[source]¶
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 anGXMVIEW
. It is recommended that theGXMAP
class be instantiated by first creating anGXEMAP
object and calling theGXEMAP.lock
function. (See the explanation on the distinction between theGXMAP
andGXEMAP
classes).- agg_list(lst, optn)[source]¶
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)[source]¶
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()[source]¶
Clean up empty groups in all views in map.
New in version 5.0.
License: Geosoft Open License
- commit()[source]¶
Commit any changes to a map.
New in version 5.0.
License: Geosoft Open License
- copy_map_to_view(dest_map, dest_view)[source]¶
Copy entire map into one view in output map.
- Parameters:
dest_map (str) – Destination
GXMAP
namedest_view (str) – Name of View
New in version 5.1.8.
License: Geosoft Open License
- crc_map(crc, file)[source]¶
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)[source]¶
Create a
GXMAP
.- Parameters:
name (str) –
GXMAP
file namemode (int) – MAP_OPEN constants
- Returns:
GXMAP
Object- Return type:
New in version 5.0.
License: Geosoft Open License
- create_linked_3d_view(mview, view_name, min_x, min_y, max_x, max_y)[source]¶
Create a 3D View in this map that is linked to a
GXMVIEW
in a 3D View file.- Parameters:
New in version 9.2.
License: Geosoft Open License
- classmethod current()[source]¶
This method returns the Current map opened.
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.
- dataset_file_path_list(lst)[source]¶
Get a list of all dataset file paths in this map.
- Parameters:
lst (GXLST) – List to hold the paths. Paths may be up to 2080 characters in length.
New in version 2022.1.
License: Geosoft Open License
See also
GXLST
class.
- delete_empty_groups()[source]¶
Remove empty groups in the map, do not delete empty views.
New in version 2022.1.
License: Geosoft Open License
- delete_view(name)[source]¶
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()[source]¶
Discard all changes made to the map.
New in version 5.0.
License: Geosoft Open License
- dup_map(ma_pd, content)[source]¶
Duplicate copy of current map.
- Parameters:
content (int) – DUPMAP constants
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)[source]¶
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)[source]¶
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)[source]¶
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_in_view2(name, view, dpi, minX, minY, maxX, maxY, bits, dither, format, options)[source]¶
Same as ExportAllInView_MAP, but preset the range in X and Y to export (mm)
- Parameters:
name (str) – File Name To Export
view (str) – View to export coordinates in
dpi (float) – Resolution in DPI (will override view resolution if not dummy, map page size will be used to determine pixel size of output)
minX (float) – Base view minimum X (mm)
minY (float) – Base view minimum Y (mm)
maxX (float) – Base view maximum X (mm)
maxY (float) – Base view maximum Y (mm)
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 2024.2.
License: Geosoft Open License
- export_all_raster(name, view, size_x, size_y, dpi, bits, dither, format, options)[source]¶
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)[source]¶
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)[source]¶
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)[source]¶
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()[source]¶
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)[source]¶
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()[source]¶
Get the
GXLPT
Object of aGXMAP
.New in version 5.0.
License: Geosoft Open License
- get_map_name(name)[source]¶
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()[source]¶
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)[source]¶
Get the size of the Map.
- Parameters:
New in version 5.0.
License: Geosoft Open License
- get_meta()[source]¶
Get the map’s
GXMETA
New in version 5.1.8.
License: Geosoft Open License
Note: If the map has no
GXMETA
, an emptyGXMETA
will be created.
- get_reg()[source]¶
Get the map’s
GXREG
New in version 5.0.
License: Geosoft Open License
Note: If the map has no
GXREG
, an emptyGXREG
will be created.
- group_list(lst)[source]¶
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 theGXMVIEW.list_groups
function.See also
GXLST
class.GXMVIEW.list_groups
- group_list_ex(lst, mode)[source]¶
Get a list of views/groups in this map for this mode
- Parameters:
lst (GXLST) – List to hold the views. View names may be up to 2080 characters in length.
mode (int) – MAP_LIST_MODE constants
New in version 5.1.2.
License: Geosoft Open License
See also
GXLST
class.
- is_null()[source]¶
Check if this is a null (undefined) instance
- Returns:
True if this is a null (undefined) instance, False otherwise.
- Return type:
bool
- pack_files()[source]¶
Pack all files in the map so that it can be mailed.
New in version 5.0.
License: Geosoft Open License
- packed_files()[source]¶
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
- remove_geosurface(surface, removed)[source]¶
Remove all geosurface groups from a map that are linked to a specific geosurface file.
- Parameters:
surface (str) – geosurface file name to remove
removed (int_ref) – if at least one surface group is removed, returns 1, else returns 0
New in version 2024.1.
License: Geosoft Open License
- remove_grid(grid, removed)[source]¶
Remove references to a grid from a map.
- Parameters:
grid (str) – grid file name to remove
removed (int_ref) – if the grid link is removed, returns 1, else returns 0
New in version 2024.1.
License: Geosoft Open License
Note: If the grid is the only one in the AGG, the AGG group is deleted, otherwise only the BAND containing the reference is deleted from the AGG. Any COLORBAR or GRIDHIST group associated with the AGG group is deleted. This is name-dependent, and will not work if a user has renamed the color bar or grid histogram.
- remove_voxel(surface, removed)[source]¶
Remove all voxel groups from a map that are linked to a specific voxel file.
- Parameters:
surface (str) – voxel file name to remove
removed (int_ref) – if at least one voxel group is removed, returns 1, else returns 0
New in version 2024.1.
License: Geosoft Open License
- rename_view(current_name, new_name)[source]¶
Renames a view in this map.
- Parameters:
current_name (str) – Name of view to rename)
new_name (str) – New name of view
New in version 9.9.
License: Geosoft Open License
- render(name)[source]¶
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)[source]¶
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
- render_view_bitmap(view, group, min_x, min_y, max_x, max_y, file, max_res)[source]¶
Render a map view to a bitmap.
- Parameters:
group (int) – group (-1 for all)
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 9.6.
License: Geosoft Open License
- repair_broken_geosurface_links(surface, repaired)[source]¶
Replaces/repairs references to a geosurface inside a map.
- Parameters:
surface (str) – new geosurface file name path (must resolve to an existing file)
repaired (int_ref) – if the link is repaired, returns 1, else returns 0
New in version 2024.1.
License: Geosoft Open License
Note: The replacement/repair occurs only if the original reference, bearing the same file name, does not resolve to an existing geosurface. (Working links will not be affected). The replacement path must resolve to an existing geosurface, and if possible will be stored as a relative path to the map.
- repair_broken_grid_links(grid, repaired)[source]¶
Replaces/repairs references to a grid inside a map.
- Parameters:
grid (str) – new grid file name path (must resolve to an existing file)
repaired (int_ref) – if grid link is repaired, returns 1, else returns 0
New in version 2024.1.
License: Geosoft Open License
Note: The replacement/repair occurs only if the original reference, bearing the same file name and extension, does not resolve to an existing grid. (Working links will not be affected). The replacement path must resolve to an existing grid, and if possible will be stored as a relative path to the map.
- repair_broken_voxel_links(voxel, repaired)[source]¶
Replaces/repairs references to a Geosoft Voxel inside a map.
- Parameters:
voxel (str) – new voxel file name path (must resolve to an existing file)
repaired (int_ref) – if the link is repaired, returns 1, else returns 0
New in version 2024.1.
License: Geosoft Open License
Note: The replacement/repair occurs only if the original reference, bearing the same file name, does not resolve to an existing voxel. (Working links will not be affected). The replacement path must resolve to an existing voxel, and if possible will be stored as a relative path to the map.
- resize_all()[source]¶
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
withMVIEW_EXTENT_CLIP
.
- resize_all_ex(ext)[source]¶
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)[source]¶
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)[source]¶
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()[source]¶
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)[source]¶
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)[source]¶
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)[source]¶
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)[source]¶
Write a
GXMETA
to a map.New in version 5.1.8.
License: Geosoft Open License
- set_reg(reg)[source]¶
Write a
GXREG
to a map.New in version 5.0.
License: Geosoft Open License
- classmethod sync(map)[source]¶
Syncronize the Metadata
- Parameters:
map (str) – Geosoft map file name
New in version 7.0.
License: Geosoft End-User License
- un_pack_files()[source]¶
UnPack all files from map to workspace.
New in version 5.0.
License: Geosoft Open License
- un_pack_files_ex(force, errors)[source]¶
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)[source]¶
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)[source]¶
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)[source]¶
Get a list of views of certain types in this map
- Parameters:
lst (GXLST) – List to hold the views. View names may be up to 2080 characters in length.
mode (int) – MAP_LIST_MODE constants
New in version 5.1.2.
License: Geosoft Open License
DUPMAP constants¶
Duplicate Modes
MAP_EXPORT_BITS constants¶
Color Types
MAP_EXPORT_FORMAT constants¶
Export Formats Format Description Type ======= ========================== ====
- MAP_EXPORT_FORMAT_GTIFF¶
“GTIFF” GeoTIFF (
*.tif
), Color Image- gxapi.MAP_EXPORT_FORMAT_GTIFF = 'GTIFF'¶
- MAP_EXPORT_FORMAT_CGTIFF¶
“CGTIFF” GeoTIFF Compressed (
*.tif
), Color Image- gxapi.MAP_EXPORT_FORMAT_CGTIFF = 'CGTIFF'¶
- 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_METHOD constants¶
Dithering Methods
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_LIST_MODE constants¶
Map List modes
MAP_OPEN constants¶
Open Modes