forPolicy static method

GeospatialConfig? forPolicy(
  1. IndexingPolicy? indexingPolicy
)

Find proper geospatial config for the indexingPolicy if provided. null if indexingPolicy or IndexingPolicy.spatialIndexes is null.

Implementation

static GeospatialConfig? forPolicy(IndexingPolicy? indexingPolicy) {
  final spatialIndexes = indexingPolicy?.spatialIndexes;
  if (spatialIndexes == null) return null;
  if (spatialIndexes.any((index) => index.boundingBox != null)) {
    return GeospatialConfig.geometry;
  } else {
    return GeospatialConfig.geography;
  }
}