Questions tagged [qgsrubberband]
A class for drawing transient features on the map in QGIS.
18
questions
5
votes
0
answers
208
views
QGIS geometry editing listener
I would like to know if it's ever possible to make a listener on geometry editing.
What I know so far is a geometryChanged signal that can be used in listening to layer when its feature's geometry is ...
4
votes
1
answer
145
views
Collect Geometry is not working properly when combining list of geometries with PyQGIS
I am developing a Plugin which requires to combine list of geometries. I am using QgsGeometry.collectGeometry utility of PyQGIS for this. Code is attached below.
def canvasReleaseEvent(self, event):
...
3
votes
1
answer
447
views
Drawing virtual dotted line using PyQGIS
I am developing a plugin in QGIS 3.14 to customize editing. I am drawing a line by clicking on map canvas. It is showing points with mouse click and creating a line with right click. I want to trace ...
13
votes
1
answer
785
views
Optimizing intersections and rubber band representations with PyQGIS
I made a tool which runs a QgsMapToolEmitPoint object. Also set its canvasMoveEvent to create a polygon rubberband that takes a geometry from a feature that intersected with current tool's cursor ...
1
vote
1
answer
101
views
Unable to show the polygon I've drawn in PyQGIS
I'm using for my first time QgsMapCanvas() and when I write my script and I then run it, I don't see anything in the canvas.
That's my script:
canva = QgsMapCanvas()
r = QgsRubberBand(canva,True)
...
2
votes
1
answer
246
views
Clearing QgsRubberBand
I have several tools working with QGIS rubberband
before activating my new map tool i want to make sure there is nothing on rubberband
previously up to QGIS 3.2 I was able to clean the rubberband via ...
6
votes
1
answer
301
views
Remove Polyline from QGIS rubberBand
I am trying to clean existing items in the rubberband. The codes work fine on QGIS 3.2 but on 3.10 crashes.
rbs = [ i for i in canvas.scene().items()
if issubclass(type(i), qgis._gui....
3
votes
1
answer
217
views
Adding points to QgsRubberBand polyline instead of giving list of points
canvas = iface.mapCanvas()
polyline = QgsRubberBand(canvas, False) # False = not a polygon
points = [QgsPoint(1,1), QgsPoint(2,2), QgsPoint(3,3), QgsPoint(4,4)]
polyline.setToGeometry(QgsGeometry....
4
votes
1
answer
1k
views
Assigning rubberband as polygon using PyQGIS
I am trying to display a rubberband on my mapCanvas in QGIS but it seems that setToMapCanvas will only accept a QRect object. I am trying to show on the canvas the visible area of a maplayout with a ...
2
votes
0
answers
81
views
When does a Python script in QGIS execute drawing of QgsRubberBand?
I have a script which has an unrelated error after the draw_polygon function. I don't care about the error at the moment because I want to see the current results. For some reason my draw function ...
2
votes
1
answer
638
views
Styling rubberbands using PyQGIS?
I would like to add an on-map drawing function in my stand alone app, so I used QgsRubberBand to make it. I made a tool that emits points and then draw the QgsRubberBand. The problem is I don't find ...
7
votes
1
answer
12k
views
Saving MapCanvas with RubberBand items as image
I want to save map canvas as image (Project > Import/Export > Export Map to Image...) together with rubber band items(colored areas in the image). But QGIS just saves features of shown layers on ...
12
votes
1
answer
966
views
Labelling a rubber band (QgsRubberBand)
It is possible to label QgsRubberBand or QgsVertexMarker with a text annotation (QgsTextAnnotationItem).
See this MWE:
...
r_polyline = QgsRubberBand(iface.mapCanvas(), False)
r_polyline....
5
votes
1
answer
14k
views
Removing RubberBand item in QGIS 2.18.19
I have QGIS 2.18.18 and 2.18.19 in seperate computers. I use the following script to remove RubberBand items. It works in 2.18.18 but doesn't work in 2.18.19
import qgis
# Get RubberBands
rbs = [ i ...
2
votes
1
answer
162
views
QgsRubberBand constructor deprecation warning
I construct a QgsRubberBand in PyQGIS 2.18.17 the following way
canvas = iface.mapCanvas()
my_rubber = QgsRubberBand(canvas, QGis.WKBPolygon)
according to https://qgis.org/api/2.18/...
9
votes
0
answers
527
views
QgsRubberBand Move Event
I have created a QgsRubberBand which copies feature from layer. I need to be able visually move this rubberband on mouse event 'move'. Actually same visualisation like during self.iface....
5
votes
1
answer
448
views
Passing a WKT Polygon with interior rings to a QgsRubberBand's Geometry with PyQGIS
Starting point is that I select a geometry with the following query in QGIS DB Manager:
SELECT 1 AS myid, st_buffer(st_union(wkb_geometry), 5)
FROM ax_strassenverkehr
WHERE unverschluesselt ILIKE '%...
8
votes
1
answer
618
views
Use line style to adjust rubberband in QGIS?
I am digitizing lines and have to keep certain distances to other lines while digitizing.
Normally I would just use a buffer to generate these prohibited areas and snap to these polygons while ...