GXMAPTEMPLATE class

class GXMAPTEMPLATE(handle=0)[source]

GXMAPTEMPLATE class.

A GXMAPTEMPLATE wraps and provides manipulation and usage for the XML content in map template files. See the annotated schema file maptemplate.xsd in the <GEOSOFT>maptemplate folder and the accompanying documentation in that folder for documentation on the file format.

__init__(handle=0)[source]

Initialize self. See help(type(self)) for accurate signature.

commit()[source]

Commit any changes to the map template to disk

New in version 6.3.

License: Geosoft End-User License

classmethod create(name, base, mode)[source]

Create a GXMAPTEMPLATE from an existing file.

Parameters
  • name (str) – Map Template file name

  • base (str) – Map Template base template to create from

  • mode (int) – MAPTEMPLATE_OPEN constants

Returns

GXMAPTEMPLATE Object

Return type

GXMAPTEMPLATE

New in version 6.3.

License: Geosoft Open License

Note: The base template name should be the file name part of a geosoft_maptemplate file in the <geosoft>maptemplate or <geosoftuser>maptemplate folders. A base file in the user folder will override any in the Geosoft install dir.

create_map(map, group)[source]

Create a map from the map template

Parameters
  • map (str) – New map file name (if it exists it will be overwritten)

  • group (str) – Group name to use for settings

New in version 6.3.

License: Geosoft End-User License

discard()[source]

Discard all changes made to the map template and reload from disk.

New in version 6.3.

License: Geosoft End-User License

get_file_name(name)[source]

Get the file name of the map template.

Parameters

name (str_ref) – Returned map template file name

New in version 6.3.

License: Geosoft End-User License

get_tmp_copy(tmp)[source]

Get a temporary XML file for manipulation of the map template.

Parameters

tmp (str_ref) – Returned temporary map template file name

New in version 6.3.

License: Geosoft End-User License

Note: After manipulating contents the object may be updated by a call to the UpdateFromTmpCopy method.

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

classmethod null()[source]

A null (undefined) instance of GXMAPTEMPLATE

Returns

A null GXMAPTEMPLATE

Return type

GXMAPTEMPLATE

refresh()[source]

Refresh the map template with any newly saved items

New in version 7.0.

License: Geosoft End-User License

render_preview(hdc, left, bottom, right, top)[source]

Create a preview of the map template onto a Windows DC handle

Parameters
  • hdc (int) – DC Handle

  • left (int) – Left value of the render rect in Windows coordinates (bottom>top)

  • bottom (int) – Bottom value

  • right (int) – Right value

  • top (int) – Top value

New in version 6.3.

License: Geosoft End-User License

render_preview_map_production(hdc, left, bottom, right, top)[source]

Render a preview for map sheet production purposes

Parameters
  • hdc (int) – DC Handle (pass 0 to just query the Data view pixel location)

  • left (int_ref) – Left value of the render rect in Windows coordinates (bottom>top)

  • bottom (int_ref) – Bottom value

  • right (int_ref) – Right value

  • top (int_ref) – Top value

New in version 6.4.

License: Geosoft End-User License

Note: This method can also be used to get the data view pixel location by passing a null DC handle. This help to plot the view contents preview from another location.

update_from_tmp_copy(tmp)[source]

Update the object contents from a temporary XML file that may have bee manipulated externally.

Parameters

tmp (str) – Temporary map template file name

New in version 6.3.

License: Geosoft End-User License

Note: This method will not modify the original contents of the file until a call to the the Commit method is made or the object is destroyed. A call to the Discard method will restore the contents to that of the original file. The temporary file is not deleted and should be to not leak file resources.

MAPTEMPLATE_OPEN constants

Open Modes

MAPTEMPLATE_WRITENEW

Create new empty map template (will overwrite existing files)

gxapi.MAPTEMPLATE_WRITENEW = 0
MAPTEMPLATE_EXIST

Create from existing template on disk

gxapi.MAPTEMPLATE_EXIST = 1