enricofer / go2streetview

22 stars 22 forks source link

RAM issue #8

Closed klakar closed 9 years ago

klakar commented 9 years ago

QGIS eats up my RAM when I use the plug-in! Something weird happens in the terminal if I start qgis from it as well (se youtube video, link below).

skarmbild fran 2015-04-06 10 24 40

I've tried on layers with latin characters and layers that worked fine previously (6.0).

In the QGIS Log I get: *2015-04-06T10:47:44 1 warning:/usr/lib/python2.7/dist-packages/qgis/utils.py:478: ImportWarning: Not importing directory '/home/klakar/.qgis2/python/plugins/go2streetview/snapshot': missing init.py mod = _builtin_import(name, globals, locals, fromlist, level)

        traceback:  File "<string>", line 1, in <module>
          File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 219, in startPlugin
            plugins[packageName] = package.classFactory(iface)
          File "/home/klakar/.qgis2/python/plugins/go2streetview/__init__.py", line 26, in classFactory
            from go2streetview import go2streetview
          File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 478, in _import
            mod = _builtin_import(name, globals, locals, fromlist, level)
          File "/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py", line 33, in <module>
            from snapshot import snapShot*

And: *2015-04-06T10:50:37 1 warning:/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py:446: DeprecationWarning: QgsMapCanvas.mapRenderer() is deprecated self.dumLayer.setCrs(iface.mapCanvas().mapRenderer().destinationCrs())

        traceback:  File "/home/klakar/.qgis2/python/plugins/go2streetview/go2streetviewDialog.py", line 95, in enterEvent
            self.enter_ev.emit(1)
          File "/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py", line 287, in clickOn
            self.explore()*

Trying to show Street View (clicking in the map) gets me a Python error: Traceback (most recent call last): File "/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py", line 197, in catchJSevents self.writeInfoBuffer(self.transformToCurrentSRS(actualPoint)) File "/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py", line 452, in writeInfoBuffer toInfoLayerProjection = QgsCoordinateTransform(iface.mapCanvas().mapRenderer().destinationCrs(),infoLayer.crs())#DEPRECATED AttributeError: 'NoneType' object has no attribute 'crs'

And the log says: *2015-04-06T10:51:16 1 warning:/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py:333: DeprecationWarning: QgsMapCanvas.mapRenderer() is deprecated crcMappaCorrente = iface.mapCanvas().mapRenderer().destinationCrs() # get current crs

        traceback:  File "/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py", line 360, in canvasPressEvent
            self.pointWgs84 = self.transformToWGS84(self.PressedPoint)

2015-04-06T10:51:17 1 warning:/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py:341: DeprecationWarning: QgsMapCanvas.mapRenderer() is deprecated crcMappaCorrente = iface.mapCanvas().mapRenderer().destinationCrs() # get current crs

        traceback:  File "/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py", line 197, in catchJSevents
            self.writeInfoBuffer(self.transformToCurrentSRS(actualPoint))

2015-04-06T10:51:17 1 warning:/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py:452: DeprecationWarning: QgsMapCanvas.mapRenderer() is deprecated toInfoLayerProjection = QgsCoordinateTransform(iface.mapCanvas().mapRenderer().destinationCrs(),infoLayer.crs())#DEPRECATED

        traceback:  File "/home/klakar/.qgis2/python/plugins/go2streetview/go2streetview.py", line 197, in catchJSevents
            self.writeInfoBuffer(self.transformToCurrentSRS(actualPoint))*

I tried to capture a screen cast and upload to YouTube ( http://youtu.be/IQdlan2JRAA ) and what I can see there might be a problem with SRS...

klakar commented 9 years ago

I've tested some more! When I use data projected in 4326 I have problems. If I save the same data in 3006 (projected SWEREF99TM), it works fine!

enricofer commented 9 years ago

Hi Klas. Thank you very much for the clear debugging informations and the outstanding support. It appears that the features to be send to the javascript page as markers are not correctly filtered by distance buffer. All the features are fetched causing poor performance. This is caused by the default distance buffer value (100). Obviously the distance in a geographic Layer is measured in degrees, not in meters or feet, and the default value intended as Degrees is really a big distance, so big to include all infolayer points that are really too much to become all togheter google street markers. So I wrote a patch to adapt default Distance buffer value to info layer crs map units, and I limit to 200, the number of features that can become markers. In this way we can prevent memory wasting loops and avoid views crowded of markers. https://github.com/enricofer/go2streetview/commit/07f1d358853c6e6efb6f1b28cd84f7b2f69e366e Let me know what you think about it.

For the other non blocking issues emerging from logs I refer to next specific patches. At the moment I have not already understood how substitute the deprecated portion of code to get current crs! I have to ask a question on qgis.developer....