Hi Rene-Luc On Mon, Oct 29, 2012 at 6:26 PM, rldhont <[email protected]> wrote: > Hi all, > > As Marco has said for the review of POST WFS GetFeature Request in > QGIS-Server #6535, it would be interesting to use QGS Expression for > OGC:Filter instead of an old code wrote just for the QGIS-Server.
Yes, this would be indeed a good thing to use QgsExpression to evaluate OGC filter expressions, thanks for working on that! > I've started writing Spatial Operator in QgsExpression, You can see the code > here : > https://github.com/rldhont/Quantum-GIS/tree/6535 > > I would like to know how you imagine the dump and the text version of OGC > Spatial Operator (BBOX, Intercets, Crosses, Contains, Disjoint, Within, > etc). > I've started with text like this : > * SpatialOperator('The geometry as WKT') > What do you think about this ? I would have few comments regarding your code: - I don't think that creation of "spatial operator" class is the right way to go. Spatial operators can be handled as ordinary functions - there is already generic support for functions, so let's use that. Also, the functions should be able to handle arbitrary geometry, not necessarily just the one stored in the feature... the geometry stored in the feature could be just another special column, e.g. "$geom" - The geometry is just another type of value, so it is preferable to store it within QVariant, so it can be passed around as a normal value. You will need to enable its use in QVariant with Q_DECLARE_METATYPE(QgsGeometry*) - geometries need a way to construct them - currently you build them explicitly from GML... I would suggest creating functions like GeomFromWKT and GeomFromGML that would take a string parameter and return a QgsGeometry* inside a QVariant. One could also consider adding simple geometry accessor functions like GeomToWKT. So, to answer your original question, the syntax would be e.g.: Intersects($geom, GeomFromWKT('POINT(10 20)')) In future I would like to have support not only for spatial operators, but also general spatial processing (intersection, buffer etc) - that should be rather easy to add once we have some support for geometries. Regards Martin _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
