/pickLayer

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

PickLayer

tests codecov.io release GPLv3 license Code style: black Imports: isort pre-commit

Set layer properties and options straight from map canvas. Activate layer by clicking features on map.

Originally created and maintained by enricofer in https://github.com/enricofer/pickLayer.

Usage from other plugins

It is possible to control SetActiveLayerTool programmatically using public methods defined in Plugin-class.

from qgis.core import QgsPointXY
from qgis.utils import plugins

some_point = QgsPointXY(123, 456)

# Activates layer if features are found near given point
plugins["pickLayer"].set_active_layer_using_closest_feature(point_xy=some_point)

# Activates layer with custom search radius (in map units)
plugins["pickLayer"].set_active_layer_using_closest_feature(point_xy=some_point, search_radius=100)

# Activates layer using subset of layers (expects layer ids)
plugins["pickLayer"].set_active_layer_using_closest_feature(point_xy=some_point, search_layers=["layer-1", "layer-2"])

# Set search layers for set active layer map tool (expects layer ids)
plugins["pickLayer"].set_search_layers_for_set_active_layer_tool_action(search_layers=["layer-1", "layer-2"])

# Reset search layers for set active layer map tool (will use all vector layers in project)
plugins["pickLayer"].set_search_layers_for_set_active_layer_tool_action(search_layers=None)

# Get action for e.g. defining shortcut key programmatically
action = plugins["pickLayer"].get_set_active_layer_tool_action()
# action.do_something()

Development

Refer to development for developing this QGIS3 plugin.

License

This plugin is licenced with GNU General Public License, version 3. See LICENSE for more information.