ExportVector

globalmapper.ExportVector(str aFilename, GM_VectorExportFormat_t32 aFormat, GM_LayerHandle_t32 aLayer, GM_Rectangle_t aWorldBounds, GM_VectorExportFlags_t32 aFlags, int aFormatOptions) GM_Error_t32[source]

Exports one or more layers to a new vector file. If 0 is passed for the layer handle list, all vector layers will be saved to the new vector file, otherwise only the specified layer will be exported. If 0 is provided for the world bounds, all available data will be exported, otherwise only data within the specified bounds will be exported.

The new vector file create will be in the current view projection as returned by the GetProjection function. You can change the view projection, and thus the export projection, by calling the SetProjection function.

Parameters:
  • aFilename (str) – Name of new file to create

  • aFormat (GM_VectorExportFormat_t32) – Format to export

  • aLayer (GM_LayerHandle_t32) – Layer to export or gm.NULL for all

  • aWorldBounds (GM_Rectangle_t) – World bounds to export or None for all

  • aFlags (GM_VectorExportFlags_t32) – Export flags

  • aFormatOptions (int) – Format-specific options (use gm.NULL or 0 for defaults)

Returns:

Error Code

Return type:

GM_Error_t32

Example

The following is an example of ExportVector.:

gm.ExportVector(target_dir + filename_wo_ext + "_contours.dxf", gm.GM_Export_DXF, contour_layer, None, gm.GM_VectorExportFlags_HideProgress + gm.GM_VectorExportFlags_GenPRJFile, 0x0)

For more context refer to the tutorial page on full example scripts.