-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration of SFCGAL Library #307
Comments
+1 Questions:
Slightly out-of-scope remark: for the purpose of conda-forge based QGIS builds, it could be worth that SFCGAL to be available in conda-forge. As far as I can see from https://github.com/search?q=org%3Aconda-forge%20sfcgal&type=code , it is not currently |
We need to implement a new daughter class of QgsAbstractGeometry to link a geometry with an instantiation of the SFCGAL engine. This allows us to optimize processings that can be chained together, by reducing the number of times an SFCGAL engine has to be recreated (and therefore to recreate SFCGAL geometry from QGIS data). |
ok, so not directly a user-facing subtype of QgsAbstractGeometry but more an implementation detail? |
SFCGAL development is not in a healthy state. Consider contributing development and/or monetary resources to correct that before depending on it. |
This comment is a bit mysterious to me. Can you give more details? |
Minor comments:
|
Great news! I also don't see why we need a QgsSfcgalGeometry. Would that mean that we have then a QgsSfcgalPoint, QgsSfcgalPolygon... ? At the moment, there is no direct link between geos and QgsAbstractGeometry and this is QgsGeos implementing QgsGeometryEngine which make that link. Why not keep it the same way but with a Sfcgal engine. |
QGIS has so far no direct dependencies with boost, meaning that you can build QGIS without it. Would it become a required dependency ? Would QGIS have to use boost to correctly use CGAL API? If so, do you know which part? |
It breaks with pretty much every new CGAL release, which then takes time to get patched. See for example the recent issue about CGAL 6 support:
Fortunately Sébastien Loriot came along and contributed the CGAL 6 support like he has done several times before, without his contributions SFCGAL would have remained broken with newer CGAL. I've disabled SFCGAL support in PostGIS so many times now, that I won't consider enabling the dependency in GDAL, the same goes for QGIS. |
in #postgis, I have done low-level (GDB) debugging of SFCGAL .. the libraries are filled with technical debt. The SF part is only a wrapper over the old, very large, very messy CGAL project. CGAL has all the problems of a multi-generational academic project.. no one understands all of it.. there is no unified architecture, only layers of industrious graduate students, separated by the years of implementation. Proceed with caution IMHO |
Indeed 😁!
For our current test we add a
The engine functions often return |
I also second @m-kuhn suggestion. Dealing with CMake Config files is the way to go for clean CMake integration. |
QGIS does not use boost, and we don't have to use it in QGIS. For packager, yes we have to install some boost-libs for SFCGAL. However, it's already the case when your system install GDAL with libkml (at least on the most used QGIS version, and maybe other sub-dependency. |
I have planned, but not yet taken the time to, contribute to conda for the addition of SFCGAL (and its Python binding). |
How would |
I fail to see your point based on this example. I would even argue that it proves that
To sum it up:
I think these are the signs of an healthy project. Besides, the proposed integration is similar to the one already done in |
This sounds good, but I'm not at all convinced by the need for a new geometry subclass. Can you please detail EXACTLY what that would look like, including the relevant bits from it's header ? |
Sorry, missed this reply: "engine functions often return QgsAbstractGeometry as required by the QgsGeometryEngine. So if we want to call 2 successives SFCGAL operations (like QsgSfcgalEngine(geomA).triangulate().difference(geomB)) we will have to go forth and back from Qgis to SFCGAL for each call to the engine (ie. copying data and converting them to one format to another). The QgsSfcgalGeometry solves this issue by encapsulating the dedicated SFCGAL engine, the geometry in SFCGAL and Qgis formats." Subclassing QgsAbstractGeometry is the wrong approach to handle this. Rather you should develop some method for attaching extra objects to a geometry, allowing for sfcgal representations (and GEOS representations + prepared GEOS objects) to be attached. This should probably be done at the QgsGeometry level instead of QgsAbstractGeometry, so that we get the benefit of the implicit sharing of these representations too. But before proceeding with this approach, please detail the actual changes to be made to the classes 👍 |
Actually, thinking a bit more about this: I'd suggest NOT doing this, and just creating the new QgsSfcgalEngine without the QgsGeometryEngine base class. That base class was originally introduced with the thinking that maybe at some stage we'd have an alternative to GEOS, but that use case has never eventuated and now the QgsGeometryEngine interface is just getting in the way. You'll see many methods in QgsGeos which aren't in the QgsGeometryEngine interface, and accordingly aren't accessible to Python (even though they'd be useful!). In short: I think trying to keep a common interface between GEOS/SFCGAL is just a pointless exercise, and we're better off with specific classes exposing API which makes sense to each individual backend. So I'd suggest rewording this as something like |
Thanks @nyalldawson for your reply! If you think, we do not need to extend the |
good point! The suggestion made by @nyalldawson changes a lot of things, we will rework it asap. |
+1 for the adjustments suggested by @nyalldawson |
The activity and contributors graphs don't inspire confidence in the health of the project: The fact that the SFCGAL core developers repeatedly aren't the ones that contribute the changes to make it compatible with newer CGAL is very concerning. The project has a bus factor of 1 for its ability to support newer CGAL releases. When Sébastien Loriot stops contributing those changes SFCGAL will remain broken for quite some time leading to its removal from Debian and Ubuntu releases which will require conditional logic in the QGIS packaging to enable support on the release where it's still available. It seems that Oslandia needs to be paid to do the work to support newer CGAL releases, which is something QGIS could fund when it choses to depend on SFCGAL. SFGAL needs more developers contributing changes to improve its health and long term viability, projects that choose to depend on SFGAL like PostGIS and QGIS are obvious sources for these additional contributions. |
QGIS Enhancement: Integration of SFCGAL Library
Date 2024/10/17
Author Loïc Bartoletti (@lbartoletti), Benoit De Mezzo (@benoitdm-oslandia), Jean Felder (@ptitjano)
Contact loic dot bartoletti at oslandia dot com, benoit dot de dot mezzo at oslandia dot com, jean dot felder at oslandia dot com
Version QGIS 3.XX
Summary
This enhancement proposal outlines the integration of SFCGAL (Simple Features for Computational Geometry Algorithms Library) into QGIS. SFCGAL is an open-source library that provides advanced 3D geometry capabilities and is already well-integrated with PostGIS and GDAL. This integration aims to enhance QGIS's 3D geometry (and 2D advanced) processing capabilities, particularly for applications in geology and urban planning.
Background and Motivation
SFCGAL offers several compelling advantages for integration into QGIS:
Proposed Solution
The integration of SFCGAL into QGIS will involve the following key components:
QgsSfcgalEngine
class that inherits fromQgsGeometryEngine
.QgsSfcgalGeometry
class that inherits fromQgsAbstractGeometry
.ENABLE_SFCGAL
to allow conditional compilation of SFCGAL support.Deliverables
QgsSfcgalEngine
andQgsSfcgalGeometry
classes.Affected Files
src/core/geometry/qgsgeometryengine.h
src/core/geometry/qgsabstractgeometry.h
src/core/geometry/qgssfcgalengine.h
(new file)src/core/geometry/qgssfcgalengine.cpp
(new file)src/core/geometry/qgssfcgalgeometry.h
(new file)src/core/geometry/qgssfcgalgeometry.cpp
(new file)CMakeLists.txt
cmake/findSCFGAL.txt
src/analysis
directory for new processing algorithmssrc/core/expression
directory for new expressionsRisks
Performance Implications
The performance impact is expected to be minimal for users who do not enable SFCGAL functionality. For those who do use SFCGAL features, there may be a slight increase in memory usage and processing time for complex 3D operations. However, this is offset by the significant capabilities gained in 3D geometry processing.
Further Considerations/Improvements
Backwards Compatibility
The proposed implementation should not affect existing QGIS functionality. All SFCGAL-related features will be optional and can be disabled at compile-time or runtime. Existing GEOS-based geometry operations will remain unchanged.
Issue Tracking ID(s)
(To be assigned upon acceptance of this proposal)
Funded by: CEA/DAM @renardf, CP4SC/France Relance/European Union
The text was updated successfully, but these errors were encountered: