LoadVectorFromWKTString

globalmapper.LoadVectorFromWKTString(str aWKTString, str aLayerName, GM_Projection_t aProj) GM_Error_t32, GM_LayerHandle_t32[source]

The LoadVectorFromWKTString function supports loading a WKT (Well-Known Text) Geometry string. The function takes in three parameters and returns two values. It supports WKT geometry definitions for Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon. The function will create a new layer every time it runs successfully. The user will set the layer name as the second parameter, and a GM_Projection_t for the third. The user can set the third parameter to None to use the current global projection; if there is no global projection, the function will fail and return error code GM_Error_InvalidParam. The possible errors returned from the function include: GM_Error_None if the function completed successfully. GM_Error_InvalidParam if the WKT string is invalid or no projection was provided and none is currently active. GM_Error_LoadError if the WKT data was unable to be loaded in GM for any reason.

The layer handle can be used in other calls into the library. The layer must be closed by calling CloseLayer when the caller is done using it.

Parameters:
  • aWKTString (str) – WKT geometry string to be loaded into Global Mapper

  • aLayer (str) – The layer name to load the WKT string to

  • aProj (GM_Projection_t) – Projection system the area coordinates are in (use None for current projection)

Returns:

Error Code

Return type:

GM_Error_t32

Returns:

The layer that was loaded

Return type:

GM_LayerHandle_t32

Example

The following is an example of LoadVectorFromWKTString.:

import globalmapper as gm
err, alayer = gm.LoadVectorFromWKTString("POINT(10 20)", "WKTGeometry", None)