qwat / QWAT

TEKSI Water module (project QWAT) - QGIS project
https://www.teksi.ch
GNU General Public License v2.0
58 stars 31 forks source link

Add a user action on installation to start digitizing a polygon #204

Open haubourg opened 7 years ago

haubourg commented 7 years ago

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:

The active layer switch can probably be surprising

3nids commented 6 years ago

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)

varrieta commented 6 years ago

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 commented 6 years ago

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

ponceta commented 5 years ago

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 commented 5 years ago

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