Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

AddComputedProperty
AddFeatureProperty
MgFeatureQueryOptions
RemoveComputedProperty
RemoveFeatureProperty
SetBinaryOperator
SetFilter
SetOrderingFilter
SetSpatialFilter
void MgFeatureQueryOptions::SetFilter | ( | CREFSTRING | filterText | ) |
Sets the filter for this select operation. The filter acts like the where clause in an SQL Select statement. Not calling this method causes all instances of the feature class to be selected. For more details on defining filters, see the Filter and Expression documentation. .NET Syntax
`void SetFilter(string filterText);`
Java Syntax
`void SetFilter(String filterText);`
PHP Syntax
`void SetFilter(string filterText);`
  Parameters:
  | filterText | (String/string) The filter text to be applied.
Returns: Returns nothing. Example (PHP)
     <?php
     $queryOption->SetFilter("featId > 20");
     $featureService->SelectFeatures($featureSrcResourceId, $featClassName, $queryOptions);
     ?>
     sqlplus> select * from featclass where featId > 20;

     <?php
     $featureService->SelectFeatures($featureSrcResourceId, $featClassName, $queryOptions);
     ?>
     sqlplus> select * from featclass;
  Exceptions:
  | MgInvalidArgumentException |
Example (C#)
     using OSGeo.MapGuide;
     private MgFeatureQueryOptions queryOptions;
     private MgFeatureService featureService;
     private String className = "SdfFeatureClass";
     // the SDF file identified by this MgResourceIdentifier exists in the repository
     private MgResourceIdentifier resourceId;
     private MgFeatureReader featureReader;

     resourceId = new MgResourceIdentifier("Library://PlatformApiDocTests/SdfFeatureClass.FeatureSource");
     queryOptions = new MgFeatureQueryOptions();
     queryOptions.AddFeatureProperty("FeatId");
     queryOptions.AddFeatureProperty("anInt32");
     queryOptions.SetFilter("anInt32 + 1 < 2");
     featureReader = featureService.SelectFeatures(resourceId, className, queryOptions);

Comments or suggestions? Send us feedback.