GetPixelColor¶
- globalmapper.GetPixelColor(GM_LayerHandle_t32 aLayer, sint32 aRow, sint32 aCol) GM_Error_t32, GM_Color_t[source]¶
Retrieves the color at a given pixel location from the provided raster layer. If the layer does not contain a valid color value at the provided pixel location (i.e. it is a “no data” or transparent value), GM_Error_NoDataAtLocation will be returned.
- 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)
- Returns:
Error Code
- Return type:
GM_Error_t32
- Returns:
Color of pixel at location
- Return type:
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 GetPixelColor.
err_GetPixelColor, pixel_color = gm.GetPixelColor(
layers_list[0], 261, 878
)