populateFromServiceWithQueryLanguage method

Future<FeatureQueryResult> populateFromServiceWithQueryLanguage({
  1. QueryParameters? parameters,
  2. required bool clearCache,
  3. required List<String> outFields,
  4. required String queryLanguage,
})

Populate the OGC API - Features feature collection table with the results of a query.

Populates the OgcFeatureCollectionTable with features from the service that match the query parameters. Use the default (empty) QueryParameters to get all features from the service. Specifying null or an empty List for outfields will result in the default set of outfields being used. Spatial queries (those that specify geometries) must use the Intersects spatial relationship.

Some OGC feature sources allow for query expressions to be written in different languages. The queryLanguage parameter allows you to explicitly specify the language of the QueryParameters.whereClause for the OGC feature query. The value of this parameter may be 'CQL2-TEXT', 'CQL2-JSON', or any other language supported by the target server. For OGC feature services the default language is CQL2-TEXT. For more information, refer to the OGC specification OGC API - Features - Part3. The default value is an empty string, indicating that the QueryParameters.whereClause uses the default language for the source.

Parameters:

  • parameters — Parameters that define how features are returned from the service.
  • clearCache — If true, clears existing table data before populating it with features returned from the service.
  • outFields — A List containing String.
  • queryLanguage — The query language that the QueryParameters.whereClause is written in.

Return Value: A Future that returns a FeatureQueryResult type.

Implementation

Future<FeatureQueryResult> populateFromServiceWithQueryLanguage({
  QueryParameters? parameters,
  required bool clearCache,
  required List<String> outFields,
  required String queryLanguage,
}) {
  final coreOutFields = outFields.toMutableArray(
    valueType: _ElementType.string,
  );
  final coreQueryLanguage = _CString(queryLanguage);
  final taskHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore
        .RT_OGCFeatureCollectionTable_populateFromServiceWithQueryLanguage(
      _handle,
      parameters?._handle ?? ffi.nullptr,
      clearCache,
      coreOutFields._handle,
      coreQueryLanguage.bytes,
      errorHandler,
    );
  });
  return taskHandle.toFuture(
    (element) => element.getValueAsFeatureQueryResult()!,
  );
}