[Qgis-developer] Spatial Operator in QgsExpression

rldhont rldhont at gmail.com
Wed Oct 31 07:08:28 PDT 2012


Hi Martin,

Thanks for your review, answer and advice.
I'll hope to be my best to have somethings quickly (in my spare time)

René-Luc

Le 30/10/2012 10:06, Martin Dobias a écrit :
> Hi Rene-Luc
>
> On Mon, Oct 29, 2012 at 6:26 PM, rldhont <rldhont at gmail.com> 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



More information about the Qgis-developer mailing list