QueryParameters Class

  • QueryParameters
  • class Esri::ArcGISRuntime::QueryParameters

    Parameters to perform a query on a dataset. More...

    Header: #include <QueryParameters.h>
    Since: Esri::ArcGISRuntime 100.0

    Public Functions

    QueryParameters(const Esri::ArcGISRuntime::QueryParameters &other)
    QueryParameters(Esri::ArcGISRuntime::QueryParameters &&other)
    void clear()
    Esri::ArcGISRuntime::Geometry geometry() const
    bool isEmpty() const
    bool isReturnGeometry() const
    double maxAllowableOffset() const
    int maxFeatures() const
    QList<qint64> objectIds() const
    QList<Esri::ArcGISRuntime::OrderBy> orderByFields() const
    Esri::ArcGISRuntime::SpatialReference outSpatialReference() const
    int resultOffset() const
    void setGeometry(const Esri::ArcGISRuntime::Geometry &geometry)
    void setMaxAllowableOffset(double maxAllowableOffset)
    void setMaxFeatures(int maxFeatures)
    void setObjectIds(const QList<qint64> &objectIds)
    void setOrderByFields(const QList<Esri::ArcGISRuntime::OrderBy> &orderByFields)
    void setOutSpatialReference(const Esri::ArcGISRuntime::SpatialReference &spatialReference)
    void setResultOffset(int resultOffset)
    void setReturnGeometry(bool returnGeometry)
    void setSpatialRelationship(Esri::ArcGISRuntime::SpatialRelationship relationship)
    void setTimeExtent(const Esri::ArcGISRuntime::TimeExtent &timeExtent)
    void setWhereClause(const QString &whereClause)
    Esri::ArcGISRuntime::SpatialRelationship spatialRelationship() const
    Esri::ArcGISRuntime::TimeExtent timeExtent() const
    QString whereClause() const
    Esri::ArcGISRuntime::QueryParameters &operator=(const Esri::ArcGISRuntime::QueryParameters &other)
    Esri::ArcGISRuntime::QueryParameters &operator=(Esri::ArcGISRuntime::QueryParameters &&other)

    Detailed Description

    These parameters provide attribute, spatial, and temporal criteria that you can use to filter features. You can define attribute criteria using a standard SQL expression based on the available attribute fields, spatial criteria using a geometry and a spatial relationship (such as within, contains, intersect), or temporal filters using a single date/time, or a range. You can also control how the results are sorted and whether to return geometry.

    In addition to querying features in a table, you can also use these parameters to count specific features, calculate the extent of features, select features in layers, and populate service-based tables. If the query method produces a set of features, they are returned in a FeatureQueryResult.

    Different query parameter objects are available to query data sources such as related features (RelatedQueryParameters), statistical information (StatisticsQueryParameters), and portals (PortalQueryParameters). Specialized query parameters also exist for working with utility networks and routing.

    See also FeatureTable::queryFeatures(QueryParameters), FeatureTable::queryFeatureCount(QueryParameters), FeatureTable::queryExtent(QueryParameters), FeatureLayer::selectFeatures(QueryParameters, SelectionMode), and ServiceFeatureTable::populateFromService(QueryParameters, bool, QListModel).

    Member Function Documentation


    Default Constructor. Create an empty QueryParameters instance.

    QueryParameters::QueryParameters(const Esri::ArcGISRuntime::QueryParameters &other)

    Copy constructor from other QueryParameters.

    QueryParameters::QueryParameters(Esri::ArcGISRuntime::QueryParameters &&other)

    Move constructor from other QueryParameters.



    void QueryParameters::clear()

    Clears this QueryParameters and sets back to empty.

    Esri::ArcGISRuntime::Geometry QueryParameters::geometry() const

    Returns the geometry to use as a filter.

    See also setGeometry().

    bool QueryParameters::isEmpty() const

    Returns whether this QueryParameters is empty.

    bool QueryParameters::isReturnGeometry() const

    Returns true if geometry values are returned in the results, otherwise false.

    This is needed when you want to display the features on a map or a scene. When querying non-spatial data, results do not include geometry.

    double QueryParameters::maxAllowableOffset() const

    Returns the maximum allowable offset to be used for the query.

    The default value is 0.0.

    See also setMaxAllowableOffset() and maxAllowableOffset.

    int QueryParameters::maxFeatures() const

    Returns the maximum number of features the query should return.

    For consistent ordering of results when using pagination, provide a value for orderByFields. Note that if you provide a maximum features value to support paging of results, you must also set a resultOffset value. Otherwise, the result may contain local features in place of server features if they satisfy the query. To ensure strict paging of server features, specify both maximum features and resultOffset.

    The default value is 0.

    See also setMaxFeatures().

    QList<qint64> QueryParameters::objectIds() const

    Returns the list of object IDs of the features to be queried.

    See also setObjectIds.

    QList<Esri::ArcGISRuntime::OrderBy> QueryParameters::orderByFields() const

    Returns the fields by which query results will be ordered.

    Results can be sorted by one or more fields. Each OrderBy instance includes a field name and whether to sort by that field in ascending or descending order. If a service-based table is being queried it must support advanced queries.

    See also setOrderByFields.

    Esri::ArcGISRuntime::SpatialReference QueryParameters::outSpatialReference() const

    Returns the spatial reference of the feature results' geometry.

    If not specified, geometries are returned in the spatial reference of the service.

    See also setOutSpatialReference().

    [since Esri::ArcGISRuntime 100.3] int QueryParameters::resultOffset() const

    Returns the starting offset of results to fetch. This is useful for paging through results.

    For consistent ordering of results when using pagination, you should also provide a value for the orderByFields. Note that if you provide a result offset to support paging of results, you must also set a maxFeatures value. Otherwise, the result offset is ignored.

    The default value is 0.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    See also setResultOffset().

    void QueryParameters::setGeometry(const Esri::ArcGISRuntime::Geometry &geometry)

    Sets the geometry to use as a filter.

    See also geometry().

    void QueryParameters::setMaxAllowableOffset(double maxAllowableOffset)

    Sets the maximum allowable offset, maxAllowableOffset, to be used for the query.

    The maximum allowable offset is used for generalizing geometries returned by the query operation. It is expressed in the units of outSpatialReference.

    The default value is 0.0.

    See also maxAllowableOffset().

    void QueryParameters::setMaxFeatures(int maxFeatures)

    Sets the maximum number of features, maxFeatures, to be included in the result.

    If 0, then there is no limit set on the number of features.

    The default value is 0.

    See also maxFeatures().

    void QueryParameters::setObjectIds(const QList<qint64> &objectIds)

    Sets the objectIds to filter for the query operation.

    Only features with these object IDs, a unique identifier within the feature set, will be considered as result candidates.

    See also objectIds().

    void QueryParameters::setOrderByFields(const QList<Esri::ArcGISRuntime::OrderBy> &orderByFields)

    Sets the orderByFields to be applied to the query operation.

    Results can be sorted on one or more fields. Each OrderBy instance includes a field name and whether to sort by that field in ascending or descending order.

    See also orderByFields() and OrderBy.

    void QueryParameters::setOutSpatialReference(const Esri::ArcGISRuntime::SpatialReference &spatialReference)

    Sets the spatialReference to be applied to the returned features.

    See also outSpatialReference().

    [since Esri::ArcGISRuntime 100.3] void QueryParameters::setResultOffset(int resultOffset)

    Sets the starting offset of results, resultOffset, to fetch in the query.

    When providing a result offset to support paging of results, a maximum features value must be set. If the result offset is set, but the maximum features value is not, the offset is ignored. For consistent ordering of the results when using pagination, the order by fields must be set using setOrderByFields.

    The default value is 0.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    See also resultOffset().

    void QueryParameters::setReturnGeometry(bool returnGeometry)

    Sets whether geometries will be returned in the feature result.

    • returnGeometry - Whether to return feature geometries.

    See also isReturnGeometry().

    void QueryParameters::setSpatialRelationship(Esri::ArcGISRuntime::SpatialRelationship relationship)

    Sets the spatial relationship to use when applying the geometry filter.

    The default value is SpatialRelationship::Intersects.

    See also spatialRelationship().

    [since Esri::ArcGISRuntime 100.3] void QueryParameters::setTimeExtent(const Esri::ArcGISRuntime::TimeExtent &timeExtent)

    Sets the time extent of the query to timeExtent.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    See also timeExtent().

    void QueryParameters::setWhereClause(const QString &whereClause)

    The whereClause of the query.

    See also whereClause().

    Esri::ArcGISRuntime::SpatialRelationship QueryParameters::spatialRelationship() const

    Returns the spatial relationship that (along with the geometry) defines features to be included in the query.

    The default value is SpatialRelationship::Intersects.

    See also setSpatialRelationship().

    [since Esri::ArcGISRuntime 100.3] Esri::ArcGISRuntime::TimeExtent QueryParameters::timeExtent() const

    Returns a span of time used to query features in a time-aware feature layer.

    You can apply a temporal filter on any FeatureLayer that supports time filtering (FeatureLayer::isSupportsTimeFiltering). Set the TimeExtent::startTime and TimeExtent::endTime to query features across a span of time. A single point in time can be queried by setting them to the same time value.

    By default, this value is nullptr and no time criteria is applied by the query.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    See also setTimeExtent().

    QString QueryParameters::whereClause() const

    Returns the attribute expression that defines features to be included in the query.

    The where clause should follow standard SQL syntax similar to that discussed in the document SQL reference for query expressions used in ArcGIS.

    If the where clause includes dates, they must be correctly formatted based on the geodatabase datasource used in the service. Refer to Dates and time for date formats expected by different data sources.

    ArcGISFeatureTable objects expect that any FieldType::GlobalId or FieldType::GUID parameters in the where clause are formatted as: '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'. All characters are uppercase, wrapped in curly braces and surrounded by single quotes.

    If the where clause is used to populate a OgcFeatureCollectionTable, you can use a CQL2-TEXT or CQL2-JSON string as defined in the document OGC API - Features - Part3.

    See also setWhereClause().

    Esri::ArcGISRuntime::QueryParameters &QueryParameters::operator=(const Esri::ArcGISRuntime::QueryParameters &other)

    Assignment operator from other QueryParameters.

    Esri::ArcGISRuntime::QueryParameters &QueryParameters::operator=(Esri::ArcGISRuntime::QueryParameters &&other)

    Move operator from other QueryParameters.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.