[QGIS-Developer] Point Clouds and Elevation slicing/filtering

Andreas Neumann andreas at qgis.org
Wed Dec 9 01:47:39 PST 2020


Thank you Nyall.

With your Python code I got the slider - and it works fine - Thank you!

Regarding the discussion around such a slider: next to slicing different
attributes there is also the question if this should be per layer or global
per project for all layers. Plenty of options and use cases here.

Thanks,
Andreas

On Wed, 9 Dec 2020 at 02:42, Nyall Dawson <nyall.dawson at gmail.com> wrote:

> On Wed, 9 Dec 2020 at 00:10, Andreas Neumann <andreas at qgis.org> wrote:
> >
> > Hi,
> >
> > I wonder how I can achieve the elevation slicing / filtering shown here:
> >
> > https://twitter.com/nyalldawson/status/1331092360818614274?s=20
> >
> > Is there Python code involved to do that? No GUI yet?
>
> No GUI yet (see below). Try the following Python code:
>
>
> w=QgsFloatingWidget(iface.mainWindow())
> l=QVBoxLayout()
> slider = QgsRangeSlider(Qt.Vertical)
> slider.setFlippedDirection(True)
>
> range = QgsElevationUtils.calculateZRangeForProject(QgsProject.instance())
> slider.setRangeLimits(range.lower() * 100,range.upper()*100)
> l.addWidget(slider)
> w.setSizePolicy( QSizePolicy.Fixed, QSizePolicy.Preferred)
> w.setFixedSize(500,200)
> w.setLayout(l)
> w.setAnchorWidget(iface.mapCanvas())
> w.setAnchorPoint(QgsFloatingWidget.TopLeft)
> w.setAnchorWidgetPoint(QgsFloatingWidget.TopLeft)
> w.show()
> w.raise_()
>
> def range_changed(lower,upper):
>     iface.mapCanvas().setZRange(QgsDoubleRange(lower/100,upper/100))
>
> slider.rangeChanged.connect(range_changed)
>
> > That slicing looks incredibly useful to me.
>
> I've been struggling with how to expose this to users, which is why
> it's all just python code for now. I'm also starting to think I need
> to make the api a bit more generic and potentially allow for slicing
> based on any kind of attribute, not just elevation/z based slicing.
> There's potentially many different variables which users may want to
> interactively slice using and I'm leaning toward reworking the api to
> allow for more flexibility, including allowing multiple different
> range definition for layers. E.g. you could have a vector point layer
> with both a "z" attribute and a "concentration" attribute, and we
> could expose sliders for filtering on both the z AND concentration
> ranges...
>
> Something to think more about :)
>
> Nyall
>
>
> >
> > I know I could change the min/max values and clip them in the symbology
> settings, but that isn't very interactive.
> >
> > Thanks,
> > Andreas
> > htIs there Python
> > --
> > Andreas Neumann
> > QGIS.ORG board member (treasurer)
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>


-- 

--
Andreas Neumann
QGIS.ORG board member (treasurer)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20201209/e4e31925/attachment.html>


More information about the QGIS-Developer mailing list