#
# Custom GlobalMapper module (EXAMPLE)
#
import globalmapper as gm
[docs]class Point_t(gm.GM_Point_t):
"""This describes a single point location
Parameters
__________
mX: float
X (or longitude) coordinate
mY: float
Y (or latitude) coordinate
"""
def __init__(self, mX: float, mY: float):
super().__init__()
# Fields
self.mX = mX
self.mY = mY
[docs]class LidarReturnInfo_t(gm.GM_LidarReturnInfo_t):
"""Statistics about different Lidar point types. This can be used for statistics for a single class or return type
Parameters
__________
mCount: int
Number of points encountered of this type
mMinZ: int
Minimum Z value
mMaxZ: int
Maximum Z value
mMinI: int
Minimum Intensity value
mMaxI: int
Maximum Intensity value
mSyntheticCount: int
Synthetic count
mWithheldCount: int
Withheld count
mKeyPointCount: int
Model key count
mOverlapCount: int
Overlap point count
"""
def __init__(self, mCount: int = 0, mMinZ: int = 0, mMaxZ: int = 0, mMinI: int = 0, mMaxI: int = 0,
mSyntheticCount: int = 0, mWithheldCount: int = 0, mKeyPointCount: int = 0, mOverlapCount: int = 0):
super().__init__()
self.mCount = mCount
self.mMinZ = mMinZ
self.mMaxZ = mMaxZ
self.mMinI = mMinI
self.mMaxI = mMaxI
self.mSyntheticCount = mSyntheticCount
self.mWithheldCount = mWithheldCount
self.mKeyPointCount = mKeyPointCount
self.mOverlapCount = mOverlapCount
[docs]class LidarAttrInfo_t(gm.GM_LidarAttrInfo_t):
"""Definition of statistics for each Lidar attribute
LidarAttrInfo_t(mMinVal: int=0, mMaxVal: int=0)
Parameters
__________
mMinVal: int
Minimum encountered value
mMaxVal: int
Maximum encountered value
"""
def __init__(self, mMinVal: int = 0, mMaxVal: int = 0):
super().__init__()
self.mMinVal = mMinVal
self.mMaxVal = mMaxVal
[docs]class LidarPoint_t(gm.GM_LidarPoint_t):
"""This type is used to return information about Lidar point cloud features
LidarPoint_t(mLayer: int = 0, mPointIdx: int = 0, mFlags: int = 0, mPos= Point_t(0, 0), mElevMeters: float = 0,
mIntensity: int = 0, mClass=gm.GM_LidarClass_Unclassified, mRetNum: int = 0, mRetCount: int = 0,
mUserData: int = 0, mScannerChannel: int = 0, mScanAngle: int = 0, mGpsTime: float = 0.0, mSourceId: int = 0,
mRed: int = 0, mGreen: int = 0, mBlue: int = 0, mNIR: int = 0)
Parameters
___________
mLayer: int
Layer the point is from
mPointIdx: int
Point index in cloud
mFlags: int
Flags about the point
mPos: Point_t
Location of the point (global coordinates when getting, native when adding feature)
mElevMeters: float
Elevation of point in meters
mIntensity: int
Intensity
mClass: GM_LidarClass_t8, int
Classification
mRetNum: int
Return number
mRetCount: int
Number of returns
mUserData: int
User data
mScannerChannel: int
Scanner channel
mScanAngle: float
Scan Angle
mGpsTime: double (float)
GPS time
mSourceId: int
Point Source ID
mRed: int
Red color value
mGreen: int
Green color value
mBlue: int
Blue color value
mNIR: int
NIR (near infrared) value
"""
def __init__(self, mLayer: int=0, mPointIdx: int=0, mFlags: int=0, mPos=Point_t(0, 0), mElevMeters: float=0, mIntensity: int=0, mClass=gm.GM_LidarClass_Unclassified,
mRetNum: int=0, mRetCount: int=0, mUserData: int = 0, mScannerChannel: int=0, mScanAngle: int=0,
mGpsTime: float = 0.0, mSourceId: int = 0, mRed: int = 0, mGreen: int = 0, mBlue: int = 0, mNIR: int = 0):
super().__init__()
self.mLayer = mLayer
self.mPointIdx = mPointIdx
self.mFlags = mFlags
self.mPos = mPos
self.mElevMeters = mElevMeters
self.mIntensity = mIntensity
self.mClass = mClass
self.mRetNum = mRetNum
self.mRetCount = mRetCount
self.mUserData = mUserData
self.mScannerChannel = mScannerChannel
self.mScanAngle = mScanAngle
self.mGpsTime = mGpsTime
self.mSourceId = mSourceId
self.mRed = mRed
self.mGreen = mGreen
self.mBlue = mBlue
self.mNIR = mNIR
[docs]class ElevColor_t(gm.GM_ElevColor_t):
"""This type represents a single elevation/color pair for a custom shader
ElevColor_t(mElev: float=5, mColor: int=0xFFFFFFFF)
Parameters
___________
mElev: float, default 5
Elevation value in meters
mColor: COLORREF, int, default 0xFFFFFFFF
Color value
"""
#TODO methods
def __init__(self, mElev: float = 5, mColor: int = 0xFFFFFFFF):
super().__init__()
self.mElev = mElev
self.mColor = mColor
[docs]class AttrValue_t(gm.GM_AttrValue_t):
"""This type is used to represent a single attribute value pair
AttrValue_t(mName:str , mVal: str)
Parameters
___________
mName: string
Name of the attribute
mVal: string
Value of the attribute
"""
def __init__(self, mName: str, mVal: str):
super().__init__()
# Fields
self.mName = str(mName)
self.mVal = str(mVal)
[docs]class OnlineSourceInfo_t(gm.GM_OnlineSourceInfo_t):
"""This type is used to return information about available online sources
OnlineSourceInfo_t( mAttrList: gm.GM_AttrValue_array = gm.GM_AttrValue_array(0), mAttrListSize: int = 0, \
mType: int = gm.GM_SourceType_WMS, mName: str = 'Default Online name'))
Parameters
___________
mName: str
Name of the online source. This can be passed to LoadOnlineLayer
mType: GM_OnlineSourceType_t, int, default=gm.GM_SourceType_WMS
Source type
mAttrList: AttrValue_array
List of additional attributes and values for the source
mAttrListSize: int, uint32
Number of entries in mAttrList
"""
def __init__(self, mName: str = 'Default Online name', mType: int = gm.GM_SourceType_WMS,
mAttrList: gm.GM_AttrValue_array = gm.GM_AttrValue_array(1), mAttrListSize: int = 0):
super().__init__()
# Fields
self.mAttrList = mAttrList # when setting, use "obj.mAttrList = array_var.cast()". Without calling .cast(), it may not always work
self.mAttrListSize = mAttrListSize
self.mName = mName
self.mType = mType
# has methods
[docs]class CustomShader_t(gm.GM_CustomShader_t):
"""This type represents a custom elevation shader
CustomShader_t(mShaderName: str = None, mFlags: int = gm.GM_CustomShader_DontBlend,mNumElevs: int = 1,
mElevColorList: gm.GM_ElevColor_array = gm.GM_ElevColor_array(1))
Parameters
____________
mShaderName: str
Name to use for the shader, default=None
mFlags: GM_CustomShaderFlags_t32, int, default=gm.GM_CustomShader_DontBlend
Shader flags
mNumElevs: int, uint32, default=1
Number of elements in the argument mElevColorList
mElevColorList: ElevColor_array
List of elevation/color pairs for shader
"""
def __init__(self, mShaderName: str = None, mFlags: int = gm.GM_CustomShader_DontBlend, mNumElevs: int = 1,
mElevColorList: gm.GM_ElevColor_array = gm.GM_ElevColor_array(1)):
super().__init__()
# Fields
self.mShaderName = mShaderName
self.mFlags = mFlags
self.mElevColorList = mElevColorList # when setting, use "obj.mElevColorList = array_var.cast()". Without calling .cast(), it may not always work
self.mNumElevs = mNumElevs
[docs]class GroundControlPoint_t(gm.GM_GroundControlPoint_t):
"""This type is used when rectifying imagery
GroundControlPoint_t(mPixelX: float = 0, mPixelY: float = 0, mGroundX: float = 0, mGroundY: float = 0)
Parameters
__________
mPixelX: float
X pixel coordinate of GCP
mPixelY: float
Y pixel coordinate of GCP (top is 0, increases down)
mGroundX: float
X ground coordinate of GCP (in provided projection)
mGroundY: float
Y ground coordinate of GCP (in provided projection)
"""
def __init__(self, mPixelX: float = 0, mPixelY: float = 0, mGroundX: float = 0, mGroundY: float = 0):
super().__init__(mPixelX, mPixelY, mGroundX, mGroundY)
# class for dtype parameter of array()
[docs]class uint8(int):
"""Unsigned character type definition. 0 to 255.
"""
def __new__(cls, val):
if val > 255:
raise OverflowError('Max size for type uint8 is 255')
elif val < 0:
raise OverflowError('Min size for type uint8 is 0')
return int.__new__(cls, val)
# class for dtype parameter of array()
[docs]class uint32(int):
"""Unsigned long integer type definition. 0 to 4294967295.
"""
def __new__(cls, val):
if val > 4294967295:
raise OverflowError('Max size for type uint32 is 4294967295')
elif val < 0:
raise OverflowError('Min size for type uint32 is 0')
return int.__new__(cls, val)
# class for dtype parameter of array()
[docs]class LayerHandle_t(int):
"""This type is used to reference a single layer loaded by the DLL.
"""
def __new__(cls, val):
return int.__new__(cls, val)
# class for dtype parameter of array()
[docs]class COLORREF(int):
"""This type is used to represent a single color palette entry
"""
def __new__(cls, val):
return int.__new__(cls, val)
# A factory method pattern for array construction
[docs]def array(*args, **kwargs):
"""Factory method function for creating globalmapper.py arrays
"""
dtype = None
size = -1
elements = []
# extract variables from kwargs
for key, value in kwargs.items():
if key == "dtype":
dtype = value
elif key == "size":
size = value
else:
raise TypeError("Invalid key. Must be 'dtype' or 'size'")
# check *args if both keys are not set
if len(args) < 1:
if (size==-1 or dtype==None):
raise TypeError("array() missing required argument 'list/tuple/int' (pos 0)")
else:
# get elements / size
if isinstance(args[0], list) or isinstance(args[0], tuple):
elements = list(args[0])
if size == -1:
size = len(elements)
elif isinstance(args[0], int):
# give priority to size key, notify user to prevent confusion
if size == -1:
size = args[0]
else:
raise TypeError("Key 'size' will take priority for setting the size of the array over args[0]")
else:
raise TypeError("*args must be of type 'list', 'tuple', or 'int'")
# set dtype if null
if dtype is None:
if len(elements) > 0:
dtype = elements[0].__class__
else:
# if dtype was not set by key and elements is empty, value error
raise TypeError("Either a 'dtype' key must be passed or elements provided")
check = dtype
#print(f"{check=} vs {type(elements[0])}, {check==gm.GM_AttrValue_t}")
# also generalize for the basic types
if dtype == uint8 or dtype == uint32 or dtype == LayerHandle_t or dtype == COLORREF:
check = int
# check type
for e in elements:
if not isinstance(e, check):
raise TypeError("Unexpected type in passed elements")
arr = 0 # variable for storing the array
if dtype == Point_t or dtype == gm.GM_Point_t:
arr = gm.GM_Point_t_array(size)
elif dtype == uint8:
arr = gm.uint8_array(size)
elif dtype == uint32:
arr = gm.uint32_array(size)
elif dtype == LayerHandle_t:
arr = gm.GM_LayerHandle_array(size)
elif dtype == GroundControlPoint_t or dtype == gm.GM_GroundControlPoint_t:
arr = gm.GM_GroundControlPoint_array(size)
elif dtype == AttrValue_t or dtype == gm.GM_AttrValue_t:
arr = gm.GM_AttrValue_array(size)
elif dtype == gm.GM_PaletteEntry_t:
arr = gm.GM_PaletteEntry_array(size)
elif dtype == CustomShader_t or dtype == gm.GM_CustomShader_t:
arr = gm.GM_CustomShader_array(size)
elif dtype == OnlineSourceInfo_t or dtype == gm.GM_OnlineSourceInfo_t:
arr = gm.GM_OnlineSourceInfo_array(size)
elif dtype == ElevColor_t or dtype == gm.GM_ElevColor_t:
arr = gm.GM_ElevColor_array(size)
elif dtype == COLORREF:
arr = gm.COLORREF_array(size)
elif dtype == LidarPoint_t or dtype == gm.GM_LidarPoint_t:
arr = gm.GM_LidarPoint_array(size)
elif dtype == float:
arr = gm.float_array(size)
elif dtype == LidarAttrInfo_t or dtype == gm.GM_LidarAttrInfo_t:
arr = gm.GM_LidarAttrInfo_array(size)
elif dtype == LidarReturnInfo_t or dtype == gm.GM_LidarReturnInfo_t:
arr = gm.GM_LidarReturnInfo_array(size)
elif dtype == AreaFeature_t or dtype == gm.GM_AreaFeature_t:
arr = gm.GM_AreaFeature_array(size)
elif dtype == ValName_t or dtype == gm.GM_ValName_t:
arr = gm.GM_ValName_array(size)
elif dtype == gm.GM_FoundFeature_t:
arr = gm.GM_FoundFeature_array(size)
#elif dtype == int: # results in inconsistent interpretation when passed to class member variables
# arr = gm.uint32_array(size) # if it is a general int type, return a uint32 which will be interpreted as whatever that type was
# arr = arr.cast()
else:
raise TypeError("No GM array class found for dtype/type of first element in elements")
# populate the array if elements were passed
if len(elements) > 0:
for i in range(size):
# pad even if passed elements
if i < len(elements):
arr[i] = elements[i]
return arr
[docs]class array_range():
"""Class for globalmapper.py array iteration
array_range(array, size)
Parameters
__________
array: globalmapper.xx_array
The array to iterate
size: int
The size of the array
"""
def __init__(self, array, size):
self.array = array
self.size = size
def __iter__(self):
self.iteration = 0
return self
def __next__(self):
if self.iteration < self.size:
result = self.array[self.iteration]
self.iteration += 1
return result
else:
raise StopIteration
def __len__(self):
return self.size
[docs]class AreaElevStats_t(gm.GM_AreaElevStats_t):
"""This type is used for returning the calculated elevation statistics within an area
AreaElevStats_t(mSize: int, mNumSamples: int, mAvgElev: float, mMinElev: float, mMaxElev: float, mStdDevElev: float, mModeElev: float, mAvgSlope: float, mMaxSlope: float, mStdDevSlope: float, mNumIgnoredSamples: int = 0)
Parameters
____________
mSize: int (uint32)
Size of the structure
mNumSamples: uint64, int
Number of locations sampled to compute statistics
mAvgElev: float
Average elevation in meters
mMinElev: float
Minimum elevation in meters
mMaxElev: float
Maximum elevvation in meters
mStdDevElev: float
Standard deviation of elevation in meters
mModeElev: float
approximate mode value of elevation in meters
mAvgSlope: float
Average slope in degrees
mMaxSlope: float
Maximum slope in degrees
mStdDevSlope: float
Standard deviation of slope in degrees
mNumIgnoredSamples: uint64, int
Number of samples that were ignored due to being outside the crop areas or having no elevation\n
"""
def __init__(self, mSize: int, mNumSamples: int, mAvgElev: float, mMinElev: float, mMaxElev: float,
mStdDevElev: float, mModeElev: float, mAvgSlope: float, mMaxSlope: float, mStdDevSlope: float,
mNumIgnoredSamples: int = 0):
super().__init__()
# Fields
self.mSize = mSize
self.mNumSamples = mNumSamples
self.mAvgElev = mAvgElev
self.mMinElev = mMinElev
self.mMaxElev = mMaxElev
self.mStdDevElev = mStdDevElev
self.mModeElev = mModeElev
self.mAvgSlope = mAvgSlope
self.mMaxSlope = mMaxSlope
self.mStdDevSlope = mStdDevSlope
self.mNumIgnoredSamples = mNumIgnoredSamples
[docs]class FontDef_t(gm.GM_FontDef_t):
"""This type is used to describe a font used for rendering text
FontDef_t(mFaceName: str = 'System', mColor: int = 0, mWeight: int = 10, mPointSize: int = 0, mItalicize: bool = False, mUnderline: bool = False, mStrikeout: bool = False, mCharset: int = 255, mBgMode: int = gm.GM_Font_BgOpaque, mFixedHgt: float = 0.0, mPlacement: int = gm.GM_LABEL_AUTO, mHalo: bool = True, mReserved2: int = 0, mReserved3: int = 0, mAngle: float = 0)
Parameters
___________
mFaceName: str, default='System'
Name of font face used
mColor: COLORREF
RGB color of font
mWeight: int (uint16)
Weight of font (use GM_Constants, like FW_BOLD, FW_THIN, FW_NORMAL, etc.)
mPointSize: int (uint8)
Font point size (set mFixedHgt value to non-zero to use fixed height)
mItalicize: bool
Draw text with italics?
mUnderline: bool
Underline text?
mStrikeout: bool
Strikeout text?
mCharset: int
Character set (use OEM_CHARSET (255) for default behavior)
mBgMode: GM_FontBackground_t8
Background fill mode (i.e. opaque or transparent)
mFixedHgt: float
Fixed height of font in meters (use 0.0 for normal point-size font)
mPlacement: GM_LabelPlacement_t8
Label placement relative to point features (only applies for point features)
mHalo: bool
Draw thin halo around text to make it visible on any background.
mReserved2: int (uint8)
Reserved, must be 0
mReserved2: int (uint8)
Reserved, must be 0
mAngle: float
Counter-clockwise rotation angle of angle (0 is horizontal left to right)
"""
# TODO: Methods
def __init__(self, mFaceName: str = 'System', mColor: int = 0, mWeight: int = 10, mPointSize: int = 0,
mItalicize: bool = False, mUnderline: bool = False, mStrikeout: bool = False, mCharset: int = 255,
mBgMode: int = gm.GM_Font_BgOpaque, mFixedHgt: float = 0.0, mPlacement: int = gm.GM_LABEL_AUTO,
mHalo: bool = True, mReserved2: int = 0, mReserved3: int = 0, mAngle: float = 0):
super().__init__()
self.mFaceName = mFaceName
self.mColor = mColor
self.mWeight = mWeight
self.mPointSize = mPointSize
self.mItalicize = mItalicize
self.mUnderline = mUnderline
self.mStrikeout = mStrikeout
self.mCharset = mCharset
self.mBgMode = mBgMode
self.mFixedHgt = mFixedHgt
self.mPlacement = mPlacement
self.mHalo = mHalo
self.mReserved2 = mReserved2
self.mReserved3 = mReserved3
self.mAngle = mAngle
[docs]class SpatialOps_Params_t(gm.GM_SpatialOps_Params_t):
"""Structure defining parameters for spatial operations and spatial predicates
SpatialOps_Params_t(mLogCallback, mFeatureTypes1: int=0, mFeatureTypes2: int=0, mPredicateResultTarget: int=0, mResultLayerName: str="", mResultLayer: int=0, mResultFeatureTypes: int=0, mResultLayerIsTemp: bool=False, mErrorHandling: int=0, mAttemptRepair: bool=True)
Parameters
___________
mFeatureTypes1: GM_FeatureFilters_t8, int
Feature types for layer 1
mFeatureTypes2: GM_FeatureFilters_t8, int
Feature types for layer 2
mPredicateResultTarget: GM_PredicateResultTargets_t8 (int)
Where to store the results of the predicate
mResultLayerName: str
Name of result layer
mResultLayer: GM_LayerHandle_t32 (int)
Layer to add geometries to
mResultFeatureTypes: GM_FeatureFilters_t8 (int)
Desired feature class type(s) for results
mResultLayerIsTemp: bool
If true, result layer should not appear in the Control Panel
mErrorHandling: GM_SpatialOps_Errorhandling_t8 (int)
Error handling behavior for inputs to the operation
mAttemptRepair: bool
Attempt repair on invalid input geometries
mLogCallback: GM_MessageCallbackFunc
Callback for displaying error and warning messages.
"""
# note: mLogCallback is out of order in __init__ because no reasonable default can be set and it must therefore be positional
def __init__(self, mLogCallback, mFeatureTypes1: int=0, mFeatureTypes2: int=0, mPredicateResultTarget: int=0, mResultLayerName: str="",
mResultLayer: int=0, mResultFeatureTypes: int=0, mResultLayerIsTemp: bool=False, mErrorHandling: int=0,
mAttemptRepair: bool=True):
super().__init__()
self.mFeatureTypes1 = mFeatureTypes1
self.mFeatureTypes2 = mFeatureTypes2
self.mPredicateResultTarget = mPredicateResultTarget
self.mResultLayerName = mResultLayerName
self.mResultLayer = mResultLayer
self.mResultFeatureTypes = mResultFeatureTypes
self.mResultLayerIsTemp = mResultLayerIsTemp
self.mErrorHandling = mErrorHandling
self.mAttemptRepair = mAttemptRepair
self.mLogCallback = mLogCallback
[docs]class AreaStyle_t(gm.GM_AreaStyle_t):
"""This type is used to describe a style used for drawing an area feature and its label (if any)
AreaStyle_t(mBorderPenStyle=gm.GM_PEN_SOLID, mBorderPenWidth: int = 1, mBorderPenColor: int = 0,
mBrushColor: int = 0, mBrushStyle=gm.GM_BRUSH_SOLID, mDrawLabel: bool = False, mDrawLabelAlways: bool = False, mFont: FontDef_t = FontDef_t())
Parameters
_____________
mBorderPenColor: COLORREF (int)
color to use for border pen
mBorderPenStyle: PenStyle_t16
Border pen style (i.e. solid, dash, etc.)
mBorderPenWidth: Unsigned integer
Width to draw border pen in
mBrushColor: COLORREF (int)
color of brush to fill area with (when applicable to brush style). The color is defined as ARGB where the upper 8 bits are alpha.
The exception is a value of 0 in the A is treated as no alpha.
mBrushStyle:BrushStyle_t16 Enumeration
Style of brush to fill area with
mDrawLabel: boolean
Render the label for this line if there is one
mDrawLabelAlways: boolean
Render the label for this line even if it collides with another display label
mFont:FontDef_t
Font to use to render label
"""
# TODO It appears GM.AreaStyle_t().mBorderPenColor points to a memory address that has the color
def __init__(self, mBorderPenStyle=gm.GM_PEN_SOLID, mBorderPenWidth: int = 1, mBorderPenColor: int = 0,
mBrushColor: int = 0, mBrushStyle=gm.GM_BRUSH_SOLID, mDrawLabel: bool = False,
mDrawLabelAlways: bool = False, mFont: FontDef_t = FontDef_t()):
super().__init__()
# Fields
self.mBorderPenStyle = mBorderPenStyle
self.mBorderPenWidth = mBorderPenWidth
self.mBorderPenColor = mBorderPenColor
self.mBrushColor = mBrushColor
self.mBrushStyle = mBrushStyle
self.mDrawLabel = mDrawLabel
self.mDrawLabelAlways = mDrawLabelAlways
self.mFont = mFont
[docs]class VectorFeature_t(gm.GM_VectorFeature_t):
"""This type is used as the base for any vector feature information
VectorFeature_t(mAttrList: gm.GM_AttrValue_array = array(
[AttrValue_t('Name1', 'Val1'), AttrValue_t('Name2', 'Val2')]),
mNumAttrs: int = 2, mClass: int = 16, mDesc: str = None, mName: str = None)
Parameters
__________
mAttrList: gm.AttrValue_array
List of attributes associated with feature
mNumAttrs: int (uint16)
Number of elements in mAttrList
mClass: FeatureClass_t16
Global Mapper classification assigned to the feature
mDesc: str
Description of the feature
mName: str
Name of the feature
"""
def __init__(self, mName: str = None, mDesc: str = None, mClass: int = 0,
mAttrList: gm.GM_AttrValue_array = array([AttrValue_t('Name1', 'Val1'), AttrValue_t('Name2', 'Val2')]),
mNumAttrs: int = 2):
super().__init__()
# Fields
self.mAttrList = mAttrList
self.mClass = mClass
self.mDesc = mDesc
self.mName = mName
self.mNumAttrs = mNumAttrs
[docs]class HoleInArea_t(gm.GM_HoleInArea_t):
"""This type is used to store information about holes within area features
HoleInArea_t(mPoints: Point_t_array, mNumPoints: int, mVertexElevList: float_array)
Parameters
____________
mPoints: Point_t_array
List of points in the hole in global coordinates (pointer to GM_Point_t array)
mNumPoints: int
Number of points in the list. Automatically set when the point list is updated
mVertexElevList: float_array
Optional list of elevations for each point in line. If present, must have *mNumPoints* values
"""
def __init__(self, mPoints: gm.GM_Point_t_array, mNumPoints: int, mVertexElevList: gm.float_array = None):
super().__init__()
# Properties
self.mPoints = mPoints
self.mNumPoints = mNumPoints
self.mVertexElevList = mVertexElevList # when setting, use "obj.mVertexElevList = array_var.cast()". Without calling .cast(), it may not always work
[docs]class AreaFeature_t(gm.GM_AreaFeature_t):
"""
AreaFeature_t(mFeatureInfo: VectorFeature_t = VectorFeature_t(), mPointList: gm.GM_Point_t_array = array([Point_t(0, 0), Point_t(0, 1)]), mNumPoints: int=2,
mHoleList: HoleInArea_t = HoleInArea_t(array([Point_t(0, 0), Point_t(0, 1)]), 2),mNumHoles: int = 1, mAreaStyle: AreaStyle_t = AreaStyle_t(), mVertexElevList: float = None)
Parameters
__________
mFeatureInfo: VectorFeature_t
The General Vector Feature Info
mPointList: Point_t
List of points that make up the area (global coordinates when getting, native when adding feature)
mNumPoints: int, uint32
Number of points in the list
mHoleList: HoleInArea_t
List of holes in the area
mNumHoles: int, uint32
Number of holes in the list of holes
mAreaStyle: AreaStyle_t
Area render style (symbol and font)
mVertexElevList: float
Optional list of elevations for each point in area. If present, must be same size as mPointsList
"""
# TODO Methods
#TODO mHoleList is an array of type HoleInArea_t, which is not implemented yet
def __init__(self, mFeatureInfo: VectorFeature_t = VectorFeature_t(),
mPointList: gm.GM_Point_t_array = array([Point_t(0, 0), Point_t(0, 1)]), mNumPoints: int=2,
mHoleList: HoleInArea_t = HoleInArea_t(array([Point_t(0, 0), Point_t(0, 1)]), 2),mNumHoles: int = 1,
mAreaStyle: AreaStyle_t = AreaStyle_t(), mVertexElevList: float = None):
super().__init__()
# Fields
self.mFeatureInfo = mFeatureInfo # VectorFeature_t type
self.mPointList = mPointList
self.mNumPoints = mNumPoints
self.mVertexElevList = mVertexElevList # when setting, use "obj.mVertexElevList = array_var.cast()". Without calling .cast(), it may not always work
self.mHoleList = mHoleList
self.mNumHoles = mNumHoles
self.mAreaStyle = mAreaStyle
[docs]class AreaVolumeParams_t(gm.GM_AreaVolumeParams_t):
"""This type is used to provide the parameters for calculating cut-and-fill volumes within an area feature
AreaVolumeParams_t(mSize = 0, mPoints: gm.GM_Point_t_array = array([Point_t(0, 0), Point_t(0, 1)]), mNumPoints: int = 2, mCutHeight: float = 0.0, mXSpacing: float = 0.0, mYSpacing: float = 0.0, mFillGaps: bool = True)
Parameters
____________
mSize: int, uint32
Size of structure
mPoints: Point_t
List of points in area in global coordinate system
mNumPoints: int, uint32
Number of points in the argument mPoints
mCutHeight: float
Cut height in meters above sea level
mXSpacing: float
Sample spacing in the x direction in global units
mYSpacing: float
Sample spacing in the y direction in global units
mFillGaps: boolean
Fill gaps in terrain from surrounding data
"""
def __init__(self, mSize = 0, mPoints: gm.GM_Point_t_array = array([Point_t(0, 0), Point_t(0, 1)]),
mNumPoints: int = 2, mCutHeight: float = 0.0, mXSpacing: float = 0.0, mYSpacing: float = 0.0,
mFillGaps: bool = True):
super().__init__()
# Fields
self.mSize = mSize
self.mPoints = mPoints
self.mNumPoints = mNumPoints
self.mCutHeight = mCutHeight
self.mXSpacing = mXSpacing
self.mYSpacing = mYSpacing
self.mFillGaps = mFillGaps
[docs]class Color_t(gm.GM_Color_t):
"""This type is used when returning a color
Color_t(mRed: int = 0, mGreen: int = 0, mBlue: int = 0)
Parameters
_____________
mRed: int, uint8
Red component of color
mGreen: int, uint8
Green component of color
mBlue: int, uint8
Blue component of color
"""
# Requires suitable default arguments
def __init__(self, mRed: int = 0, mGreen: int = 0, mBlue: int = 0) :
super().__init__()
# Fields
self.mRed = mRed
self.mGreen = mGreen
self.mBlue = mBlue
[docs]class Rectangle_t(gm.GM_Rectangle_t):
"""This type describes a bounding rectangle in world coordinates
Rectangle_t(mMinX: float = 0, mMinY: float = 0, mMaxX: float = 0, mMaxY: float = 0)
Parameters
_____________
mMinX: float
Minimum x/easting/longitude coordinate
mMinY: float
Minimum y/northing/latitude coordinate
mMaxX: float
Maximum x/easting/longitude coordinate
mMaxY: float
Maximum y/northing/latitude coordinate
"""
def __init__(self, mMinX: float = 0, mMinY: float = 0, mMaxX: float = 0, mMaxY: float = 0):
super().__init__()
# Fields
self.mMinX = mMinX
self.mMinY = mMinY
self.mMaxX = mMaxX
self.mMaxY = mMaxY
[docs]class ContourParams_t(gm.GM_ContourParams_t):
"""This type is used to provide the parameters for generating contours
ContourParams_t(mSize: int = 0, mDesc: str = None, mContourBounds: Rectangle_t = Rectangle_t(),
mContourInterval: float = 20.0, mIntervalInFeet: bool = False, mGenerateAreas: bool = False,
mGenerateSpotElevs: bool = True, mNumberOnlyLabels: bool = False, mShowProgress: bool = True,
mDisableSmoothing: bool = False, mCreateFromAbove: bool = False, mSingleLevelOnly: bool = False,
mXSpacing: float = 0.0, mYSpacing: float = 0.0, mSimpThreshold: float = 0.0)
Parameters
___________
mSize: int (uint32)
Size
mDesc: str
Contour layer description
mContourBounds: Rectangle_t
Bounds of contour lines to create. Pass empty rectangle to use entirety of passed in layer(s).
mContourInterval: float
Contour interval
mIntervalInFeet: bool
Set to TRUE if the contour interval is in feet rather than meters
mGenerateAreas: bool
Generate iso-height areas in addition to contour lines
mGenerateSpotElevs: bool
Generate spot elevation points at minimum and maximum elevations
mNumberOnlyLabels: bool
Only include the value (and not the units string) in the contour labels
mShowProgress: bool
Display contour generation progress dialog
mDisableSmoothing: bool
Do not smooth the generated contour lines to improve their appearance
mCreateFromAbove: bool
ADVANCED: Create contours as we go from above to contour rather than from contour to below.
mSingleLevelOnly: bool
Only create a single contour level rather than treating as interval
mXSpacing: float
Sample spacing in the x direction
mYSpacing: float
Sample spacing in the y direction
mSimpThreshold: float
Simplification threshold, use 0.0 for no simplification
"""
def __init__(self, mSize: int = 0, mDesc: str = None, mContourBounds: Rectangle_t = Rectangle_t(),
mContourInterval: float = 20.0, mIntervalInFeet: bool = False, mGenerateAreas: bool = False,
mGenerateSpotElevs: bool = True, mNumberOnlyLabels: bool = False, mShowProgress: bool = True,
mDisableSmoothing: bool = False, mCreateFromAbove: bool = False, mSingleLevelOnly: bool = False,
mXSpacing: float = 0.0, mYSpacing: float = 0.0, mSimpThreshold: float = 0.0):
super().__init__()
self.mSize = mSize
self.mDesc = mDesc
self.mContourBounds = mContourBounds
self.mContourInterval = mContourInterval
self.mIntervalInFeet = mIntervalInFeet
self.mGenerateAreas = mGenerateAreas
self.mGenerateSpotElevs = mGenerateSpotElevs
self.mNumberOnlyLabels = mNumberOnlyLabels
self.mShowProgress = mShowProgress
self.mDisableSmoothing = mDisableSmoothing
self.mCreateFromAbove = mCreateFromAbove
self.mSingleLevelOnly = mSingleLevelOnly
self.mXSpacing = mXSpacing
self.mYSpacing = mYSpacing
self.mSimpThreshold = mSimpThreshold
[docs]class DatumInfo_t(gm.GM_DatumInfo_t):
"""This type represents information about a datum
DatumInfo_t(mMethod=gm.GM_Datum_Molodensky, mDatumName: str = None, mEllipsoidName: str = None,
mDeltaX: float = 0.5, mDeltaY: float = 0.5, mDeltaZ: float = 0.5,mScale: float = 1,mRotX: float = 0.0,
mRotY: float = 0.0, mRotZ: float = 0.0, mPrimeMeridian: float = 0.0, mPrimeMeridianName: str = None,
mSemiMajor: float = 1, mSemiMinor: float = 1)
Parameters
______________
mMethod: GM_DatumXForm_t32
Transformation method
mDatumName: str
Name of datum
mEllipsoidName: str
Name of ellipsoid this datum is based on
mDeltaX: float
Delta X in meters
mDeltaY: float
Delta Y in meters
mDeltaZ: float
Delta Z in meters
mScale: float
Scale factor (GM_Datum_BursaWolfe only)
mRotX: float
Rotation in X in arc seconds (GM_Datum_BursaWolfe only)
mRotY: float
Rotation in Y in arc seconds (GM_Datum_BursaWolfe only)
mRotZ: float
Rotation in Z in arc seconds (GM_Datum_BursaWolfe only)
mPrimeMeridian: float
Prime meridian for datum (0.0 for Greenwich)
mPrimeMeridianName: str
Optional name of prime meridian
mSemiMajor: float
Ellipsoid semi-major axis (output only)
mSemiMinor: float
Ellipsoid semi-major axis (output only)
"""
def __init__(self, mMethod=gm.GM_Datum_Molodensky, mDatumName: str = None, mEllipsoidName: str = None,
mDeltaX: float = 0.5, mDeltaY: float = 0.5, mDeltaZ: float = 0.5,mScale: float = 1,mRotX: float = 0.0,
mRotY: float = 0.0, mRotZ: float = 0.0, mPrimeMeridian: float = 0.0, mPrimeMeridianName: str = None,
mSemiMajor: float = 1, mSemiMinor: float = 1):
super().__init__()
# Fields
self.mMethod = mMethod
self.mDatumName = mDatumName
self.mEllipsoidName = mEllipsoidName
self.mDeltaX = mDeltaX
self.mDeltaY = mDeltaY
self.mDeltaZ = mDeltaZ
self.mScale = mScale
self.mRotX = mRotX
self.mRotY = mRotY
self.mRotZ = mRotZ
self.mPrimeMeridian = mPrimeMeridian
self.mPrimeMeridianName = mPrimeMeridianName
self.mSemiMajor = mSemiMajor
self.mSemiMinor = mSemiMinor
[docs]class DensityGridParams_t(gm.GM_DensityGridParams_t):
"""Class to define options for calculating a density grid
DensityGridParams_t(mBoundingBox: Rectangle_t = Rectangle_t(), mAreaUnits = gm.GM_AREA_SQ_KM, mCellsPerRadius: int = 3,
mField: str = '', mFlags = gm.GM_DensityFlags_DisableProgress, mKernelType = gm.GM_KernelType_Gaussian,
mLayerDesc: str = 'Density grid_test_GM_attrtibute', mRadiusMeters: float = 6)
Parameters
___________
mFlags: GM_DensityGridFlags_t32
Flags for density grid generation
mKernelType: GM_DensityKernelType_t8
The Kernel Type
mRadiusMeters: float
Radius in meters for kernel (use 0 for a default)
mCellsPerRadius: int
How many cells in each direction to have per radius (use 0 to use default of 3 cells in each direction per radius)
mLayerDesc: str
Description to use for new layer, or NULL/empty for default
mField: str
Name of attribute field to compute on. Set to NULL/empty string to just count points
mAreaUnits: GM_AreaUnits_t8
Units of area measure
BoundingBox: Rectangle
Bounding box in layer units. Provide empty box to use default of entire layer.
"""
def __init__(self, mFlags=gm.GM_DensityFlags_DisableProgress, mKernelType=gm.GM_KernelType_Gaussian,
mRadiusMeters: float = 6, mCellsPerRadius: int = 3, mLayerDesc: str = 'Density grid_test_GM_attrtibute',
mField: str = '', mAreaUnits=gm.GM_AREA_SQ_KM, mBoundingBox: Rectangle_t = Rectangle_t()):
super().__init__()
# Properties
self.mFlags = mFlags
self.mKernelType = mKernelType
self.mRadiusMeters = mRadiusMeters
self.mCellsPerRadius = mCellsPerRadius
self.mLayerDesc = mLayerDesc
self.mField = mField
self.mAreaUnits = mAreaUnits
self.mBoundingBox = mBoundingBox
[docs]class ElevationOverrides_t(gm.GM_ElevationOverrides_t):
"""This type represents any adjustments to apply to elevation values within a gridded elevation layer.
ElevationOverrides_t(mMaxElev: float, mMinElev: float, mOffset: float, mClampVals: bool = True,
mMaxValid: bool = True, mMinValid: bool = True, mVoidValid: bool = True, mLayerShader: str = None,
mScale: float = 1.0, mVoidElev: float = 0.5)
Parameters
____________
mOffset: float
Offset to apply to elevations in meters
mScale: float
Scale factor to apply
mClampVals: bool
Clamp out of range values to specified min/max
mMinValid: bool
Is the new minimum elevation valid
mMinElev: float
Minimum valid elevation (meters)
mMaxValid: bool
Is the new maximum elevation valid
mMaxElev: float
Maximum valid elevation (meters)
mVoidValid: bool
Is the void elevation value valid?
mElevUnits: GM_ElevUnits_t8
Native elevation units for file.
mVoidElev: float
Elevation to use for void values
mLayerShader: str
Name of elevation shader to use for layer (NULL for default shared shader)
"""
def __init__(self, mOffset: float, mScale: float = 1.0, mClampVals: bool = True, mMinValid: bool = False,
mMinElev: float = 0.0, mMaxValid: bool = False, mMaxElev: float = 0.0, mVoidValid: bool = True,
mElevUnits=gm.GM_ElevUnit_Meters, mVoidElev: float = 0.5,mLayerShader: str = None):
super().__init__()
# Properies
self.mOffset = mOffset
self.mScale = mScale
self.mClampVals = mClampVals
self.mMinValid = mMinValid
self.mMinElev = mMinElev
self.mMaxValid = mMaxValid
self.mMaxElev = mMaxElev
self.mVoidValid = mVoidValid
self.mElevUnits = mElevUnits
self.mVoidElev = mVoidElev
self.mLayerShader = mLayerShader
[docs]class EqualValueAreaSetup_t(gm.GM_EqualValueAreaSetup_t):
"""This type is used to provide the parameters for performing Generate Areas from Equal Values process
EqualValueAreaSetup_t( mAreaType = gm.AFC_MIN, mBounds: Rectangle_t= Rectangle_t(), mColorDist: int = 20,
mColorList: int = None, mColorListSize: int = 30, mElevDist: float = 5,
mFlags = gm.GM_EqualValueArea_ForceRGB, mLayerDesc: str = 'Equal Value area',
mSlopeDist: float = 10, mValAttrFormat: str = None, mValAttrName: str = 'color')
Parameters
______________
mFlags: GM_EqualValueAreaFlags_t32
Flags controlling the operation
mValAttrName: str
Name of attribute to save value (color/elev/slope) in
mAreaType: AreaFeatureClass_t16
Area type to assign to area features
mColorDist: int, sint32
Allowed fudge factor for colors
mElevDist: float
Allowed difference for elevations
mSlopeDist: float
Allowed difference for slopes
mBounds: Rectangle_t
nBounds to create in (empty means all)
mColorList: COLORREF, int
List of colors to consider (NULL for all)
mColorListSize: int
Number of colors in the list of colors to consider
mValAttrFormat: str
Formatting string to use for value attribute (NULL is default, can be C-style format string like "RGB( %d, %d, %d )" or "#%02X%02X%02X"). Must have 3 values for color, 1 for slope or elevation.
mLayerDesc: str
Name of the resulting layer
mElevRangeHigh: float
Maximum elevation
mElevRangeLow: float
Minimum elevation
"""
def __init__(self, mFlags=gm.GM_EqualValueArea_ForceRGB, mValAttrName: str = 'color', mAreaType=gm.AFC_MIN,
mColorDist: int = 20, mElevDist: float = 5, mSlopeDist: float = 10,
mBounds: Rectangle_t = Rectangle_t(),mColorList: gm.COLORREF_array = None, mColorListSize: int = 0,
mValAttrFormat: str = None,mLayerDesc: str = 'Equal Value area', mElevRangeHigh: float=0, mElevRangeLow: float=0):
super().__init__()
self.mFlags = mFlags
self.mValAttrName = mValAttrName
self.mAreaType = mAreaType
self.mColorDist = mColorDist
self.mElevDist = mElevDist
self.mSlopeDist = mSlopeDist
self.mBounds = mBounds
self.mColorList = mColorList
self.mColorListSize = mColorListSize
self.mValAttrFormat = mValAttrFormat
self.mLayerDesc = mLayerDesc
self.mColorListSize = mColorListSize
self.mValAttrFormat = mValAttrFormat
self.mLayerDesc = mLayerDesc
self.mElevRangeHigh = mElevRangeHigh
self.mElevRangeLow = mElevRangeLow
[docs]class ExportOptsDXF_DWG_t(gm.GM_ExportOptsDXF_DWG_t):
"""This type is used to describe custom export options for DXF/DWG vector exports
ExportOptsDXF_DWG_t( mDWGVersion = gm.GM_ExportDWG_VerDefault, mFlags = gm.GM_ExportDXF_UseLabelsForLayers,
mLabelType = gm.GM_ExportDXF_LabelsAsPointsFeatureLayer, mLayerAttr: str = None,
mTenPointFontHeight: float = 10, mCADType = gm.GM_CADType_DWG)
Parameters
____________
mTenPointFontHeight: float
Height (in ground units) to use for 10 pt label fonts (other sizes will be scaled appropriately)
mLabelType:GM_ExportOptsDXFLabels_t8
Export setting for area and line feature labels
mDWGVersion: GM_ExportOptsDWGVersion_t8
DWG export only: version
mFlags: GM_ExportOptsDXFFlags_t32
Export Flags
mCADType: GM_ExportOptsCADType_t8
CAD export type (only used when passed into DWGExporter::Export())
mLayerAttr: str
Attribute value to get layer name from (NULL to use description/type)
"""
def __init__(self, mTenPointFontHeight: float = 10, mLabelType=gm.GM_ExportDXF_LabelsAsPointsFeatureLayer,
mDWGVersion=gm.GM_ExportDWG_VerDefault, mFlags=gm.GM_ExportDXF_UseLabelsForLayers,
mCADType=gm.GM_CADType_DWG, mLayerAttr: str = None):
super().__init__()
# Fields
self.mTenPointFontHeight = mTenPointFontHeight
self.mLabelType = mLabelType
self.mDWGVersion = mDWGVersion
self.mFlags = mFlags
self.mCADType = mCADType
self.mLayerAttr = mLayerAttr
[docs]class ExportOptsKML_t(gm.GM_ExportOptsKML_t):
"""This type is used to describe custom export options for KML vector exports. To create a KMZ file, pass a filename with a .kmz extension to the GM_ExportVector function.
ExportOptsKML_t( mAreaDisplayAtElev: bool = False, mAreaElevsRelative: bool = False, mExtrudeAreas: bool = False,
mHidePointsInitially: bool = True, mLineDisplayAtElev: bool = True, mLineElevsRelativev: bool = False,
mAreaOpacity: float = 100)
Parameters
____________
mAreaOpacity: float
area translucency - percent (0.0 - 100.0)
mAreaDisplayAtElev: bool
display area features at feature elevation
mAreaElevsRelative: bool
area elevations relative to ground (only valid if mAreaDisplayAtElev set)
mExtrudeAreas: bool
extrude 3D areas to make 3D shapes like buildings (only valid if mAreaDisplayAtElev set)
mLineDisplayAtElev: bool
display line features at feature elevation
mLineElevsRelative: bool
line elevations relative to ground (only valid if mLineDisplayAtElev set)
mHidePointsInitially: bool
initially hide point features when displayed in Google Earth
"""
def __init__(self, mAreaOpacity: float = 100, mAreaDisplayAtElev: bool = False, mAreaElevsRelative: bool = False,
mExtrudeAreas: bool = False, mLineDisplayAtElev: bool = True, mLineElevsRelative: bool = False,
mHidePointsInitially: bool = True):
super().__init__()
# Properties
self.mAreaOpacity = mAreaOpacity
self.mAreaDisplayAtElev = mAreaDisplayAtElev
self.mAreaElevsRelative = mAreaElevsRelative
self.mExtrudeAreas = mExtrudeAreas
self.mHidePointsInitially = mHidePointsInitially
self.mLineDisplayAtElev = mLineDisplayAtElev
self.mLineElevsRelative = mLineElevsRelative
[docs]class ExportOptsPDF_t(gm.GM_ExportOptsPDF_t):
"""Describes custom export options for DWG exports
ExportOptsPDF_t( mFlags = gm.GM_PDF_FillPage, mPageSizeName = 'Letter', mDPI = 150,
mMarginRect = Rectangle_t(0.5, 1.0, 0.5, 0.5), mHeaderStr: str = 'Default obj value', mHeaderFront = None,
mFooterStr = None, mFooterFont = None, mSymbolScale = 0.0, mBorderStyle = gm.GM_PEN_SOLID, mBorderWidth = 3,
mBordercolor = 0
Parameters
___________
mFlags:GM_PDFExportFlags_t32
Export flags
mPageSizeName: str
Name of page size, like "Letter", "Legal", "A0", etc.
mDPI: int, uint32
Export DPI
mMarginRect: Rectangle
Margins for each side in inches
mHeaderStr: str
Header for page (None for none)
mHeaderFont: FontDef
(const GM_FontDef_t) Header font (NULL for default)
mFooterStr: str
Footer for page (None for none)
mFooterFont: FontDef
Footer font (None for default)
mSymbolScale: float
Point symbol scaling factor (0.0 will be treated as 1.0, use 2.0 to double size, 0.5 to half size, etc.)
mBorderStyle: GM_PenStyle_t16
Border pen style (i.e. solid, dash, etc.)
mBorderWidth: int, uint16
Border width in PDF points (pixels)
mBorderColor: color, int
Border line color
"""
def __init__(self, mFlags=gm.GM_PDF_FillPage, mPageSizeName: str = 'Letter', mDPI: int = 150,
mMarginRect: Rectangle_t = Rectangle_t(0.5, 1.0, 0.5, 0.5), mHeaderStr: str = 'Default obj value',
mHeaderFont: FontDef_t = None, mFooterStr: str = None, mFooterFont: FontDef_t = None,
mSymbolScale: float = 0.0, mBorderStyle=gm.GM_PEN_SOLID, mBorderWidth: int = 3, mBorderColor: int = 0):
super().__init__()
self.mFlags = mFlags
self.mPageSizeName = mPageSizeName
self.mDPI = mDPI
self.mMarginRect = mMarginRect
self.mHeaderStr = mHeaderStr
self.mHeaderFont = mHeaderFont
self.mFooterFont = mFooterFont
self.mFooterStr = mFooterStr
self.mSymbolScale = mSymbolScale
self.mBorderStyle = mBorderStyle
self.mBorderWidth = mBorderWidth
self.mBorderColor = mBorderColor
[docs]class ExportOptsSHP_t(gm.GM_ExportOptsSHP_t):
"""This type is used to describe custom export options for Shapefile vector exports
ExportOptsSHP_t( mAddLabelAttr = True, mAddLayerAttr = True)
Parameters
___________
mAddLabelAttr: bool
Include the display label as a LABEL attribute if present
mAddLayerAttr: bool
Add LAYER and GM_TYPE attribute values
"""
def __init__(self, mAddLabelAttr: bool = True, mAddLayerAttr: bool = True):
super().__init__()
self.mAddLabelAttr = mAddLabelAttr
self.mAddLayerAttr = mAddLayerAttr
[docs]class ExportOptsSimpleText_t(gm.GM_ExportOptsSimpleText_t):
"""This type is used to describe custom export options for Simple Text vector exports
ExportOptsSimpleText_t(mCoordSep: str = None, mFeatureSep: str = None, mAddLayerAttr: bool = True, mYCoordFirst: bool = True,
mReserved1: bytes = 0, mReserved2: bytes = 0)
Parameters
___________
mCoordSep: str
Coordinate separator (use None for default of comma)
mFeatureSepFeature: str
separator (use None for default of blank line)
mAddStyleAttrs: bool
Include style attributes if attributes are included
mYCoordFirst: bool
Export Y/latitude/northing before X/longitude/easting
mReserved1: int, uint8
Reserved (for padding), must be 0
mReserved2:: int, uint8
Reserved (for padding), must be 0
"""
def __init__(self, mCoordSep: str = None, mFeatureSep: str = None, mAddStyleAttrs: bool = True,
mYCoordFirst: bool = True,
mReserved1: int = 0, mReserved2: int = 0):
super().__init__()
self.mAddStyleAttrs = mAddStyleAttrs
self.mYCoordFirst = mYCoordFirst
self.mCoordSep = mCoordSep
self.mFeatureSep = mFeatureSep
self.mReserved1 = mReserved1
self.mReserved2 = mReserved2
[docs]class ExportOptsGeoPackage_t(gm.GM_ExportOptsGeoPackage_t):
"""This type is used to describe custom export options for GeoPackage exports
ExportOptsGeoPackage_t(mOverwriteExisting: bool = False, mAreaTableName: str = None,
mLineTableName: str = None, mPointTableName: str = None, mSplitByLayer: bool = False,
mGen3dFeatures: bool = False, mTileTableName: str = None, mDescription: str = 'Default Tile Layer',
mMaxZoomLevel: int = 3, mNumZoomLevels:int = 5, mImageFormat: int = gm.GM_Export_GeoTIFF,
mImageQuality: int = 75, mTileSize: int = 256, mFlags = gm.GM_WebExport_NoTransparency)
Parameters
____________
mOverwriteExisting: bool
Indicates whether or not to overwrite an existing GeoPackage file
mAreaTableName: string
Table name for area features. NULL if not exporting areas. For Vector Export.
mLineTableName: string
Table name for line features. NULL if not exporting lines. For Vector Export.
mPointTableName: string
Table name for point features. NULL if not exporting points. For Vector Export.
mSplitByLayer: bool
Indicates whether or not to split features in to separate tables by layer. For Vector Export.
mGen3dFeatures: bool
Indicates whether or not to create 3D features. For Vector Export.
mTileTableName: String
Table name for raster tiles. NULL for default "tile_data". For Raster Export.
mDescription: String
Description for tile layer. For Raster Export.
mMaxZoomLevel: int, sint32
Maximum zoom level to export. Valid range is 3 to 22. For Raster Export.
mNumZoomLevels: int, uint32
Total number of zoom levels to export. For Raster Export.
mImageFormat: GM_RasterExportFormat_t32
Image format (PNG or JPEG). For Raster Export.
mImageQuality: int, uint32
Image quality. Applies only to JPEG exports. Range is 1 to 100. Default is 75. For Raster Export.
mTileSize: int, uint32
Tile size in pixels. Valid values are 256, 512, and 1024. Default is 256. Tiles are square, so 256 means 256 x 256 pixel tiles. For Raster Export.
mFlags: GM_WebExportFlags_t32
Additional related for skipping empty tiles, skipping tiles that already exist, etc. For Raster Export.
"""
def __init__(self, mOverwriteExisting: bool = False, mAreaTableName: str = None, mLineTableName: str = None,
mPointTableName: str = None, mSplitByLayer: bool = False, mGen3dFeatures: bool = False,
mTileTableName: str = None, mDescription: str = 'Default Tile Layer', mMaxZoomLevel: int = 3,
mNumZoomLevels:int = 5, mImageFormat: int = gm.GM_Export_GeoTIFF, mImageQuality: int = 75,
mTileSize: int = 256, mFlags = gm.GM_WebExport_NoTransparency):
super().__init__()
self.mOverwriteExisting = mOverwriteExisting
self.mAreaTableName = mAreaTableName
self.mLineTableName = mLineTableName
self.mPointTableName = mPointTableName
self.mSplitByLayer = mSplitByLayer
self.mGen3dFeatures = mGen3dFeatures
self.mTileTableName = mTileTableName
self.mDescription = mDescription
self.mMaxZoomLevel = mMaxZoomLevel
self.mNumZoomLevels = mNumZoomLevels
self.mImageFormat = mImageFormat
self.mImageQuality = mImageQuality
self.mTileSize = mTileSize
self.mFlags = mFlags
[docs]class FeatureClassInfo_t(gm.GM_FeatureClassInfo_t):
"""This type is used to return information about a given feature classification
FeatureClassInfo_t( mIsEnabled: bool = False, mPriority: bool = False, mZLevel = gm.Z_LVL_MIN, mDesc: str = None)
Parameters
______________
mIsEnabled: bool
Is display of this class enabled?
mPriority: bool
Draw priority (0-255). Controls when features show up in zoom levels.
mZLevel: ZLevel_t16
Z level for feature
mDesc: str
Description string for this feature
"""
def __init__(self, mIsEnabled: bool = False, mPriority: int = 1, mZLevel=gm.Z_LVL_MIN, mDesc: str = None):
super().__init__()
# Properties
self.mIsEnabled = mIsEnabled
self.mPriority = mPriority
# Fields
self.mDesc = mDesc
self.mZLevel = mZLevel
[docs]class FillGapsParams_t(gm.GM_FillGapsParams_t):
# TODO no class information in the SDK description
"""Structure defining parameters for gap filling
FillGapsParams_t( mGridAlg = gm.GM_GridAlg_None, mGapAlg = gm.GM_GapFillAlg_None, mDirsToRequire: int = 4,
mMaxThreads: int = 4, mMaxDist: int = 10, mMinDist: int = 1, mMaxPointCount: int = 5,
mPowerParameter: int = 5)
Parameters
____________
mGridAlg: GM_GridAlg_t8
Algorithm to used for creating elevation grid (used for creating pyramid grids)
mGapAlg: GM_GridGapFillAlg_t8
Algorithm to use for filling gaps
mDirsToRequire: int, uint32
how many cardinal directions to require (4 for all 4)
mMaxThreads: int, uint32
maximum background threads to spawn (0 for default)
mMaxDist: int, uint32
maximum distance (in samples) from center to search
mMinDist: int, uint32
minimum distance (in samples) from center to search
mMaxPointCount: int, uint32
maximum number of points to consider (0 for no maximum)
mPowerParameter: int, uint32
the power parameter to use in IDW calculations
"""
def __init__(self, mGridAlg: int, mGapAlg: int, mDirsToRequire: int, mMaxThreads: int = 0,mMaxDist: int = 0,
mMinDist: int = 0, mMaxPointCount: int = 5, mPowerParameter: int = 5):
super().__init__()
self.mGridAlg = mGridAlg
self.mGapAlg = mGapAlg
self.mDirsToRequire = mDirsToRequire
self.mMaxThreads = mMaxThreads
self.mMaxDist = mMaxDist
self.mMinDist = mMinDist
self.mMaxPointCount = mMaxPointCount
self.mPowerParameter = mPowerParameter
[docs]class GPS_Position_t(gm.GM_GPS_Position_t):
"""Structure for holding GPS position
Parameters
__________
mLat:float
Latitude
mLon:float
Longitude
"""
def __init__(self, lat: float = 0, lon: float = 0):
super().__init__()
self.mLat = lat
self.mLon = lon
[docs]class GPS_Waypoint_t(gm.GM_GPS_Waypoint_t):
"""Structure for holding GPS waypoint information
Parameters
___________
mPos: GM_GPS_Position_t
Current location (lat/lon radians)
mAltitude: float
Altitude above sea level in meters
mName: str
Waypoint name
mGroupId: int
Group ID (0 - 99)
mIcon: int
Icon (0-99)
mSerialCode: int
Serial code of sender
mTimeStamp: time_t
UTC time of waypoint creation
"""
def __init__(self, mPos: GPS_Position_t = GPS_Position_t(0, 0), mAltitude: float = 0, mName: str = "",
mGroupId: int = 0, mIcon: int = 0, mSerialCode: int = 0):
super().__init__()
# TODO: figure out how to handle mTimestamp of type time_t
self.mPos = mPos
self.mAltitude = mAltitude
self.mName = mName
self.mGroupId = mGroupId
self.mIcon = mIcon
self.mSerialCode = mSerialCode
[docs]class GPS_Text_Msg_t(gm.GM_GPS_Text_Msg_t):
"""Structure for holding GPS text message information
Parameters
___________
mDeviceName: str
Sending device name
mMessage: str
Message
mGroupID: int
Group ID (0 - 99)
mIcon: int
Icon (0-99)
mSerialCode: int
Serial code of sender
mTimeStamp: time_t
UTC time of message transmission
"""
def __init__(self, mDeviceName: str = "", mMessage: str = "", mGroupId: int = 0, mIcon: int = 0,
mSerialCode: int = 0):
super().__init__()
# TODO: figure out how to handle mTimestamp of type time_t
self.mDeviceName = mDeviceName
self.mMessage = mMessage
self.mGroupId = mGroupId
self.mIcon = mIcon
self.mSerialCode = mSerialCode
[docs]class GridCombineSetup_t(gm.GM_GridCombineSetup_t):
"""This type represents the input needed for creating a new grid layer by combining 2 input grid layers
GridCombineSetup_t(mCombineOp, mLayer1, mLayer2, mRectBounds: Rectangle_t = Rectangle_t(), mXRes: float = 0.0,
mYRes: float = 0.0,mDesc: str = 'Grid setup description', mFlags = gm.GM_CombineOp_FillGaps,
mElevUnits = gm.GM_ElevUnit_Meters, mCompareVal: float = 1.5)
Parameters
_______________
mCombineOp: GM_CombineOp_t8
Combine operation
mLayer1: GM_LayerHandle_t32
First input grid layer
mLayer2: GM_LayerHandle_t32
Second input grid layer
mRectBounds: Rectangle_t
Bounding rectangle in current projection in which to perform operation. Keep at null rectangle (all zero values) to use default of intersection of input grid layers.
mXRes: float
X resolution (in current proj units) to generate grid at (use 0.0 for auto-spacing determination)
mYRes: float
Y resolution (in current proj units) to generate grid at (use 0.0 for auto-spacing determination)
mDesc: str
Grid description
mFlags: GM_CombineOpFlags_t32
Flags to control operation
mElevUnits: GM_ElevUnits_t8
Elevation units for new grid layer
mCompareVal: float
Compare value to use for operations that compare to a value
"""
def __init__(self, mCombineOp, mLayer1, mLayer2, mRectBounds: Rectangle_t = Rectangle_t(), mXRes: float = 0.0,
mYRes: float = 0.0, mDesc: str = 'Grid setup description', mFlags=gm.GM_CombineOp_FillGaps,
mElevUnits=gm.GM_ElevUnit_Meters, mCompareVal: float = 1.5):
super().__init__()
# properties
self.mLayer1 = mLayer1
self.mLayer2 = mLayer2
self.mRectBounds = mRectBounds
# Fields
self.mCombineOp = mCombineOp
self.mCompareVal = mCompareVal
self.mDesc = mDesc
self.mElevUnits = mElevUnits
self.mFlags = mFlags
self.mXRes = mXRes
self.mYRes = mYRes
[docs]class GridGenSetup_t(gm.GM_GridGenSetup_t):
"""Object containing the inputs needed for gridding a set of vector data
GridGenSetup_t(mDesc = None, mFlags = gm.GM_GridGen_NoConstraints, mXRes = 0.0, mYRes = 0.0,
mElevUnits = gm.GM_PRJ_UNIT_METERS, mGridAlg = gm.GM_GridAlg_DefaultLidar,
mLidarField = gm.GM_LidarGrid_Elevation, mBandType = gm.GM_VAL_U8,mLidarBreaklineBinMult = 2,
mBounds = None, mTightnessMult = gm.GM_GRID_DISABLE_GAP_FILL, mTaperValue = 0.0, mGapFillSetup = None)
Parameters
_______________
mDesc: str
Grid description
mFlags: GM_GridGenFlags_t32
Flags for grid generation
mXRes: float
X resolution (in current proj units) to generate grid at (use 0.0 for auto-spacing determination)
mYRes: float
Y resolution (in current proj units) to generate grid at (use 0.0 for auto-spacing determination)
mElevUnits: UNIT
Units to generate grid at (elevation values in other units will be converted as needed)
mGridAlg: GM_GridAlg_t8
Algorithm to use for creating elevation grid (if any)
mLidarField: GM_LidarGridField_t8
Field of Lidar data to grid if gridding Lidar point clouds
mBandType: str
Band type to use for non-elevation gridding
mLidarBreaklineBinMult: GM_LidarGridField_t8
Number of cells to clear from a Lidar grid around 3D breaklines before applying breakline heights and filling gaps (valid if GM_GridGen_ApplyLidarBreaklines used). Typically in range 1-4.
mBounds: Rectangle_t
(GM_Rectangle_t)Bounding box to grid to in current proj units. Pass NULL to use the combined bounds of all input layers (the default).
mTightnessMult: float
Grid tightness multiplier (multiplies resolution) for discarding values far from a sample. Default of zero discards nothing. For Lidar bin gridding you typically do NOT want to use 0 as it it can be very slow to fill all gaps in irregular Lidar data. Use GM_GRID_DISABLE_GAP_FILL to disable gap filling altogether. For Lidar bin grids, gap fill values in the range 1-32 are common.
mGridBinMult: float
Grid bin multiplier for use if using a bin-based grid method. This is multiple of calculated point density.
mTaperValue: float
Taper value for gridding areas. 0.0 for no taper (default)
mGapFillSetup: FillGapsParams_t
Parameters to perform gap fill operations. Use NULL for default parameters.
"""
def __init__(self, mDesc: str = None, mFlags=gm.GM_GridGen_NoConstraints, mXRes: float = 0.0, mYRes: float = 0.0,
mElevUnits=gm.GM_PRJ_UNIT_METERS, mGridAlg=gm.GM_GridAlg_DefaultLidar,
mLidarField=gm.GM_LidarGrid_Elevation, mBandType=gm.GM_VAL_U8, mLidarBreaklineBinMult: int = 2,
mBounds: Rectangle_t = Rectangle_t(), mTightnessMult: float = 1.005,
mGridBinMult: float = 0, mTaperValue: float = 0.0, mGapFillSetup: FillGapsParams_t = None):
super().__init__()
self.mDesc = mDesc
self.mFlags = mFlags
self.mXRes = mXRes
self.mYRes = mYRes
self.mElevUnits = mElevUnits
self.mGridAlg = mGridAlg
self.mLidarField = mLidarField
self.mBandType = mBandType
self.mLidarBreaklineBinMult = mLidarBreaklineBinMult
self.mBounds = mBounds
self.mTightnessMult = mTightnessMult
self.mGridBinMult = mGridBinMult
self.mTaperValue = mTaperValue
self.mGapFillSetup = mGapFillSetup
[docs]class GridLayout_t(gm.GM_GridLayout_t):
"""This type represents layout information for a new elevation grid layer
GridLayout_t( mFlags = gm.GM_RasterLayout_BGROrder, mTopLeft: Point_t = Point_t(0,0), mXSpacing: float = 1.005,
mYSpacing: float = 2.005, mNumSamplesX: int = 100, mNumSamplesY: int = 100, mBytesPerRow: int = 256,
mNoDataValue: float = 1.00, mValType = gm.GM_VAL_U8, mElevUnits = gm.GM_ElevUnit_Meters, mReserved = 0)
Parameters
____________
mFlags: GM_RasterLayoutFlags_t32
General flags for layout.
mTopLeft: Point_t
Ground coordinates of center of the top left pixel
mXSpacing: float
Spacing of sample cells in the X direction
mYSpacing: float
Spacing of sample cells in the Y direction
mNumSamplesX: int, sint32
Number of pixels in the x direction
mNumSamplesY: int, sint32
Number of pixels in the y direction
mBytesPerRow: int, uint32
Number of bytes per row of data in data buffer. If 0 this will be calculated for you.
mNoDataValue: float
Value of samples for which the value isn't known (i.e. -9999.9)
mValType: GM_BandValType_t8
Band value type
mElevUnits: GM_ElevUnits_t8
Elevation units
mReserved: int, uint8
Reserved for alignment purposes
"""
def __init__(self, mFlags = gm.GM_RasterLayout_BGROrder, mTopLeft: Point_t = Point_t(0,0), mXSpacing: float = 1.005,
mYSpacing: float = 2.005, mNumSamplesX: int = 100, mNumSamplesY: int = 100, mBytesPerRow: int = 256,
mNoDataValue: float = 1.00, mValType = gm.GM_VAL_U8, mElevUnits = gm.GM_ElevUnit_Meters, mReserved = 0):
super().__init__()
self.mFlags = mFlags
self.mTopLeft = mTopLeft
self.mXSpacing = mXSpacing
self.mYSpacing = mYSpacing
self.mNumSamplesX = mNumSamplesX
self.mNumSamplesY = mNumSamplesY
self.mBytesPerRow = mBytesPerRow
self.mNoDataValue = mNoDataValue
self.mValType = mValType
self.mElevUnits = mElevUnits
#self.mReserved = mReserved
[docs]class ProjAttrValue_t(gm.GM_ProjAttrValue_t):
"""This type is used to describe a single projection attribute value
ProjAttrValue_t( mAttr = gm.CENTRAL_LONGITUDE, mValue = 0.0)
Parameters
_____________
mAttr: PROJATTR
Attribute
mValue: float
Attribute value
"""
def __init__(self, mAttr: int=gm.CENTRAL_LONGITUDE, mValue: float=0.0):
super().__init__()
# Fields
self.mAttr = mAttr
self.mValue = mValue
[docs]class Projection_t(gm.GM_Projection_t):
"""This type is used to fully describe a projection.
Projection_t(mProjSys: int = gm.GM_PRJ_GEO, mDatum: int = gm.GM_DATUM_WGS_84,
mUnit: int = gm.GM_PRJ_UNIT_METERS, mAttrList=None)
Parameters
___________
mProjSys: PROJSYS, int
Projection system
mDatum: DATUM, int
Horizontal datum
mUnit: UNIT, int
Ground units
mNumAttrs: int
Size of mAttrList
mAttrList: GM_ProjAttrValue_t
Attribute value list items
"""
def __init__(self, mProjSys: int = gm.GM_PRJ_GEO, mDatum: int = gm.GM_DATUM_WGS_84,
mUnit: int = gm.GM_PRJ_UNIT_METERS, mAttrList=None, mNumAttrs: int=0):
super().__init__()
# Fields
if mAttrList is None:
mAttrList = ([gm.GM_ProjAttrValue_t()] * 16) # the attribute list, when set through the = method, must be a list of 16 GM_ProjAttrValue_t objects
self.mProjSys = mProjSys
self.mDatum = mDatum
self.mUnit = mUnit
self.mAttrList = mAttrList
self.mNumAttrs = mNumAttrs
[docs]class LayerInfo_t(gm.GM_LayerInfo_t):
""" This type is used when returning information about a layer
LayerInfo_t( mDescription: str = None, mNativeRect: Rectangle_t = Rectangle_t(),
mGlobalRect: Rectangle_t = Rectangle_t(), mPixelWidth: int = 1920, mPixelHeight: int = 1080,
mNativeProj: Projection_t = Projection_t(), mControlPoints: gm.GM_GroundControlPoint_array = None,
mNumGCPs: int = 0, mMinElevation: float = 0.0, mMaxElevation: float = 10.0, mNumAreas: int = 1,
mNumLines: int = 1, mNumPoints: int = 0, mPixelSizeX: float = 0.5, mPixelSizeY: float = 0.5,
mHasRasterData: bool = False, mEnabled: bool = False, mHasVectorData: bool = False,
mUsedDefaultPos: bool = False, mFilename: str = None,mArchiveFilename: str = None, mTypeName: str = None,
mGlobalPixelWidth: int = 1920, mGlobalPixelHeight: int = 1080,
mMetadataList: gm.GM_AttrValue_array = None, mMetadataListSize: int = 0, mNumBands: int = 1,
mExtraLoadFlags: str = None, mPalette: gm.GM_PaletteEntry_array = None, mPaletteSize: int = 0,
mUserData: int = 1, mElevUnits=gm.GM_ElevUnit_Meters,mBandValType=gm.GM_VAL_U8, mBandBitDepth: int = 32,
mRasterTypeFlags=gm.GM_RasterType_Image, mUserText: str = None, mNumLidarPoints: int = 0,
mParentLayer:LayerHandle_t = LayerHandle_t(0), mDfltViewGlobal: Rectangle_t = Rectangle_t(),
mCodePage: int = 0, mGroupName: str = None, mUsedDefaultProj: bool = False,
mLayerFlags=gm.GM_LayerFlags_Default)
Parameters
________________
mFilename: str
Filename from which layer was loaded (if this is an archive file, like .zip, then the name of the actual loaded file will be in mArchiveFilename
mParentLayer: GM_LayerHandle_t32
Handle to parent layer if this is a child (i.e. from catalog or online layer). NULL for all top-level layers.
mDescription: str
Description string
mNativeRect: Rectangle_t
Bounding rect of layer in native coordinates
mGlobalRect: Rectangle_t
Bounding rect of layer in global coordinates
mPixelWidth: int, uint32
RASTER/ELEV ONLY: Number of pixels wide layer is (should be an unsigned integer)
mPixelHeight: int, uint32
RASTER/ELEV ONLY: Number of pixels tall layer is (should be an unsigned integer)
mNativeProj: Projection_t
Native projection of layer
mControlPoints: GroundControlPoint_array
Ground control points list. Point to GM_GroundControlPoint_t
mNumGCPs: int, uint32
RASTER ONLY: Number of ground control points in list
mMinElevation: float
ELEV ONLY: Minimum elevation in meters
mMaxElevation: float
ELEV ONLY: Maximum elevation in meters
mNumAreas: int, uint32
VECTOR ONLY: Number of area features (should be an unsigned integer)
mNumLines: int, uint32
VECTOR ONLY: Number of line features (should be an unsigned integer)
mNumPoints: int, uint32
VECTOR ONLY: Number of point features (should be an unsigned integer)
mPixelSizeX: float
RASTER/ELEV ONLY: Pixel size in meters in the x direction
mPixelSizeY: float
RASTER/ELEV ONLY: Pixel size in meters in the y direction
mHasRasterData: bool
Does this layer have raster or elevation data?
mEnabled: bool
Is this layer enabled for display or it it hidden?
mHasVectorData: bool
Does this layer have vector data (the features counts can all be 0 for things like map catalogs)
mUsedDefaultPos: bool
RASTER/ELEV ONLY: Was the default position used for this layer since the file could not be automatically positioned?
mArchiveFilename: str
Filename within archive file (e.g. .zip or .tar.gz) from which layer was loaded, if any (might be None)
mTypeName: str
Layer type name
mGlobalPixelHeight: int
RASTER/ELEV ONLY: Approximate number of pixels required in height for a 1:1 pixel mapping in the current projection (should be an unsigned integer)
mGlobalPixelWidth: int
RASTER/ELEV ONLY: Approximate number of pixels required in width for a 1:1 pixel mapping in the current projection (should be an unsigned integer)
mMetadataList: AttrValue_t
List of metadata attributes and values for the layer
mMetadataListSize: int
List of metadata attributes and values for the layer
mNumBands: int
Number of bands in a raster image (use GM_SetRasterDisplayOptions to change color band layout) (should be an unsigned integer)
mExtraLoadFlags: str
Additional load flags with options selected by user during load. Pass these to GM_LoadLayerListEx to remember options.
mPalette: PaletteEntry_array
List of palette entries for palette-based raster layer
mPaletteSize: int, uint32
Number of entries in palette list
mUserData: intPtr
Custom data associated with layer provided by user via GM_SetLayerUserData function
mElevUnits: GM_ElevUnits_t8
Elevation units for layer
mBandValType: GM_BandValType_t8
RASTER/ELEV ONLY: type of data for the bands
mBandBitDepth: int, uint16
RASTER/ELEV ONLY: number of bits per band value. Multiply by mNumBands to get total bit depth per sample.
mRasterTypeFlags: GM_RasterTypeFlags_t32
Raster type flags, specifies what type of data a raster layer actually contains
mUserText: str
Custom text string associated with layer provided by user via GM_SetLayerUserText function or loaded form workspace.
mNumLidarPoints: int, uint64
VECTOR ONLY: Number of Lidar point cloud points (fetch with GM_GetLidarPoint) (Should be an unsigned integer)
mDfltViewGlobal: Rectangle_t
Default view bounding rect of layer in global coordinates (usually same as mGlobalRect)
mCodePage: int, sint32
Code page for text in layer. 0 is default and current active code page (CP_ACP). CP_UTF8 is for UTF-8 interpretation.
mGroupName: str
Group name that the layer is in. NULL for no group. Separated with <sep> if multiple levels.
mUsedDefaultProj: boolean
Was the default projection used for this layer since a projection for the file could not be automatically determined?
mLayerFlags: GM_LayerFlags_t32
Extra flags for the layer
"""
# TODO mUserData is handled as void*
# TODO mNativeProj requires type Projection_t()
def __init__(self, mDescription: str = None, mNativeRect: Rectangle_t = Rectangle_t(),
mGlobalRect: Rectangle_t = Rectangle_t(), mPixelWidth: int = 1920, mPixelHeight: int = 1080,
mNativeProj: Projection_t = Projection_t(), mControlPoints: gm.GM_GroundControlPoint_array = None,
mNumGCPs: int = 0, mMinElevation: float = 0.0, mMaxElevation: float = 10.0, mNumAreas: int = 1,
mNumLines: int = 1, mNumPoints: int = 0, mPixelSizeX: float = 0.5, mPixelSizeY: float = 0.5,
mHasRasterData: bool = False, mEnabled: bool = False, mHasVectorData: bool = False,
mUsedDefaultPos: bool = False, mFilename: str = None,mArchiveFilename: str = None, mTypeName: str = None,
mGlobalPixelWidth: int = 1920, mGlobalPixelHeight: int = 1080,
mMetadataList: gm.GM_AttrValue_array = None, mMetadataListSize: int = 0, mNumBands: int = 1,
mExtraLoadFlags: str = None, mPalette: gm.GM_PaletteEntry_array = None, mPaletteSize: int = 0,
mUserData: int = 1, mElevUnits=gm.GM_ElevUnit_Meters,mBandValType=gm.GM_VAL_U8, mBandBitDepth: int = 32,
mRasterTypeFlags=gm.GM_RasterType_Image, mUserText: str = None, mNumLidarPoints: int = 0,
mParentLayer:LayerHandle_t = LayerHandle_t(0), mDfltViewGlobal: Rectangle_t = Rectangle_t(),
mCodePage: int = 0, mGroupName: str = None, mUsedDefaultProj: bool = False,
mLayerFlags=gm.GM_LayerFlags_Default):
super().__init__()
# Properties
self.mDescription = mDescription
self.mNativeRect = mNativeRect
self.mGlobalRect = mGlobalRect
self.mPixelWidth = mPixelWidth
self.mPixelHeight = mPixelHeight
self.mNativeProj = mNativeProj
self.mControlPoints = mControlPoints
self.mNumGCPs = mNumGCPs
self.mMinElevation = mMinElevation
self.mMaxElevation = mMaxElevation
self.mNumAreas = mNumAreas
self.mNumLines = mNumLines
self.mNumPoints = mNumPoints
self.mPixelSizeX = mPixelSizeX
self.mPixelSizeY = mPixelSizeY
self.mHasRasterData = mHasRasterData
self.mEnabled = mEnabled
self.mHasVectorData = mHasVectorData
self.mUsedDefaultPos = mUsedDefaultPos
self.mFilename = mFilename
self.mArchiveFilename = mArchiveFilename
self.mTypeName = mTypeName
self.mGlobalPixelWidth = mGlobalPixelWidth
self.mGlobalPixelHeight = mGlobalPixelHeight
self.mMetadataList = mMetadataList # when setting, use "obj.mAttrList = array_var.cast()". Without calling .cast(), it may not always work
self.mMetadataListSize = mMetadataListSize
self.mNumBands = mNumBands
self.mExtraLoadFlags = mExtraLoadFlags
self.mPalette = mPalette
self.mPaletteSize = mPaletteSize
self.mUserData = mUserData
self.mElevUnits = mElevUnits
self.mBandValType = mBandValType
self.mBandBitDepth = mBandBitDepth
self.mRasterTypeFlags = mRasterTypeFlags
self.mUserText = mUserText
self.mNumLidarPoints = mNumLidarPoints
self.mParentLayer = mParentLayer
self.mDfltViewGlobal = mDfltViewGlobal
self.mCodePage = mCodePage
self.mGroupName = mGroupName
self.mUsedDefaultProj = mUsedDefaultProj
self.mLayerFlags = mLayerFlags
[docs]class LineStyle_t(gm.GM_LineStyle_t):
"""This type is used to describe a style used for drawing a line feature and its label (if any)
LineStyle_t(mPenStyle=gm.GM_PEN_SOLID, mPenWidth: int = 0, mPenColor: COLORREF = COLORREF(0),
mDrawLabel: bool = True, mDrawLabelAlways: bool = False, mDrawLabelOnLine: bool = False,
mExtraStyleData: int = 0, mFont: FontDef_t = FontDef_t(), mLabelSegment: int = 0,
mFixedWidthMeters: float = 0.5, mBgPenWidth: int = 0,mBgPenColor: int = int(0))
Parameters
___________
mPenStyle: GM_PenStyle_t16
Pen style (i.e. solid, dash, etc.)
mPenWidth: int, uint16
Width in pixels to draw pen in (set to 0 for fixed width lines)
mPenColor: COLORREF
Color to use for pen
mDrawLabel: bool
Render the label for this line if there is one
mDrawLabelAlways: bool
Render the label for this line even if it collides with another display label
mDrawLabelOnLine: bool
Render the label for this line (if any) directly on the line rather than offset from it
mExtraStyleData: int, uint8
Extra parameter for some styles(i.e.scallop height for scallop line styles). Set to 0 for default behavior.
mFont: FontDef_t
Font to use to render label
mLabelSegment: int, sint32
Segment number (1-based) on which to render label (use 0 to use default label placement)
mFixedWidthMeters: float
Fixed width in meters to use for pen (only used if mPenWidth is zero)
mBgPenWidth: int,uint16
For double line pens, the width of the background line; if bg width is > 0, then this is a double line style
mBgPenColor: COLORREF
For double line pens, the color of the background line
"""
def __init__(self, mPenStyle=gm.GM_PEN_SOLID, mPenWidth: int = 0, mPenColor: COLORREF = COLORREF(0),
mDrawLabel: bool = True, mDrawLabelAlways: bool = False, mDrawLabelOnLine: bool = False,
mExtraStyleData: int = 0, mFont: FontDef_t = FontDef_t(), mLabelSegment: int = 0,
mFixedWidthMeters: float = 0.5, mBgPenWidth: int = 0,mBgPenColor: int =COLORREF(0)):
super().__init__()
# Fields
self.mPenStyle = mPenStyle
self.mPenWidth = mPenWidth
self.mPenColor = mPenColor
self.mDrawLabel = mDrawLabel
self.mDrawLabelAlways = mDrawLabelAlways
self.mDrawLabelOnLine = mDrawLabelOnLine
self.mExtraStyleData = mExtraStyleData
self.mFont = mFont
self.mLabelSegment = mLabelSegment
self.mFixedWidthMeters = mFixedWidthMeters
self.mBgPenWidth = mBgPenWidth
self.mBgPenColor = mBgPenColor
[docs]class LineFeature_t(gm.GM_LineFeature_t):
"""A Managed Definition of a Line Feature
LineFeature_t(mFeatureInfo: VectorFeature_t = VectorFeature_t(),
mPointList: gm.GM_Point_t_array = array([Point_t(0, 0), Point_t(0, 1)]),mNumPoints=2,
mLineStyle: LineStyle_t = LineStyle_t(), mVertexElevList: gm.float_array = array([1.05, 2.05]))
Parameters
___________
mFeatureInfo: VectorFeature_t
List of attributes associated with feature (pointer to GM_AttrValueCharPtr_t/GM_AttrValueIntPtr_t array) (Read-Only use the SetAttrList() member function to set new list)
mPointList: Point_t
List of points that make up the line (global coordinates when getting, native when adding feature)
mNumPoints: int
(No SDK desciption)
mLineStyle: LineStyle_t
Line render style (symbol and font)
mVertexElevList: float_array
Optional list of elevations for each point in line. If present, must have *mNumPoints* values
"""
# TODO Methods
# TODO Check -According to the SDK description, mPointList and mVertexElevList should be a list of Point_t and floats, repectively
# TODO Check -mNUmPoints
def __init__(self, mFeatureInfo: VectorFeature_t = VectorFeature_t(),
mPointList: gm.GM_Point_t_array = array([Point_t(0, 0), Point_t(0, 1)]),mNumPoints=2,
mLineStyle: LineStyle_t = LineStyle_t(), mVertexElevList: gm.float_array = array([1.5, 2.25])):
super().__init__()
# Fields
self.mFeatureInfo = mFeatureInfo
self.mPointList = mPointList # when setting, use "obj.mPointList = array_var.cast()". Without calling .cast(), it may not always work
self.mNumPoints = mNumPoints
self.mLineStyle = mLineStyle
self.mVertexElevList = mVertexElevList # when setting, use "obj.mVertexElevList = array_var.cast()". Without calling .cast(), it may not always work
[docs]class LineVolumeParams_t(gm.GM_LineVolumeParams_t):
"""This type is used to provide the parameters for calculating cut-and-fill volumes along a line feature
LineVolumeParams_t(mSize: int = 0, mPoints: gm.GM_Point_t_array = array([Point_t(0, 0), Point_t(0, 1)]),
mCutHeights: gm.float_array = array([1.00, 2.00]),mNumPoints: int = 2,
mCutHeightsAbsolute: bool = False, mCorridorWidth: float = 2.5, mXSpacing: float = 0.0,
mYSpacing: float = 0.0)
Parameters
____________
mSize: int, uint32
Size of structure
mPoints: Point_t_array
List of points in line in global coordinate system
mCutHeights: float_array
Cut heights for each point in meters
mNumPoints: int, uint32
Number of points in mPoints and mCutHeights
mCutHeightsAbsoluteL bool
Are the cut heights in mCutHeights relative to sea level (TRUE) or ground level (FALSE)
mCorridorWidth: float
Width (i.e. diameter) in meters of corridor around line in which to calculate volume
mXSpacing: float
Sample spacing in the x direction in global units
mYSpacing: float
Sample spacing in the y direction in global units
"""
# TODO Check datatypes of mCutHeights and mPoints (whether they should be arrays or not)
def __init__(self, mSize: int = 0, mPoints: gm.GM_Point_t_array = array([Point_t(0, 0), Point_t(0, 1)]),
mCutHeights: gm.float_array = array([1.00, 2.00]),mNumPoints: int = 2,
mCutHeightsAbsolute: bool = False, mCorridorWidth: float = 2.5, mXSpacing: float = 0.0,
mYSpacing: float = 0.0):
super().__init__()
# Fields
self.mSize = mSize
self.mPoints = mPoints
self.mCutHeights = mCutHeights
self.mNumPoints = mNumPoints
self.mCutHeightsAbsolute = mCutHeightsAbsolute
self.mCorridorWidth = mCorridorWidth
self.mXSpacing = mXSpacing
self.mYSpacing = mYSpacing
[docs]class MapCatalogInfo_t(gm.GM_MapCatalogInfo_t):
"""This type represents information about a map catalog. Use GM_GetLayerInfo for more generic information, like bounds.
MapCatalogInfo_t(mSize: int = 0, mNumMaps: int =1, mHideBounds: bool = False, mDisplayType = gm.GM_MapCatalog_DisplayTypePercent , mReserved: int = None, mDisplayValue: float = 1.001, mDisplayValue2: float = 2.005)
Parameters
___________
mSize: int, uint32
Size of structure
mHideBounds: bool
Hide layer bounds when not drawing data
mDisplayType: GM_MapCatalogDisplayType_t8
Controls when layers in catalog are displayed
mDisplayValue: float
First value related to display type
mDisplayValue2: float
Second value for range of scales
mNumMaps: int, uint32
mNumber of maps in catalog.
mReserved: int, uint8
Reserved for future use, must be 0
"""
def __init__(self, mSize: int = 0, mNumMaps: int =1, mHideBounds: bool = False,
mDisplayType = gm.GM_MapCatalog_DisplayTypePercent , mReserved: int = None, mDisplayValue: float = 1.001,
mDisplayValue2: float = 2.005):
super().__init__()
self.mSize = mSize
self.mNumMaps = mNumMaps
self.mHideBounds = mHideBounds
self.mDisplayType = mDisplayType
#self.mReserved = mReserved
self.mDisplayValue = mDisplayValue
self.mDisplayValue2 = mDisplayValue2
[docs]class PathProfileLOSParams_t(gm.GM_PathProfileLOSParams_t):
"""This type is used to provide the parameters for calculating path profiles and performing line of sight analysis
PathProfileLOSParams_t(mSize: int, mFlags:int, mStartX: float, mStartY: float, mEndX: float, mEndY: float,
mElevList: gm.float_array = array([3.25, 4.125]), mListSize: int = 2, mDfltElev: float = 1,
mDetailsStr: str = None, mDetailsStrMaxLen: int = 256, mAtmosphericCorr: float = 1.3333,
mLOSFromHeight: float = 1, mLOSToHeight: float = 5,mLOSMinClearance: float = 0.0,
mLOSMinClearancePos=Point_t(3, 3), mFresnelFreq: float = 0.0, mFresnelPctClear: float = 0.6,
mLOSFirstBlockedPos: Point_t = Point_t(0, 1), mLOSLastBlockedPos: Point_t = Point_t(2, 2))
Parameters
_____________
mSize: int, uint32
IN: Size of structure
mFlags: GM_PathProfileLOSFlags_t32
IN: Flags controlling behavior
mStartX: float
IN: Start X coord in current projection
mStartY: float
IN: Start Y coord in current projection
mEndX: float
IN: End X coord in current projection
mEndY: float
IN: End Y coord in current projection
mElevList: float_array
OUT: List of Elevations.
mListSize: int, uint32
IN: Number of elevations to retrieve
mDfltElev: float
IN: Elev to use when none could be found
mDetailsStr: str
String containing path details (set to NULL if you don't care)
mDetailsStrMaxLen: int, uint32
IN: Maximum length of details string
mAtmosphericCorr: float
IN: Atmospheric correction for LOS (1.3333 is standard for radio waves, 1.0 is no correction)
mLOSFromHeight: float
IN: Line-of-sight from height in meters
mLOSToHeight: float
IN: Line-of-sight to height in meters
mLOSMinClearance: float
OUT: Minimum line-of-sight clearance in meters (will be negative if the line of sight is not clear)
mLOSMinClearancePos: Point_t
OUT: Location of minimum line-of-sight clearance
mFresnelFreq: float
IN: Frequency (in GHz) to use for testing clearance of first Fresnel zone (use 0.0 to not do Fresnel testing)
mFresnelPctClear: float
IN: Percentage of first Fresnel zone that must be clear of obstacles (use 0.6 for 60%). If 0 is specified, the default of 60% is used.
mLOSFirstBlockedPos: Point_t
OUT: Location of first blocked location along path (only valid if mLOSMinClearance is negative)
mLOSLastBlockedPos: Point_t
OUT: Location of last blocked location along path (only valid if mLOSMinClearance is negative)
"""
def __init__(self, mSize: int=0, mFlags:int=gm.GM_PathProfile_LOSValid, mStartX: float=0, mStartY: float=0, mEndX: float=0, mEndY: float=0,
mElevList: gm.float_array = array([3.25, 4.125]), mListSize: int = 2, mDfltElev: float = 1,
mDetailsStr: str = None, mDetailsStrMaxLen: int = 256, mAtmosphericCorr: float = 1.3333,
mLOSFromHeight: float = 1, mLOSToHeight: float = 5,mLOSMinClearance: float = 0.0,
mLOSMinClearancePos=Point_t(3, 3), mFresnelFreq: float = 0.0, mFresnelPctClear: float = 0.6,
mLOSFirstBlockedPos: Point_t = Point_t(0, 1), mLOSLastBlockedPos: Point_t = Point_t(2, 2)):
super().__init__()
self.mSize = mSize
self.mFlags = mFlags
self.mStartX = mStartX
self.mStartY = mStartY
self.mEndX = mEndX
self.mEndY = mEndY
self.mElevList = mElevList # when setting, use "obj.mElevList = array_var.cast()". Without calling .cast(), it may not always work
self.mListSize = mListSize
self.mDfltElev = mDfltElev
self.mDetailsStr = mDetailsStr
self.mDetailsStrMaxLen = mDetailsStrMaxLen
self.mAtmosphericCorr = mAtmosphericCorr
self.mLOSFromHeight = mLOSFromHeight
self.mLOSToHeight = mLOSToHeight
self.mLOSMinClearance = mLOSMinClearance
self.mLOSMinClearancePos = mLOSMinClearancePos
self.mFresnelFreq = mFresnelFreq
self.mFresnelPctClear = mFresnelPctClear
self.mLOSFirstBlockedPos = mLOSFirstBlockedPos
self.mLOSLastBlockedPos = mLOSLastBlockedPos
[docs]class PixelRect_t(gm.GM_PixelRect_t):
"""This type describes a bounding rectangle in pixel coordinates
PixelRect_t(mBottom: int = 0, mLeft: int = 0, mRight: int = 0, mTop: int = 0)
Parameters
___________
mBottom: int, sint32
Bottom coordinate of rectangle
mLeft: int, sint32
Left coordinate of rectangle
mRight: int, sint32
Right coordinate of rectangle
mTop: int, sint32
Top coordinate of rectangle
"""
def __init__(self, mLeft: int = 0, mRight: int = 0, mTop: int = 0, mBottom: int = 0):
super().__init__()
# Fields
self.mLeft = mLeft
self.mRight = mRight
self.mTop = mTop
self.mBottom = mBottom
[docs]class Point3D_t(gm.GM_Point3D_t):
"""Structure for holding a 3D Point
Point3D_t(mX: float=0, mY: float=0, mElev: float=0)
Parameters
___________
mX: float
x coordinate
mY: float
y coordinate
mElev: float
Elevation value
"""
def __init__(self, mX: float = 0, mY: float = 0, mElev: float = 0):
super().__init__()
self.mX = mX
self.mY = mY
self.mElev = mElev
[docs]class PointStyle_t(gm.GM_PointStyle_t):
"""This type is used to describe a style used for drawing a point feature and its label (if any)
PointStyle_t(mSymbolName: str='Dot', mFont: FontDef_t = FontDef_t(), mDrawLabel: bool = True,
mDrawLabelAlways: bool = True, mRotation: int = 0, mScale: float = -10)
Parameters
___________
mSymbolName: str
Name of symbol
mFont: FontDef_t
Font to use to render label
mDrawLabel: bool
Render the label for this line if there is one
mDrawLabelAlways: bool
Render the label for this line even if it collides with another display label
mRotation: int, uint32
rotation angle in degrees (0 is up/north, 90 right/east, etc.) OR'd with rotation sense flags (GM_RotationSense_t16)
mScale: float
Symbol scaling factor to apply (use negative values to make symbol a fixed height in meters, i.e. -10 would make symbol 10 meters high)
"""
# TODO Methods
def __init__(self, mSymbolName: str='Dot', mFont: FontDef_t = FontDef_t(), mDrawLabel: bool = True,
mDrawLabelAlways: bool = True, mRotation: int = 0, mScale: float = -10):
super().__init__()
# Fields
self.mSymbolName = mSymbolName
self.mFont = mFont
self.mDrawLabel = mDrawLabel
self.mDrawLabelAlways = mDrawLabelAlways
self.mRotation = mRotation
self.mScale = mScale
# has methods
[docs]class PointFeature_t(gm.GM_PointFeature_t):
"""A Managed Definition of a Point Feature
PointFeature_t(mFeatureInfo: VectorFeature_t = VectorFeature_t(),mPos: Point_t = Point_t(0, 0),
mPointStyle: PointStyle_t = PointStyle_t('Default_Point_Style'))
Parameters
_____________
mFeatureInfo: VectorFeature_t
Returns the Feature Info (To update us Various update functions)
mPos: Point_t
Location of the point (global coordinates when getting, native when adding feature)
mPointStyle: PointStyle_t
Point render style (symbol and font) (Read-Only use the SetPointStyle() member function to set)
"""
# TODO Methods
def __init__(self, mFeatureInfo: VectorFeature_t = VectorFeature_t(),mPos: Point_t = Point_t(0, 0),
mPointStyle: PointStyle_t = PointStyle_t()):
super().__init__()
self.mFeatureInfo = mFeatureInfo
self.mPos = mPos
self.mPointStyle = mPointStyle
# Has methods
[docs]class PreTranslateMessageInfo_t(gm.GM_PreTranslateMessageInfo_t):
"""
PreTranslateMessageInfo_t(mMSG: int = 0, mMsgProcessed: bool=True)
"""
def __init__(self, mMSG: int = 0, mMsgProcessed: bool = True):
super().__init__()
self.mMSG = mMSG # TODO: Handled as void*, probably shouldn't be
self.mMsgProcessed = mMsgProcessed
[docs]class RasterDisplayOptions_t(gm.GM_RasterDisplayOptions_t):
"""This type represents the display options available for raster and elevation layers
RasterDisplayOptions_t(self, mSize: int=0, mContrastMode: int=gm.GM_Contrast_None, mAutoClipCollar: bool=False, mColorIntensity: int=0, mSamplingMethod: int=gm.GM_SAMPLING_NEAREST_NEIGHBOR,
mTextureMap: bool=False, mBlendMode: int=gm.GM_BlendMode_None, mTranslucency: int=512, mTransparent: bool=False, mTransparentColor: int=0xFFFFFFFF,
mTransparentColorDist: int=0, mRedAdjustPercent: int=50, mGreenAdjustPercent: int=50, mBlueAdjustPercent: int=50, mBandLayoutValid: bool=False, mBandIdxRed: int=0,
mBandIdxGreen: int=0, mBandIdxBlue: int=0, mContrastNumStdDev: int=0, mContrastShared: bool=False, mColorGradeValid: bool=False, mColorGradeRedInMin: int=0,
mColorGradeRedInMax: int=0, mColorGradeRedOutMin: int=0, mColorGradeRedOutMax: int=0, mColorGradeBlueInMin: int=0, mColorGradeBlueInMax: int=0, mColorGradeBlueOutMin: int=0,
mColorGradeBlueOutMax: int=0, mColorGradeGreenInMin: int=0, mColorGradeGreenInMax: int=0, mColorGradeGreenOutMin: int=0, mColorGradeGreenOutMax: int=0,
mColorGradeSaturation: float=0.5, mTransparentColorList: gm.COLORREF_array=gm.COLORREF_array(1))
Parameters
_____________
mSize: unit32, int
Size
mContrastMode: GM_ContrastMode_t8
Contrast adjustment mode
mAutoClipCollar: bool
Automatically crop off a DRG, BSB, or other known collar boundary
mColorIntensity: uint8, int
Color intensity (0-20). Lower values are lighter, higher values are darker.
mSamplingMethod: GM_SamplingMethod_t8, int
Specify how resampling should be done for this layer for display and export
mTextureMap: bool
Texture map this raster layer over any underlying elevation layers.
mBlendMode: GM_BlendMode_t8, int
Blend mode to use to blend this raster layer with underlying layers or to interpret the color values of the layer
mTranslucency: uint16, int
Translucency level of layer (0 - completely see-through, 512 - completely opaque)
mTransparent: bool
Is layer transparent?
mTransparentColor: COLORREF, int
Color to make transparent
mTransparentColorDist: uint8, int
Fuzzy transparency support. Distance from transparent color to treat nearby colors transparent.
mRedAdjustPercent: sint8, int
Percentage to adjust red color channel by (-100 to 100)
mGreenAdjustPercent: sint8, int
Percentage to adjust green color channel by (-100 to 100)
mBlueAdjustPercent: sint8, int
Percentage to adjust blue color channel by (-100 to 100)
mBandLayoutValid: bool
Are the band layout values valid?
mBandIdxRed: uint8, int
Index of color band (0-based) to use for red color channel
mBandIdxGreen: uint8, int
Index of color band (0-based) to use for green color channel
mBandIdxBlue: uint8, int
Index of color band (0-based) to use for blue color channel
mContrastNumStdDev: float (double)
Number of standard deviations from mean to stretch for contrast adjustment (if 0 is used the default of 2 will be used)
mContrastShared: bool
Is the contrast adjustment shared with other loaded layers?
mColorGradeValid: bool
Are the color grade options valid?
mColorGradeRedInMin: uint8, int
Minimum red input color value
mColorGradeRedInMax: uint8, int
Maximum red input color value
mColorGradeRedOutMin: uint8, int
Minimum red output color value
mColorGradeRedOutMax: uint8, int
Maximum red output color value
mColorGradeBlueInMin: uint8, int
Minimum Blue input color value
mColorGradeBlueInMax: uint8, int
Maximum Blue input color value
mColorGradeBlueOutMin: uint8, int
Minimum Blue output color value
mColorGradeBlueOutMax: uint8, int
Maximum Blue output color value
mColorGradeGreenInMin: uint8, int
Minimum Green input color value
mColorGradeGreenInMax: uint8, int
Maximum Green input color value
mColorGradeGreenOutMin: uint8, int
Minimum Green output color value
mColorGradeGreenOutMax: uint8, int
Maximum Green output color value
mColorGradeSaturation: uint8, int
Saturation (valid 0.0 - 1.0)
mTransparentColorList: COLORREF_array
List of colors to make transparent.
use set_mTransparentColorList(val) and get_mTransparentColorList() -> GM.COLORREF_array do not set directly.
mTransparentColorListSize:
Size of mTransparentColorList
"""
def __init__(self, mSize: int = 0, mContrastMode: int = gm.GM_Contrast_None, mAutoClipCollar: bool = False,
mColorIntensity: int = 0, mSamplingMethod: int = gm.GM_SAMPLING_NEAREST_NEIGHBOR,
mTextureMap: bool = False, mBlendMode: int = gm.GM_BlendMode_None, mTranslucency: int = 512,
mTransparent: bool = False, mTransparentColor: int = 0xFFFFFFFF,
mTransparentColorDist: int = 0, mRedAdjustPercent: int = 50, mGreenAdjustPercent: int = 50,
mBlueAdjustPercent: int = 50, mBandLayoutValid: bool = False, mBandIdxRed: int = 0,
mBandIdxGreen: int = 0, mBandIdxBlue: int = 0, mContrastNumStdDev: float = 0,
mContrastShared: bool = False, mColorGradeValid: bool = False, mColorGradeRedInMin: int = 0,
mColorGradeRedInMax: int = 0, mColorGradeRedOutMin: int = 0, mColorGradeRedOutMax: int = 0,
mColorGradeBlueInMin: int = 0, mColorGradeBlueInMax: int = 0, mColorGradeBlueOutMin: int = 0,
mColorGradeBlueOutMax: int = 0, mColorGradeGreenInMin: int = 0, mColorGradeGreenInMax: int = 0,
mColorGradeGreenOutMin: int = 0, mColorGradeGreenOutMax: int = 0,
mColorGradeSaturation: float = 0.5,
mTransparentColorList: gm.COLORREF_array = array([COLORREF(0), COLORREF(1)]),
mTransparentColorListSize: int=2):
super().__init__()
self.mSize = mSize
self.mContrastMode = mContrastMode
self.mAutoClipCollar = mAutoClipCollar
self.mColorIntensity = mColorIntensity
self.mSamplingMethod = mSamplingMethod
self.mTextureMap = mTextureMap
self.mBlendMode = mBlendMode
self.mTranslucency = mTranslucency
self.mTransparent = mTransparent
self.mTransparentColor = mTransparentColor
self.mTransparentColorDist = mTransparentColorDist
self.mRedAdjustPercent = mRedAdjustPercent
self.mGreenAdjustPercent = mGreenAdjustPercent
self.mBlueAdjustPercent = mBlueAdjustPercent
self.mBandLayoutValid = mBandLayoutValid
self.mBandIdxRed = mBandIdxRed
self.mBandIdxGreen = mBandIdxGreen
self.mBandIdxBlue = mBandIdxBlue
self.mContrastNumStdDev = mContrastNumStdDev
self.mContrastShared = mContrastShared
self.mColorGradeValid = mColorGradeValid
self.mColorGradeRedInMin = mColorGradeRedInMin
self.mColorGradeRedInMax = mColorGradeRedInMax
self.mColorGradeRedOutMin = mColorGradeRedOutMin
self.mColorGradeRedOutMax = mColorGradeRedOutMax
self.mColorGradeBlueInMin = mColorGradeBlueInMin
self.mColorGradeBlueInMax = mColorGradeBlueInMax
self.mColorGradeBlueOutMin = mColorGradeBlueOutMin
self.mColorGradeBlueOutMax = mColorGradeBlueOutMax
self.mColorGradeGreenInMin = mColorGradeGreenInMin
self.mColorGradeGreenInMax = mColorGradeGreenInMax
self.mColorGradeGreenOutMin = mColorGradeGreenOutMin
self.mColorGradeGreenOutMax = mColorGradeGreenOutMax
self.mColorGradeSaturation = mColorGradeSaturation
self.mTransparentColorList = mTransparentColorList # when setting, use "obj.mTransparentColorList = array_var.cast()". Without calling .cast(), it may not always work
self.mTransparentColorListSize = mTransparentColorListSize
[docs]class RasterLayout_t(gm.GM_RasterLayout_t):
"""This type represents layout information for a new custom raster layer
RasterLayout_t(mTopLeft: Point_t, mFlags = gm.GM_RasterLayout_BGROrder, mXPixelSize: float = 1,
mYPixelSize: float = 1, mPixelHeight: int = 1080, mPixelWidth: int = 1920, mNumBands: int = 3,
mBitsPerBand: int = 8, mBytesPerRow: int = 0, mPalette: COLORREF = None,
mPaletteSize: int = 16, mAlphaBandIdx: int = 0)
Parameters
______________
mTopLeft: Point_t
Ground coordinates of top left corner of the top left pixel
mFlags: RasterLayoutFlags_t32
General flags for layout.
mXPixelSize: float
Size of each pixel in the x direction
mYPixelSize float
Size of each pixel in the y direction
mPixelWidth: int, sint32
Number of pixels in the x direction
mPixelHeight: int, sint32
Number of pixels in the y direction
mNumBands: int, uint32
Number of bands of data (usually 1 for grayscale or 3 for RGB)
mBitsPerBand: int, uint32
Number of bits per band of data (usually 8)
mBytesPerRow: int, uint32
Number of bytes per row of data in data buffer. If 0 this will be calculated for you.
mPalette: COLORREF
Array of colors for palette (set to NULL for no palette)
mPaletteSize: int, uint32
Number of colors in palette
mAlphaBandIdx: int, uint32
0-based alpha channel band index (usually 0 or 3). Ignored unless GM_RasterLayout_AlphaPresent flag is set.
"""
def __init__(self, mFlags=gm.GM_RasterLayout_BGROrder, mTopLeft: Point_t = Point_t(0,0), mXPixelSize: float = 1,
mYPixelSize: float = 1, mPixelHeight: int = 1080, mPixelWidth: int = 1920, mNumBands: int = 3,
mBitsPerBand: int = 8, mBytesPerRow: int = 0, mPalette: COLORREF = None,
mPaletteSize: int = 0, mAlphaBandIdx: int = 0):
super().__init__()
# Fields
self.mFlags = mFlags
self.mTopLeft = mTopLeft
self.mXPixelSize = mXPixelSize
self.mYPixelSize = mYPixelSize
self.mPixelHeight = mPixelHeight
self.mPixelWidth = mPixelWidth
self.mNumBands = mNumBands
self.mBitsPerBand = mBitsPerBand
self.mBytesPerRow = mBytesPerRow
self.mPalette = mPalette
self.mPaletteSize = mPaletteSize # No SDK decription
self.mAlphaBandIdx = mAlphaBandIdx
[docs]class RoughnessGridParams_t(gm.GM_RoughnessGridParams_t):
"""Structure defining setup for a roughness operation
RoughnessGridParams_t(mTable: int=gm.GM_Roughness_CorineSummer, mFlags: int=gm.GM_RoughnessFlags_DisableProgress, mBounds: Rectangle_t:Rectangle_t(), mXSpacing: float=0, mYSpacing: float=0,
mDesc: str='Roughness layer_GM_attribute', mCreateAreas: bool=True)
Parameters
_______________
mTable: GM_RoughnessTable_t, int
Table to use for converting color/land cover type to roughness values
mFlags: GM_RoughnessGridFlags_t32, int
Misc. flags to control operation
mBounds: GM.Rectangle_t
Bounding rectangle (in specified projection) for roughness grid (pixel-is-area, i.e. provide coordinates of outer edge of sample not center of pixel)
mDesc: str
Layer description
mXSpacing: float
Grid cell spacing in X dimension in specified projection coordinates (use 0.0 for default)
mYSpacing: float
Grid cell spacing in Y dimension in specified projection coordinates (use 0.0 for default)
mCreateAreas: bool
Create roughness areas.
"""
def __init__(self, mTable: int = gm.GM_Roughness_CorineSummer, mFlags: int = gm.GM_RoughnessFlags_DisableProgress,
mBounds: Rectangle_t = Rectangle_t(), mDesc: str = 'Roughness layer_GM_attribute',
mXSpacing: float = 0, mYSpacing: float = 0, mCreateAreas: bool = True):
super().__init__()
self.mTable = mTable
self.mFlags = mFlags
self.mBounds = mBounds
self.mDesc = mDesc
self.mXSpacing = mXSpacing
self.mYSpacing = mYSpacing
self.mCreateAreas = mCreateAreas
[docs]class RotatedRect_t(gm.GM_RotatedRect_t):
"""This type defines a rotated rectangle with a ground coordinate at each of 4 corners
RotatedRect_t(mTopLeft: Point_t=Point_t(0, 0), mTopRight: Point_t=Point_t(0, 0),
mBottomRight: Point_t=Point_t(0, 0), mBottomLeft: Point_t=Point_t(0, 0))
Parameters
_____________
mTopLeft: GM_Point_t
Top left point
mTopRight: GM_Point_t
Top right point
mBottomRight: GM_Point_t
Bottom right point
mBottomLeft: GM_Point_t
Bottom left point
"""
def __init__(self, mTopLeft: Point_t = Point_t(0, 0), mTopRight: Point_t = Point_t(0, 0),
mBottomRight: Point_t = Point_t(0, 0), mBottomLeft: Point_t = Point_t(0, 0)):
super().__init__()
self.mTopLeft = mTopLeft
self.mTopRight = mTopRight
self.mBottomRight = mBottomRight
self.mBottomLeft = mBottomLeft
[docs]class ShaderOptions_t(gm.GM_ShaderOptions_t):
"""This type represents the display options available for the built-in elevation shaders
ShaderOptions_t(mSize: int = 0, mDaylightShaderColor: int = 0xFFFFFFFF, mGradientShaderLoColor: int = 0,
mGradientShaderHiColor: int = 0xFFFFFFFF, mSlopeShaderMinColor: int = 0,
mSlopeShaderMinSlope: float = 0,
mSlopeShaderMaxColor: int = 0xFFFFFFFF, mSlopeShaderMaxSlope: float = 0,
mHSVShaderLoColorStart: float = 0, mHSVShaderSaturation: float = 0.5, mHSVShaderValue: float = 0.5,
mHSVShaderRange: float = 100, mHSVShaderReverse: bool = False, mSlopeShaderCustomValid: bool = True,
mReserved = array([0,0], dtype=uint8),mSlopeShaderCustomColor: int = 0xFFFFFFFF)
Parameters
_____________
mSize: int, uint32
Size of structure
mDaylightShaderColor: COLORREF, int
Surface color for daylight shader
mGradientShaderLoColor: COLORREF, int
Min elevation color for gradient shader
mGradientShaderHiColor: COLORREF, int
Max elevation color for gradient shader
mSlopeShaderMinColor: COLORREF, int
Min slope color for slope shader
mSlopeShaderMinSlope: float
Min slope for slope shader in radians
mSlopeShaderMaxColor: COLORREF, int
Max slope color for slope shader
mSlopeShaderMaxSlope: float
Max slope for slope shader in radians
mHSVShaderLoColorStart: float
HSV Shader - Low Color Start in Degrees (0-360)
mHSVShaderSaturation: float
HSV Shader - Saturation (0-1)
mHSVShaderValue: float
HSV Shader - Value (0-1)
mHSVShaderRange: float
HSV Shader - Range (>1)
mHSVShaderReverse: bool
HSV Shader - Reverse Colors
mSlopeShaderCustomValid: bool
Is the custom slope shader color valid?
mReserved
Reserved padding bytes
mSlopeShaderCustomColor: COLORREF, int
Color to display between min and max slope for slope shader (set mSlopeShaderCustomValid to TRUE to enable)
"""
def __init__(self, mSize: int = 0, mDaylightShaderColor: int = 0xFFFFFFFF, mGradientShaderLoColor: int = 0,
mGradientShaderHiColor: int = 0xFFFFFFFF, mSlopeShaderMinColor: int = 0,
mSlopeShaderMinSlope: float = 0,
mSlopeShaderMaxColor: int = 0xFFFFFFFF, mSlopeShaderMaxSlope: float = 0,
mHSVShaderLoColorStart: float = 0, mHSVShaderSaturation: float = 0.5, mHSVShaderValue: float = 0.5,
mHSVShaderRange: float = 100, mHSVShaderReverse: bool = False, mSlopeShaderCustomValid: bool = True,
mReserved = array([0,0], dtype=uint8),mSlopeShaderCustomColor: int = 0xFFFFFFFF):
super().__init__()
self.mSize = mSize
self.mDaylightShaderColor = mDaylightShaderColor
self.mGradientShaderLoColor = mGradientShaderLoColor
self.mGradientShaderHiColor = mGradientShaderHiColor
self.mSlopeShaderMinColor = mSlopeShaderMinColor
self.mSlopeShaderMinSlope = mSlopeShaderMinSlope
self.mSlopeShaderMaxColor = mSlopeShaderMaxColor
self.mSlopeShaderMaxSlope = mSlopeShaderMaxSlope
self.mHSVShaderLoColorStart = mHSVShaderLoColorStart
self.mHSVShaderSaturation = mHSVShaderSaturation
self.mHSVShaderValue = mHSVShaderValue
self.mHSVShaderRange = mHSVShaderRange
self.mHSVShaderReverse = mHSVShaderReverse
self.mSlopeShaderCustomValid = mSlopeShaderCustomValid
self.mSlopeShaderCustomColor = mSlopeShaderCustomColor
self.mReserved = mReserved.cast()
[docs]class ValName_t(gm.GM_ValName_t):
"""This type is used to describe a value and its associated name
Parameters
____________
mVal: int
Value
mName: str
Value name
"""
def __init__(self, mVal: int, mName: str):
super().__init__()
# Fields
self.mVal = mVal
self.mName = mName
[docs]class ViewShedParams_t(gm.GM_ViewShedParams_t):
"""This type represents the display options available for the built-in elevation shaders
ViewShedParams_t(mVectorLayerList, mVectorLayerListCnt, mSize:int = 0, mAngleEnd: float = 6.28319,
mAngleStart = 0, mAtmosphericCorr = 1.33, mCenterPoint = Point_t(0, 0),
mColor = 0, mDesc = None, mFilterRect = Rectangle_t(), mFresnelFreq = 0.0,
mFresnelPctClear = 0.6, mGenCoveragePolys = False, mRadius = 10000,
mReceiverAngle = None, mReceiverAngleEnd = None, mReceiverHeight = 5,
mReceiverHeightAbs = False, mShowHiddenPoints = False, mShowProgress = True,
mTransmitterHeight = 5, mTransmitterHeightAbs = False, mUseEarthCurvature = True,
mVectorElevsAbs = False, mXSpacing = 0.0, mYSpacing = 0.0)
Parameters
____________
mSize: int, uint32
Size of structure
mAngleEnd: float
End angle in radians for radar sweep
mAngleStart: float
Start angle in radians for radar sweep
mAtmosphericCorr: float
Atmospheric correction value (1.0 for none)
mCenterPoint: Point_t
Center point in global coordinates
mColor: COLORREF
Color to display view shed data in
mDesc: str
View shed description
mRadius: float
Search radius in meters
mReceiverAngle: float
Angle (in degrees) above horizon to test at (NULL for none)
mReceiverHeight: float
Height at which transmitter must be visible
mReceiverHeightAbs: float
Is the receiver height absolute or relative to the ground?
mShowHiddenPoints: bool
hidden points visible instead of viewable points.
mShowProgress: bool
Display view shed calculation progress?
mGenCoveragePolys: float
Generate area/polygon features for the covered area (these are vector and exportable to vector formats)
mTransmitterHeight: float
Transmitter height in meters
mTransmitterHeightAbs: bool
Is the transmitter height absolute or relative to the ground?
mUseEarthCurvature: bool
Use the curvature of the earth in the analysis?
mVectorElevsAbs: bool
Are vector elevations absolute (i.e. relative to sea level) or relative to ground level?
mVectorLayerList: GM_LayerHandle_t32
List of vector layers to use features with elevation attributes from
mVectorLayerListCnt: int, uint32
Number of vector layers in list
mXSpacing X: float
sample spacing (use 0.0 for default spacing)
mYSpacing Y: float
sample spacing (use 0.0 for default spacing)
mFilterRect: Rectangle_t
Optional rectangle for filtering view shed to a certain area of interest
mReceiverAngleEnd: float
(in degrees) above horizon to stop test at (NULL for none) - if this and mReceiverAngle are provided, an angle range view shed test is done (like a flashlight beam)
mFresnelFreq: float
Frequency (in GHz) to use for testing clearance of first Fresnel zone (use 0.0 to not do Fresnel testing)
mFresnelPctClear: float
Percentage of first Fresnel zone that must be clear of obstacles (use 0.6 for 60%). If 0 is specified, the default of 60% is used.
"""
def __init__(self, mSize: int, mAngleEnd: float, mAngleStart: float, mAtmosphericCorr: float,
mCenterPoint: Point_t, mColor: COLORREF = 0, mDesc: str = None, mRadius: float = 10000,
mReceiverAngle: gm.double_array = None, mReceiverHeight: float = 5, mReceiverHeightAbs: bool = False,
mShowHiddenPoints: bool = False, mShowProgress: bool = True, mGenCoveragePolys: bool = False,
mTransmitterHeight: float = 5, mTransmitterHeightAbs: bool = False, mUseEarthCurvature: bool = True,
mVectorElevsAbs: bool = False, mVectorLayerList: gm.GM_LayerHandle_array = array([LayerHandle_t(0)]),
mVectorLayerListCnt: int = 1, mXSpacing: float = 0.0, mYSpacing: float = 0.0,
mFilterRect: Rectangle_t = Rectangle_t(), mReceiverAngleEnd: gm.double_array = None,
mFresnelFreq: float = 0.0, mFresnelPctClear: float = 0.6):
super().__init__()
self.mSize = mSize
self.mAngleEnd = mAngleEnd
self.mAngleStart = mAngleStart
self.mAtmosphericCorr = mAtmosphericCorr
self.mCenterPoint = mCenterPoint
self.mColor = mColor
self.mDesc = mDesc
self.mFilterRect = mFilterRect
self.mFresnelFreq = mFresnelFreq
self.mFresnelPctClear = mFresnelPctClear
self.mGenCoveragePolys = mGenCoveragePolys
self.mRadius = mRadius
self.mReceiverAngle = mReceiverAngle
self.mReceiverAngleEnd = mReceiverAngleEnd
self.mReceiverHeight = mReceiverHeight
self.mReceiverHeightAbs = mReceiverHeightAbs
self.mShowHiddenPoints = mShowHiddenPoints
self.mShowProgress = mShowProgress
self.mTransmitterHeight = mTransmitterHeight
self.mTransmitterHeightAbs = mTransmitterHeightAbs
self.mUseEarthCurvature = mUseEarthCurvature
self.mVectorElevsAbs = mVectorElevsAbs
self.mVectorLayerList = mVectorLayerList.cast() # when setting, use "obj.mVectorLayerList = array_var.cast()". Without calling .cast(), it may not always work
self.mVectorLayerListCnt = mVectorLayerListCnt
self.mXSpacing = mXSpacing
self.mYSpacing = mYSpacing
[docs]class WatershedParams_t(gm.GM_WatershedParams_t):
"""Type defining parameters for watershed/drainage/stream calculation
WatershedParams_t(mFlags: int = gm.GM_Watershed_FillGaps, mBounds: Rectangle_t = Rectangle_t(),
mDesc: str = 'Watershed layer_GM_attribute',
mXSpacing: float = 0.0, mYSpacing: float = 0.0, mFilledDEMFilename: str = "",
mMaxDepressionDepth: float = 0.0, mStreamThreshold: int = 2)
Parameters
___________
mFlags: GM_WatershedFlags_32, int
Flags with misc. options
mBounds: Rectangle_t
Bounding rectangle (in specified projection) for watershed
mDesc: str
Layer description
mXSpacing: float
Grid cell spacing in X dimension in specified projection coordinates (use 0.0 for default)
mYSpacing: float
Grid cell spacing in Y dimension in specified projection coordinates (use 0.0 for default)
mFilledDEMFilename: str
Filename to save filled DEM to as a GMG file (typically NULL or empty string)
mMaxDepressionDepth: float
Maximum depth of depression to fill in meters (0.0 for no depression filling)
mStreamThreshold: int, uint32
Drainage threshold for how many cells have to flow to a cell before it is considered part of a stream.
"""
def __init__(self, mFlags: int = gm.GM_Watershed_FillGaps, mBounds: Rectangle_t = Rectangle_t(),
mDesc: str = 'Watershed layer_GM_attribute',
mXSpacing: float = 0.0, mYSpacing: float = 0.0, mFilledDEMFilename: str = "",
mMaxDepressionDepth: float = 0.0, mStreamThreshold: int = 2):
super().__init__()
self.mFlags = mFlags
self.mBounds = mBounds
self.mDesc = mDesc
self.mXSpacing = mXSpacing
self.mYSpacing = mYSpacing
self.mFilledDEMFilename = mFilledDEMFilename
self.mMaxDepressionDepth = mMaxDepressionDepth
self.mStreamThreshold = mStreamThreshold
[docs]class LidarClassFilter_t(gm.GM_LidarClassFilter_t): # TODO: Broken until fix for uint32 arrays is implemented
"""Define a filter for Lidar classes with 1 bit for each Lidar class (from 0-255). The first uint32 is for classes 0-31,
the next for classes 32-63, etc. Use gm.LidarClassFilter_IsClassEnabled and gm.LidarClassFilter_SetClassEnabled to query or modify
which classes are on or off.
LidarClassFilter_t(mBitMask: uint32_array=uint32_array([0, 0, 0, 0, 0, 0, 0, 0]))
Parameters
______________
mBitMask: uint32_array, len(8)
a bit for each LiDAR class. If the bit is 0, the class is enabled. If the bit is 1, the class is disabled.
"""
def __init__(self, mBitMask: gm.uint32_array=gm.uint32_array(8)): # defaults to allowing all types
super().__init__()
self.mBitMask = mBitMask
[docs]class LidarClassInfo_t(gm.GM_LidarClassInfo_t):
"""This type is used to get/set information about Lidar classes
LidarClassInfo_t(mClass: int=gm.GM_LidarClass_Unclassified, mClassGroup: int=gm.GM_LidarGroup_Noise, mName: str="", mColor: int=0xFF0000FF)
Parameters
________________
mClass: GM_LidarClass_t8, int
Classification
mClassGroup: GM_LidarClassGroup_t16, int
Mask of group(s) the class is in
mName: str
Classification name (set to NULL to reset to default name in GM_SetLidarClassInfo)
mColor: COLORREF, int
Color to use for rendering class points
"""
def __init__(self, mClass: int = gm.GM_LidarClass_Unclassified, mClassGroup: int = gm.GM_LidarGroup_Noise,
mName: str = "", mColor: int = 0xFF0000FF):
super().__init__()
self.mClass = mClass
self.mClassGroup = mClassGroup
self.mName = mName
self.mColor = mColor
# Wrapper for gm exceptions
[docs]class PyGMException(gm.PyGMException):
# Static variable dictionary containing error code / error message pairs.
# this is a manual copy from https://www.bluemarblegeo.com/knowledgebase/global-mapper-sdk-20/html/T_GlobalMapper_Types_GM_Error_t32.htm
# TODO: find way to auto-generate this dictionary, as it will fall out of date otherwise
error_message_pairs = {
gm.GM_Error_None: "The function completed successfully",
gm.GM_Error_InvalidLayer: "The provided layer is not open",
gm.GM_Error_InvalidParam: "A parameter was invalid",
gm.GM_Error_LoadError: "Unable to load layer",
gm.GM_Error_MultipleLayers: "Multiple layers were found in the file being loaded (call GM_LoadLayerList instead)",
gm.GM_Error_CollarSetup: "Unable to automatically crop the collar",
gm.GM_Error_DrawError: "An unknown error occured drawing the layer(s)",
gm.GM_Error_ExportError: "An unknown error occured exporting the layer(s)",
gm.GM_Error_NothingToExport: "No data was available to export",
gm.GM_Error_InvalidFormat: "An invalid export format was specified",
gm.GM_Error_RectifyError: "An error occured rectifying the image",
gm.GM_Error_NotSupported: "The operation is not supported for the layer",
gm.GM_Error_NotRegistered: "No registry key was found to enable this functionality",
gm.GM_Error_NoDataAtLocation: "No data was found at the specified location",
gm.GM_Error_OutOfMemory: "Not enough memory to complete the requested operation",
gm.GM_Error_Projection: "An error occured projecting a coordinate",
gm.GM_Error_NoProjectionSet: "No view/export projection is currently set",
gm.GM_Error_ViewShedCalc: "An error occurred performing the view shed analysis",
gm.GM_Error_OperationCanceled: "The user canceled the operation",
gm.GM_Error_OnlineConnect: "A connection to the online service could not be established",
gm.GM_Error_OnlineUnknownSource: "No online source with the theme name provided could be found",
gm.GM_Error_GenerateContours: "An error occurred generating the contours",
gm.GM_Error_NotRasterLayer: "The layer provided is not a raster or elevation layer",
gm.GM_Error_InvalidPackage: "The provided handle is not a valid package",
gm.GM_Error_InvalidFeatureIndex: "There was no feature at the given index in the layer",
gm.GM_Error_InvalidDrawStyle: "The drawing style passed in is not valid",
gm.GM_Error_InvalidSymbolName: "The symbol name provided does not match any available point symbols",
gm.GM_Error_SymbolAlreadyCreated: "The symbol name specified has already been added",
gm.GM_Error_MissingFile: "The file specified could not be found",
gm.GM_Error_GPSDataNotValid: "The GPS data requested does not currently have a valid value available",
gm.GM_Error_GPSAlreadyTracking: "A GPS device is already being tracked, call GM_GPSStopTracking",
gm.GM_Error_VolumeCalcFailed: "An error occurred calculating the volume",
gm.GM_Error_InvalidHoleIndex: "The area does not have a hole at the index provided",
gm.GM_Error_InvalidMapIndex: "There is no map at the given index in the map catalog",
gm.GM_Error_3DNotOpen: "No 3D view window is currently open",
gm.GM_Error_3DLibraryNotFound: "The ExternalViewerIntf.dll library was not found",
gm.GM_Error_3DLibraryBadInterface: "The ExternalViewerIntf.dll library did not have the proper interface",
gm.GM_Error_3DCreateError: "Unexpected error creating 3D view",
gm.GM_Error_3DSetViewError: "Unexpected error setting 3D view",
gm.GM_Error_NothingFound: "No features were found within the search area",
gm.GM_Error_SearchError: "Unexpected search area",
gm.GM_Error_LowMemory: "Some data was not drawn due to low available memory",
gm.GM_Error_NotElevationLayer: "The layer provided is not an elevation layer",
gm.GM_Error_FileAlreadyInCatalog: "The provided file was already in the map catalog to which it was being added.",
gm.GM_Error_TypeAlreadyExists: "The provided type name was already used by an existing type",
gm.GM_Error_DatumAlreadyExists: "A built-in datum with the given name already exists",
gm.GM_Error_UnknownEllipsoid: "The ellipsoid name provided does not match a known ellipsoid",
gm.GM_Error_GridError: "Error generating grid from 3D vector data",
gm.GM_Error_InvalidShaderName: "The shader name provided was not found",
gm.GM_Error_SymbolNotCustom: "The symbol name provided is not a custom one that can be deleted",
gm.GM_Error_MGRSParseError: "Error parsing MGRS coordinate string",
gm.GM_Error_CreateBufferError: "Error creating a buffer around a feature",
gm.GM_Error_CopyrightedData: "The data attempting to be exported or fetched is copyrighted",
gm.GM_Error_BrushAlreadyCreated: "A fill style with the provided name already exists",
gm.GM_Error_BrushError: "An error was encountered adding the custom fill brush",
gm.GM_Error_EllipsoidAlreadyExists: "An ellipsoid with the given name already exists",
gm.GM_Error_CombineError: "An error occurred combining the areas",
gm.GM_Error_SkippedEmpty: "Empty tile was skipped on export due to passing GM_ExportFlags_SkipEmpty",
gm.GM_Error_NoFeatureElev: "The feature does not have a single elevation value (for lines and areas there may be per-vertex values)",
gm.GM_Error_ArcGISNotLicensed: "Attempted to load an ArcGIS database, but there is no license for ArcGIS",
gm.GM_Error_NotSupportedIn64BitBuild: "Attempted to use functionality that is not supported in a 64-bit build",
gm.GM_Error_UnableToConnectToDB: "Unable to connect to the database using the input connection string",
gm.GM_Error_Unspecified: "Generic unspecified error",
gm.GM_Error_Script: "Error running script",
gm.GM_Error_InvalidLidarPointIdx: "The Lidar point index is out of range",
gm.GM_Error_NothingChanged: "Nothing was changed by the modification",
gm.GM_Error_NotPaletteLayer: "The layer is not a palette-based layer",
gm.GM_Error_NotImageLayer: "The layer does not contain color imagery",
gm.GM_Error_InvalidBand: "The provided band was outside the range of bands for the layer",
gm.GM_Error_NoElevationLayersLoaded: "There are no elevation layers currently loaded",
gm.GM_Error_NoVectorLayersLoaded: "There are no vector layers currently loaded",
gm.GM_Error_COAST: "Unspecified COAST processing error",
gm.GM_Error_NoCOASTModelParmsLoaded: "No model parameter file is loaded",
gm.GM_Error_RegistryOpFailed: "Error while reading or writing the registry",
gm.GM_Error_InvalidCodePage: "The code page provided is not known",
gm.GM_Error_InvalidLidarQuery: "The Lidar query that you passed in is not an active one",
gm.GM_Error_LidarPointInQuery: "The Lidar point was already in the Lidar query",
gm.GM_Error_LidarPointNotInQuery: "The Lidar point was not found in the Lidar query",
gm.GM_Error_NumCodes: "Number of Error Codes Defined",
gm.GM_Error_NotImplemented: "The given function hasn't been implemented yet",
gm.GM_Error_TerraServerConnect: "A connection to the TerraService could not be established"#,
#gm.GM_Error_TerraServerBadTheme: "No TerraServer theme with the theme name provided could be found"
}
def __init__(self, _code: int, _message: str = ""):
super().__init__()
# if no specific message is passed, pull the message from the error message dict
if _message == "":
if _code in PyGMException.error_message_pairs.keys():
_message = PyGMException.error_message_pairs[_code]
else: # if the error message is not found in the dict, attempt fo find and raise the error name itself as the message
for a in dir(gm):
if a.startswith('GM_Error_') and _code == gm.__getattribute__(a):
_message = str(a)
self.code = _code
self.message = _message
def __str__(self):
return str(self.code) + ': ' + self.message
[docs]class LidarStats_t(gm.GM_LidarStats_t):
"""Definition of statistics for a Lidar point cloud
LidarStats_t(mAllPointsStats: LidarReturnInfo_t = LidarReturnInfo_t(),
mAttrStats: gm.GM_LidarAttrInfo_array = gm.GM_LidarAttrInfo_array(1),
mClassStats: gm.GM_LidarReturnInfo_array = gm.GM_LidarReturnInfo_array(1),
mReturnStats: gm.GM_LidarReturnInfo_array = gm.GM_LidarReturnInfo_array(1), mAvgElev: float = 0,
mStdDevElev: float = 0, mAvgIntensity: float = 0, mStdDevIntensity: float = 0)
Parameters
______________
mAllPointsStats: LidarReturnInfo_t
Statistics for everything together
mAttrStats: LidarAttrInfo_array
Statistics by attribute
mClassStats: LidarReturnInfo_array
Statistics by class
mReturnStats: LidarReturnInfo_array
Statistics by return type
mAvgElev: float
Average of elevation values
mStdDevElev: float
Average of intensity values
mAvgIntensity: float
Standard deviation of elevation values
mStdDevIntensity: float
Standard deviation of intensity values
"""
pass
def __init__(self, mAllPointsStats: LidarReturnInfo_t = LidarReturnInfo_t(),
mAttrStats: gm.GM_LidarAttrInfo_array = gm.GM_LidarAttrInfo_array(1),
mClassStats: gm.GM_LidarReturnInfo_array = gm.GM_LidarReturnInfo_array(1),
mReturnStats: gm.GM_LidarReturnInfo_array = gm.GM_LidarReturnInfo_array(1), mAvgElev: float = 0,
mStdDevElev: float = 0, mAvgIntensity: float = 0, mStdDevIntensity: float = 0):
super().__init__()
self.mAllPointsStats = mAllPointsStats
self.mAttrStats = mAttrStats
self.mClassStats = mClassStats
self.mReturnStats = mReturnStats
self.mAvgElev = mAvgElev
self.mStdDevElev = mStdDevElev
self.mAvgIntensity = mAvgIntensity
self.mStdDevIntensity = mStdDevIntensity
[docs]class LidarQueryFilter_t(gm.GM_LidarQueryFilter_t): # TODO: Broken until fix for uint32 arrays is implemented
"""Definition of Lidar query filter.
LidarQueryFilter_t(mSize: int=0, mClassFilter: LidarClassFilter_t=LidarClassFilter_t(), mColorDist: int=0, mColorsToKeep: gm.COLORREF_array=None, mFilterFlags: int=0, mElevMaxValidM: float=0.0, mElevMinValidM: float=0.0, mHeightMaxValidM: float=0.0, mHeightMinValidM: float=0.0, mIntensityMin: int=0, mIntensityMax: int=0, mKeepFirstRetIfNoDelta: bool=False, mNdviMaxValid: float=0.0, mNdviMinValid: float=0.0, mNdviRangeValid: bool=True, mNdwiMaxValid: float=0.0, mNdwiMinValid: float=0.0, mPointSourceIdList: gm.uint32_array=gm.uint32_array(1), mReturnHeightMaxAngle: int=0, mReturnHeightMaxValidM: float=0, mReturnHeightMinValidM: float=0, mReturnHeightMinKeepAllReturnCount: int=0, mReturnMask: int=0, mScanAngleMax: float=0, mScanAngleMin: float=0, mScanAngleValid: bool=True, mDensityMax: float=0, mDensityMin: float=0, mDensityRangeValid: bool=True)
Parameters
_____________
mClassFilter: LidarClassFilter_t
Classification filter (zero'd out means all enabled)
mColorDist: int
Maximum color "distance" to search when using mColorsToKeep
mColorsToKeep: COLORREF_array
Optional list of colors to keep (NULL to not filter by color)
mColorsToKeepCount: int
Size of mColorsToKeep
mFilterFlags: GM_LidarFilterFlags_t32, int
Mask of filter flags to check. Default of 0 doesn't check any flags.
mElevMaxValidM: float
Maximum elevation to keep (meters). Use GM_INVALID_ELEV_VALUE for none.
mElevMinValidM: float
Minimum elevation to keep (meters). Use GM_INVALID_ELEV_VALUE for none.
mHeightMaxValidM: float
Maximum height above ground to keep (meters). Use GM_INVALID_ELEV_VALUE for none.
mHeightMinValidM: float
Minimum height above ground to keep (meters). Use GM_INVALID_ELEV_VALUE for none.
mIntensityMax: int
Maximum intensity to keep
mIntensityMin: int
Minimum intensity to keep
mKeepFirstRetIfNoDelta: bool
Keep first returns if the return height delta is 0 (use for files with missing last returns - Bug 15754)
mNdviMaxValid: float
Maximum valid NDVI value (Range[-1,+1])
mNdviMinValid: float
Minimum valid NDVI value (Range[-1,+1])
mNdviRangeValid: bool
Should we check the NDVI (requires NIR channel)?
mNdwiMaxValid: float
Maximum valid NDWI value (Range[-1,+1])
mNdwiMinValid: float
Minimum valid NDWI value (Range[-1,+1])
mNdwiRangeValid: bool
Should we check the NDWI?
mPointSourceIdList: uint32_array
List of point source IDs to keep (NULL to not filter by point source ID)
mPointSourceIdListCount: int
Size of mPointSourceIdList
mReturnHeightMaxAngle: int
Maximum gradient angle in degrees between first and last point to filter out if return height outside of allowed range.
mReturnHeightMaxValidM: int
Maximum return height delta to keep (meters)
mReturnHeightMinValidM: int
Minimum return height delta to keep (meters)
mReturnHeightMinKeepAllReturnCount: bool
If filtering to a return height range, minimum number of returns to have to keep and ignore the max angle
mReturnMask: int
List of return masks to keep
mScanAngleMax: float
Maximum scan angle (degrees) to keep
mScanAngleMin: float
Minimum scan angle (degrees) to keep
mScanAngleValid: bool
Is the scan angle range filter valid?
mDensityMax: float
Max density to keep in points / m^2
mDensityMin: float
Min density to keep in points / m^2
mDensityRangeValid: bool
Should we filter by density range?
"""
def __init__(self, mClassFilter: LidarClassFilter_t = LidarClassFilter_t(), mColorDist: int = 0,
mColorsToKeep: gm.COLORREF_array = None, mColorsToKeepCount: int=0,
mTransparentColorListSize: int=0, mFilterFlags: int = 0,
mElevMaxValidM: float = 0.0, mElevMinValidM: float = 0.0, mHeightMaxValidM: float = 0.0,
mHeightMinValidM: float = 0.0, mIntensityMin: int = 0, mIntensityMax: int = 0,
mKeepFirstRetIfNoDelta: bool = False, mNdviMaxValid: float = 0.0, mNdviMinValid: float = 0.0,
mNdviRangeValid: bool = True, mNdwiMaxValid: float = 0.0, mNdwiMinValid: float = 0.0,
mNdwiRangeValid: bool = True,
mPointSourceIdList: gm.uint32_array = None, mPointSourceIdListCount: int=1, mReturnHeightMaxAngle: int = 0,
mReturnHeightMaxValidM: float = 0, mReturnHeightMinValidM: float = 0,
mReturnHeightMinKeepAllReturnCount: int = 0, mReturnMask: int = 0, mScanAngleMax: float = 0,
mScanAngleMin: float = 0, mScanAngleValid: bool = True, mDensityMax: float = 0,
mDensityMin: float = 0, mDensityRangeValid: bool = True):
super().__init__()
self.mClassFilter = mClassFilter
self.mColorDist = mColorDist
self.mColorsToKeep = mColorsToKeep
self.mColorsToKeepCount = mColorsToKeepCount
self.mTransparentColorListSize = mTransparentColorListSize
self.mFilterFlags = mFilterFlags
self.mElevMaxValidM = mElevMaxValidM
self.mElevMinValidM = mElevMinValidM
self.mHeightMaxValidM = mHeightMaxValidM
self.mHeightMinValidM = mHeightMinValidM
self.mIntensityMin = mIntensityMin
self.mIntensityMax = mIntensityMax
self.mKeepFirstRetIfNoDelta = mKeepFirstRetIfNoDelta
self.mNdviMaxValid = mNdviMaxValid
self.mNdviMinValid = mNdviMinValid
self.mNdviRangeValid = mNdviRangeValid
self.mNdwiMaxValid = mNdwiMaxValid
self.mNdwiMinValid = mNdwiMinValid
self.mNdwiRangeValid = mNdwiRangeValid
self.mPointSourceIdList = mPointSourceIdList # when setting, use "obj.mPointSourceIdList = array_var.cast()". Without calling .cast(), it may not always work
self.mPointSourceIdListCount = mPointSourceIdListCount
self.mReturnHeightMaxAngle = mReturnHeightMaxAngle
self.mReturnHeightMaxValidM = mReturnHeightMaxValidM
self.mReturnHeightMinValidM = mReturnHeightMinValidM
self.mReturnHeightMinKeepAllReturnCount = mReturnHeightMinKeepAllReturnCount
self.mReturnMask = mReturnMask
self.mScanAngleMax = mScanAngleMax
self.mScanAngleMin = mScanAngleMin
self.mScanAngleValid = mScanAngleValid
self.mDensityMax = mDensityMax
self.mDensityMin = mDensityMin
self.mDensityRangeValid = mDensityRangeValid
[docs]class LidarQueryInfo_t(gm.GM_LidarQueryInfo_t): # TODO: Wait for LayerHandle_array fix
"""Define structure to hold information about a Lidar query
LidarQueryInfo_t(mNumPoints: int = 0, mLayerList: gm.GM_LayerHandle_array = None, mLayerCount: int=0)
Parameters
_____________
mNumPoints: int
Total number of points in query
mLayerList: LayerHandle_array
List of layers that have points in query
mLayerCount: int
Size of mLayerList
"""
def __init__(self, mNumPoints: int = 0, mLayerList: gm.GM_LayerHandle_array = None, mLayerCount: int=0):
super().__init__()
self.mNumPoints = mNumPoints
self.mLayerList = mLayerList # when setting, use "obj.mLayerList = array_var.cast()". Without calling .cast(), it may not always work
self.mLayerCount = mLayerCount
[docs]class ProjDef_t(gm.GM_ProjDef_t):
"""This type is used to fully describe a projection.
ProjDef_t(mDefinition: Projection_t=Projection_t(), mWKT: str="")
Parameters
________________
mDefinition: Projection_t
The projection to use
mWKT: str
the WellKnownText
"""
def __init__(self, mDefinition: Projection_t = Projection_t(), mWKT: str = ""):
super().__init__()
self.mDefinition = mDefinition
self.mWKT = mWKT
[docs]class VerticalDisplayOptions_t(gm.GM_VerticalDisplayOptions_t):
"""Structure with options controlling the display of terrain data
VerticalDisplayOptions_t(mShaderName: str = "", mAmbientLight: float = 1.0, mVertExag: float = 1.0,
mLightAltitude: float = 45.0, mLightAzimuth: float = 180.0, mHillShading: bool = True,
mWaterEnabled: bool = True, mWaterAlpha: int = 128, mWaterColorRed: int = 0, mWaterColorGrn: int = 0,
mWaterColorBlue: int = 255, mWaterLevel: float = 0, mShadeDarkness: int = 0,
mShadeHighlight: int = 0, mSlopeAlgorithm: int = gm.GM_SlopeAlg_Combined4,
mLightBlendingAlgorithm: int = gm.GM_BLENDING_ALG_AVERAGE, mLightNumSources: int = 1)
Parameters
_____________
mShaderName: str
Shader name
mAmbientLight: float
Ambient light level (Range: 0.0 - 1.0)
mVertExag: float
Vertical exaggeration (Range: 0.1 - 10.0)
mLightAltitude: float
Light altitude (Range: 0.0 - 90.0)
mLightAzimuth: float
Light azimuth (Range: 0.0 - 360.0)
mHillShading: bool
Is hill shading enabled?
mWaterEnabled: bool
Is Water display enabled?
mWaterAlpha: int
Alpha translucency of water (Range: 0 - 255)
mWaterColorRed: int
Water color - red component
mWaterColorGrn: int
Water color - green component
mWaterColorBlue: int
Water color - blue component
mWaterLevel: float
Water level (meters)
mShadeDarkness: int
Maximum hill shader shadow darkness (0 - 255, 0 is black, 255 is white)
mShadeHighlight: int
Highlight level (whiteness) to apply for direct sunlight (0 is no additional whiteness, and 255 is completely white)
mSlopeAlgorithm: GM_SlopeAlg_t8, int
Slope calculation algorithm
mLightBlendingAlgorithm: GM_ShaderBlendingAlg_t8, int
Algorithm used to blend intensity when using multiple light sources
mLightNumSources: int
Number of light sources (Range: 1 - 360)
"""
def __init__(self, mShaderName: str = "", mAmbientLight: float = 1.0, mVertExag: float = 1.0,
mLightAltitude: float = 45.0, mLightAzimuth: float = 180.0, mHillShading: bool = True,
mWaterEnabled: bool = True, mWaterAlpha: int = 128, mWaterColorRed: int = 0, mWaterColorGrn: int = 0,
mWaterColorBlue: int = 255, mWaterLevel: float = 0, mShadeDarkness: int = 0,
mShadeHighlight: int = 0, mSlopeAlgorithm: int = gm.GM_SlopeAlg_Combined4,
mLightBlendingAlgorithm: int = gm.GM_BLENDING_ALG_AVERAGE, mLightNumSources: int = 1):
super().__init__()
self.mShaderName = mShaderName
self.mAmbientLight = mAmbientLight
self.mVertExag = mVertExag
self.mLightAltitude = mLightAltitude
self.mLightAzimuth = mLightAzimuth
self.mHillShading = mHillShading
self.mWaterEnabled = mWaterEnabled
self.mWaterAlpha = mWaterAlpha
self.mWaterColorRed = mWaterColorRed
self.mWaterColorGrn = mWaterColorGrn
self.mWaterColorBlue = mWaterColorBlue
self.mWaterLevel = mWaterLevel
self.mShadeDarkness = mShadeDarkness
self.mShadeHighlight = mShadeHighlight
self.mSlopeAlgorithm = mSlopeAlgorithm
self.mLightBlendingAlgorithm = mLightBlendingAlgorithm
self.mLightNumSources = mLightNumSources
#
# Custom re-definition CombineTerrainLayers(aSetup, aReserved)
#
[docs]def CombineTerrainLayers(aSetup):
"""Combines two loaded terrain layers using some operation and
creates a new terrain layer from the combined return. The
returned new layer must be closed with GM_CloseLayer when you
are done working with it.
"""
ok, res = gm.CombineTerrainLayers(aSetup, 0)
if ok != gm.GM_Error_None:
raise Exception(f"FAILED: {PyGMException(ok)}")
return res
[docs]def GenerateElevationGrid(aLayerList, aGridSetup):
r"""Generates an elevation grid and optionally a 3D area TIN layer from loaded
3D vector data. The layer handle(s) returned in <aGridLayer> and
(optionally) <aTinLayer> must be closed with CloseLayer when you are done with them.
"""
ok, dem, tin = gm.GenerateElevationGrid(aLayerList, aGridSetup)
if ok != gm.GM_Error_None:
raise Exception(f"FAILED: {PyGMException(ok)}")
return dem
if __name__ == '__main__':
print("import me")