populateFromService method

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

Populates the WFS feature table using the query parameters.

Use the default (empty) QueryParameters to get all features from the service. If you specify a null or an empty collection for outfields, then the default set of outfields are used.

WFS is compatible with a subset of possible queries defined by QueryParameters. The QueryParameters.whereClause only works when the table is backed by a service powered by a GeoServer. Spatial queries (those that specify geometries) must use the SpatialRelationship.intersects spatial relationship.

You must ensure that the WfsFeatureTable.featureRequestMode is set to FeatureRequestMode.manualCache before attempting to populate the table.

Parameters:

  • parameters — Options for controlling the operation.
  • clearCache — If true, the existing table data is cleared before it is populated with the query result.
  • outFields — A List containing String.

Return Value: A Future that returns a FeatureQueryResult type.

Implementation

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