Dear list,
It's not exactly clear how secondary geometry columns are to be used from
QgsExpressions or Python code.
Just to be clear, by secondary geometry columns, I mean geometries stored
in other columns that the one that is used to display the features on the
map, typically a "center_point" field storing a Point on a Polygon layer.
When accessing them both in expression or Python, it seems it returns a
string with the ewkt representation (at least for postgis layers). This is
not really nice, as the only way to use it with functions such as make_line
is to strip the SRID from the text to get proper wkt, then to make the
create the feature using from_wkt.
This means instead of the nice and clear :
make_line( closest_point( $geometry, "center_point"), "center_point" )
You need :
make_line( closest_point( $geometry, geom_from_wkt( substr( "center_point",
strpos("center_point", ';') + 1) )), geom_from_wkt( substr( "center_point",
strpos("center_point", ';') + 1) ) )
It's also probably quite inefficient, which is an issue when used for
geometry generators.
Is there a limitation preventing to return QgsGeometries directly ? If not,
would it make sense to change QGIS to do so ? Does anyone have an efficient
workaround in the mean time ?
Thanks :-)
Olivier
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer