3

Say we have equally distributed x,y mesh vector file. Each coordinate has a map-unit based diameter circle symbology. If we zoom into a region of the map canvas far enough, some centroids exist outside of the map canvas view, thus they will not be displayed.

Is there any means to set a buffer surrounding the map canvas extents equal to the map-circle symbol diameters to prevent border coordinates from being omitted from render?

(yellow highlighted region in image attached image below)

Furthermore, implementing such into a pyqgis plugin?

Zoom Buffer?

(Hopefully) creating such a buffer would ensure coordinates just outside the map-view would still maintain symbol display.

SOLUTION TEST.1:

The following snip was an (unsuccessful) adhoc test. Likely as I am improperly using the QgsRenderContext() Class?

    (init method)
    ....
    self.cellDim=None 
    self.iface.mapCanvas().extentsChanged.connect(self.updateMapBuffer)
    ....


def updateMapBuffer(self):
    try:
        if self.cellDem==None:
            self.aquireGridDim()
        xMinBuffer = self.iface.mapCanvas().extent().xMinimum()-(self.cellDim*10)
        xMaxBuffer = self.iface.mapCanvas().extent().xMaximum()+(self.cellDim*10)
        yMinBuffer = self.iface.mapCanvas().extent().yMinimum()-(self.cellDim*10)
        yMaxBuffer = self.iface.mapCanvas().extent().yMaximum()+(self.cellDim*10)
        newExtent = QgsRectangle(xMinBuffer,yMinBuffer,xMaxBuffer,yMaxBuffer)
        QgsRenderContext().setExtent(newExtent)
    except AttributeError: pass

Probably also important to note - this test gives miniDumps and subsequent QGIS crash 9/10 times when opening. Obviously not the proper means.

  • This sounds like a bug... can you please file a report over at hub.qgis.org/issues ? – ndawson Apr 19 '15 at 22:11
  • @ndawson: Gladly posting on the issue-tracking site now. I feel as though there is some logic in the current function though. It would seem it would greatly preserve memory and processing resources not to have to allocate any symbology that wasn't inherently in the display window correct? – Katalpa Apr 20 '15 at 12:07
  • Added to original post: a adhoc solution which was unsuccessful. Also contributed to QGIS issue-tracking. – Katalpa Apr 20 '15 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.