[mapguide-users] Brain freeze Combining MgFeatureQueryOptions.SetFilter For filtering and MgFeatureQueryOptions.

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Mon Dec 22 03:14:20 EST 2008


AFAIK, both AddFeatureProperty() and SetFilter() writes the internal 
filter, and thus you cannot use both.
Also, there is no logical combination (should it be and, or, xor, nand 
or nor?) for two properties like that.

You can get around it by setting the entire filter string like this:
SetFilter("ObjectType = 'MH' AND GEOMETRY INTERSECTS 
GEOMFROMTEXT('POLYGON((1,1 2,2 1,1))')")

If you have an MgGeometry object, there are tools to read out the WKT 
string for the geometry.

Regards, Kenneth Skovhede, GEOGRAF A/S



Scott Hameister skrev:
> OK Here goes the scenario….
>
> i have a map that already has a selction made in it that contains objects on
> multiple layers… Pipes, CLs, and WaterNodes (points themed BY a field of
> ObjectType MH, Valve etc.)
>
> I need mapguide to return a list of values from the "NODEIDS" field for only
> selected items on the “WaterNodes” Layer Where the field "ObjectType" =
> ‘MH’.
>
> Ive gotten this to work by going crazy iterating through the feature reader
> and a layerFilter….But this is really inefficient and I know it isnt this
> difficult…
> I’m plain out missing something when trying to incorporate
> MgFeatureQueryOptions.SetFilter For filtering and
> MgFeatureQueryOptions.AddFeatureProperty for Limiting the properties
> returned?
> It seems I should be able to use these two functionalities to make this code
> much more streamlined without having to iterate a feature reader to loop
> through each object in the layer and then loop through each field on the
> object….Seems like I should be able to do this with no loops and no feature
> reader going through every object but I keep getting stonewalled I know Im
> just having a Mental block…Any takers willing to push me past this Brain
> Freeze?
>
>   


More information about the mapguide-users mailing list