ccrook / qgis-vectorfieldrenderer-plugin Goto Github PK
View Code? Open in Web Editor NEWQGIS python plugin for rendering vector field data as arrows, optionally with error ellipse
QGIS python plugin for rendering vector field data as arrows, optionally with error ellipse
QGIS3 implementation under development. Currently failing with
" ASSERT failure in QgsFeatureRenderer::renderFeature: "renderFeature called in a different thread - use a cloned renderer instead"
Looking at QgsFeatureRenderer code it appears this is caused by a two calls to QgsFeatureRenderer::startRender from different threads, or from a call to renderFeature without a corresponding call to startRender.
https://qgis.org/api/classQgsFeatureRenderer.html#af01839c584bf5fc58e259adaa318c0bd
Python plugin code for startRender is at:
The plugin does not override renderFeature, but does override startRender, stopRender, and symbolsForFeature.
Sample project attached below. Steps to reproduce are select test.csv layer, open properties/symbology
select VectorField renderer, set X attribute to dx and Y attribute to dy, then Ok.
Running gdb qgis.bin gives following abbreviated stack trace:
Fatal: ASSERT failure in QgsFeatureRenderer::renderFeature: "renderFeature called in a different thread - use a
cloned renderer instead", file ../../src/core/symbology/qgsrenderer.cpp, line 121
QGIS died on signal -1Warning: QPainter::end: Painter not active, aborted
Stacktrace (piped through c++filt):
/usr/bin/qgis.bin(+0xca4d)[0x555555560a4d]
/usr/bin/qgis.bin(+0xcf5a)[0x555555560f5a]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x914c6)[0x7ffff4ae64c6]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QMessageLogger::warning(char const*, ...) const+0xac)[0x7ffff4ae728c]
/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5(QPainter::end()+0x35e)[0x7ffff52635ee]
/usr/lib/libqgis_core.so.2.99.0(QgsSymbolLayerUtils::symbolPreviewPixmap(QgsSymbol*, QSize, int, QgsRenderConte
xt*)+0x167)[0x7ffff5f18955]
/usr/lib/libqgis_core.so.2.99.0(QgsSymbolLegendNode::minimumIconSize(QgsRenderContext*) const+0xd3)[0x7ffff5f92
f13]
/usr/lib/libqgis_core.so.2.99.0(QgsLayerTreeModel::invalidateLegendMapBasedData()+0x1b3)[0x7ffff5f87879]
/usr/lib/libqgis_core.so.2.99.0(+0x49044b)[0x7ffff5f9044b]
/usr/lib/libqgis_core.so.2.99.0(+0x48f747)[0x7ffff5f8f747]
/usr/lib/libqgis_core.so.2.99.0(+0x48df9f)[0x7ffff5f8df9f]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QMetaObject::activate(QObject*, int, int, void**)+0x66f)[0x7ffff4d09b
af]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QTimer::timerEvent(QTimerEvent*)+0x28)[0x7ffff4d165c8]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QObject::event(QEvent*)+0xa3)[0x7ffff4d0abb3]
/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(QApplicationPrivate::notify_helper(QObject*, QEvent*)+0x8c)[0x7fff
f55ce05c]
/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(QApplication::notify(QObject*, QEvent*)+0x256)[0x7ffff55d3516]
/usr/lib/libqgis_core.so.2.99.0(QgsApplication::notify(QObject*, QEvent*)+0x9b)[0x7ffff611b319]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QCoreApplication::notifyInternal(QObject*, QEvent*)+0xdb)[0x7ffff4cdb
38b]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QTimerInfoList::activateTimers()+0x52d)[0x7ffff4d305ed]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x2dbaf1)[0x7ffff4d30af1]
../../src/core/qgsmessagelog.cpp: 27: (logMessage) [695ms] 2018-02-11T23:26:03 Qt[1] QPainter::end: Painter not
active, aborted
Warning: QPainter::end: Painter not active, aborted
Stacktrace (piped through c++filt):
/usr/bin/qgis.bin(+0xca4d)[0x555555560a4d]
/usr/bin/qgis.bin(+0xcf5a)[0x555555560f5a]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x914c6)[0x7ffff4ae64c6]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QMessageLogger::warning(char const*, ...) const+0xac)[0x7ffff4ae728c]
/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5(QPainter::end()+0x35e)[0x7ffff52635ee]
/usr/lib/libqgis_core.so.2.99.0(QgsSymbolLayerUtils::symbolPreviewPixmap(QgsSymbol*, QSize, int, QgsRenderConte
xt*)+0x167)[0x7ffff5f18955]
/usr/lib/libqgis_core.so.2.99.0(QgsSymbolLegendNode::minimumIconSize(QgsRenderContext*) const+0xd3)[0x7ffff5f92
f13]
/usr/lib/libqgis_core.so.2.99.0(QgsLayerTreeModel::invalidateLegendMapBasedData()+0x1b3)[0x7ffff5f87879]
/usr/lib/libqgis_core.so.2.99.0(+0x49044b)[0x7ffff5f9044b]
/usr/lib/libqgis_core.so.2.99.0(+0x48f747)[0x7ffff5f8f747]
/usr/lib/libqgis_core.so.2.99.0(+0x48df9f)[0x7ffff5f8df9f]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QMetaObject::activate(QObject*, int, int, void**)+0x66f)[0x7ffff4d09b
af]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QTimer::timerEvent(QTimerEvent*)+0x28)[0x7ffff4d165c8]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QObject::event(QEvent*)+0xa3)[0x7ffff4d0abb3]
/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(QApplicationPrivate::notify_helper(QObject*, QEvent*)+0x8c)[0x7fff
f55ce05c]
/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(QApplication::notify(QObject*, QEvent*)+0x256)[0x7ffff55d3516]
/usr/lib/libqgis_core.so.2.99.0(QgsApplication::notify(QObject*, QEvent*)+0x9b)[0x7ffff611b319]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QCoreApplication::notifyInternal(QObject*, QEvent*)+0xdb)[0x7ffff4cdb
38b]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(QTimerInfoList::activateTimers()+0x52d)[0x7ffff4d305ed]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x2dbaf1)[0x7ffff4d30af1]
Using ubuntu 16.04 nightly-ubuntugis .. details from About are
QGIS version | 2.99.0-Master | QGIS code revision | 779fe1a |
---|---|---|---|
Compiled against Qt | 5.5.1 | Running against Qt | 5.5.1 |
Compiled against GDAL/OGR | 2.2.2 | Running against GDAL/OGR | 2.2.2 |
Compiled against GEOS | 3.5.1-CAPI-1.9.1 | Running against GEOS | 3.5.1-CAPI-1.9.1 r4246 |
PostgreSQL Client Version | 9.5.2 | SpatiaLite Version | 4.3.0a |
QWT Version | 6.1.2 | PROJ.4 Version | 492 |
QScintilla2 Version | 2.9.1 | This copy of QGIS writes debugging output. |
I am trying to use this plugin with QGIS 2.0 and I get this message "this renderer doesn't implement a graphical interface" when I select vector field from the style dialog box.
You'll get a lot of crashes, because there's other parts of your
renderer which need upgrading to QGIS 3.0 API. And unfortunately when
a renderer crashes in Python code, it segfaults after dumping the
python error to the console. You'll need to run in a console to see
the Python errors which are thrown and upgrade the corresponding API
calls.
Also - I noticed you access a layer from the project within your
startRender method -- is is very unsafe for a renderer to do, since it
is running in a background thread and should not be accessing layers
at all. Just another thing to try to refactor out as you upgrade your
plugin for 3.0!
I am trying to use the plugin on a table linked to a spatial database. The database uses a geographical coordinate system- (lats and longs).
I am trying to reproduce the actual length using a polar coordinate system with my lengths field in metres.
if I use the symbol units as mm the length changes dependent on scale, while if I use the map unit the measurements circle the globe. I can use the scale but it is fiddly.
would it be possible to have the symbol units as true metre length, or to specify the symbol units as the project units?
I have just figured out that if I change the project coord system to metre based, then everything works fine.
thanks
Error occurs on platforms which do not allow setting the renderer via the properties dialog (this rendererer does not implement a graphical user interface #2) Although the fix to this issue allows the renderer to be assigned to a layer, it is unfortunately virtually useless, as the same underlying issue means that the buttons for setting the layer properties etc all generate the an error along the lines of
AttributeError: 'QgsFeatureRendererV2' object has no attribute ...
This is because the python bindings for the renderer are lost when it is passed via a C++ base class object (QgsFeatureRendererV2).
Hi,
thanks for the the plugin!
I was wondering if it'd be hard to support raster files as I'm interested in a QGIS feature similar to quiver plots in matplotlib. I'm trying to visualize velocity and displacement fields that are raster not vector. As the rasters are generally large, conversion to a shapefile (vectorize) is undesirable.
It seems that the rendering refactoring for version 2.4 has disabled some functions - specifically:
When I switch from renderer created by plugin to one of the standard renderers QGIS crashes. See also http://hub.qgis.org/issues/13973
Hi,
after compilation of Qgis 1.9 master branch sources on my desk, I installed the vector field renderer plugin.
I add a vector point layer in a new project and go in the properties of that layer. In the style tab, in the drop down combobox, I choose vector field style in place of the unique symbol. Then after the refresh of the dialogue box, all the widgets vanish and I only get : this style does not give any graphic interface (which is a translate of the french message).
What did I miss ?
Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.