QWAT icon indicating copy to clipboard operation
QWAT copied to clipboard

Add a user action on installation to start digitizing a polygon

Open haubourg opened this issue 7 years ago • 5 comments

following Tudor suggestions here #202 a user action to begin adding a geometry polygon part to an installation would be a nice shortcut to help user understand the workflow.

Currently adding a new installation from a polygon layer will fail because of a not null constraint on point geometry (which is good) , so it relies on a good user training.

Not sure it is so easy to do from an action:

  • launch the action
  • select the current installation in the polygon layer
  • change active layer focus to the polygon layer
  • activate "add part" tool

The active layer switch can probably be surprising

haubourg avatar Jul 05 '17 17:07 haubourg

I think there are some ongoing discussion about the topic on QGIS @m-kuhn any feedback about being able to digitise other geometry columns on QGIS? (a polygon geometry of a point layer)

3nids avatar Dec 09 '17 12:12 3nids

For our use, I adapted the action Matthias did for the structure layer in QGEP:

lyr = QgsMapLayerRegistry.instance().mapLayer('vw_element_installation20170811111622733')

feature = lyr .getFeatures( QgsFeatureRequest().setFilterExpression( 'id = \'{}\''.format( '[% "id" %]' ) ) ).next()
lyr.startEditing()
lyr.setSelectedFeatures([feature.id()])
qgis.utils.iface.setActiveLayer(lyr)
qgis.utils.iface.actionAddPart().trigger()

You need to add the vw_element_installation as a polygon layer but it works well.

varrieta avatar Feb 05 '18 10:02 varrieta

Only problem, you can't snap to the construction point to digitize the polygon #246

varrieta avatar Feb 05 '18 10:02 varrieta

Only problem, you can't snap to the construction point to digitize the polygon #246

Is this still the case?

For our use, I adapted the action Matthias did for the structure layer in QGEP:

lyr = QgsMapLayerRegistry.instance().mapLayer('vw_element_installation20170811111622733')

feature = lyr .getFeatures( QgsFeatureRequest().setFilterExpression( 'id = \'{}\''.format( '[% "id" %]' ) ) ).next()
lyr.startEditing()
lyr.setSelectedFeatures([feature.id()])
qgis.utils.iface.setActiveLayer(lyr)
qgis.utils.iface.actionAddPart().trigger()

You need to add the vw_element_installation as a polygon layer but it works well.

Should be updated to pyqgis 3

ponceta avatar Feb 26 '19 16:02 ponceta

@haubourg Duplicate of https://github.com/qwat/QWAT/issues/204 I think

ponceta avatar Jul 02 '19 15:07 ponceta