- globalmapper.SetLayerHeightAttribute(GM_LayerHandle_t32 aLayer, str aAttrName, uint32 aReserved=0) GM_Error_t32
Sets the name of the feature attribute to use for determining the height of a feature point. Provide an empty string to reset this to the default behavior which searches for any number of known height attributes and also checks the display name for height-based types.
- Parameters:
aLayer (GM_LayerHandle_t32) – Layer to modify
aAttrName (str) – Name of attribute to use for height
aReserved (uint32) – Reserved value for future expansion (defaults to zero)
- Returns:
Error Code
- Return type:
GM_Error_t32
Example
The following is an example of SetLayerHeightAttribute.
import os
import globalmapper as gm
import_dir = "Z:/GM-20069/vector_layer_editing_sample_data/"
# Close all layers that may be open
layers_are_open = gm.GetLoadedLayerList()
if layers_are_open:
arr_ptr, arr_size = layers_are_open
initial_layers = gm.GM_LayerHandle_array_frompointer(arr_ptr)
for i in range(arr_size):
gm.CloseLayer(initial_layers[i])
err_LoadLayerList, array_pointer, array_size_param = gm.LoadLayerList(
os.path.join(import_dir, "area.shp"),
gm.GM_LoadFlags_HideAllPrompts,
)
# Get handle for the loaded layers
arr_ptr, arr_size = gm.GetLoadedLayerList()
layers_array = gm.GM_LayerHandle_array_frompointer(arr_ptr)
layers_list = gm.carray_to_list(layers_array, arr_size)
### START SAMPLE
err_SetLayerHeightAttribute = gm.SetLayerHeightAttribute(
layers_list[0], "BuildingHeight", 0
)
### END SAMPLE
assert (
gm.GM_Error_None == err_LoadLayerList
), f"LoadLayerList: Expected {gm.GM_Error_None}, got {err_LoadLayerList}"
assert (
gm.GM_Error_None == err_SetLayerHeightAttribute
), f"SetLayerHeightAttribute: Expected {gm.GM_Error_None}, got {err_SetLayerHeightAttribute}"
assert os.path.isdir(import_dir), f"Import directory doesn't exist: {import_dir}"
assert os.path.exists(
os.path.join(import_dir, "area.shp")
), "Sample data doesn't exist"