GetPixelBandValue¶
- globalmapper.GetPixelBandValue(GM_LayerHandle_t32 aLayer, sint32 aRow, sint32 aCol, sint32 aBand) GM_Error_t32, sint32 [source]¶
Retrieves the band value at a given pixel location in the provided layer. If the layer does not contain a valid sample at the provided pixel location (i.e. it is a “no data” or transparent value), GM_Error_NoDataAtLocation will be returned. Use this to access the raw values from high-bit depth and multi-band imagery layers.
- Parameters:
aLayer (GM_LayerHandle_t32) – Layer to get color from
aRow (sint32) – Y coord of pixel (0 is topmost)
aCol (sint32) – X coord of pixel (0 is leftmost)
aBand (sint32) – Band to get value for (0-based, so first band is 1)
- Returns:
Error Code
- Return type:
GM_Error_t32
- Returns:
Color of pixel at location
- Return type:
sint32
Note
To get pixel row/col data, you can select a point feature in Global Mapper:
Right-click -> Attribute/Style Functions -> Add Pixel Coordinates to Selected Point(s)
Example¶
The following is an example of GetPixelBandValue.
err_GetPixelBandValue, pixel_colorR = gm.GetPixelBandValue(
layers_list[0], 277, 878, 0
)