public static Query MakeQuery(SpatialStrategy spatialStrategy, string shapeWKT, SpatialRelation relation, double distanceErrorPct = 0.025) { SpatialOperation spatialOperation; Shape shape = ShapeReadWriter.ReadShape(shapeWKT); switch (relation) { case SpatialRelation.Within: spatialOperation = SpatialOperation.IsWithin; break; case SpatialRelation.Contains: spatialOperation = SpatialOperation.Contains; break; case SpatialRelation.Disjoint: spatialOperation = SpatialOperation.IsDisjointTo; break; case SpatialRelation.Intersects: spatialOperation = SpatialOperation.Intersects; break; case SpatialRelation.Nearby: var nearbyArgs = new SpatialArgs(SpatialOperation.IsWithin, shape); nearbyArgs.SetDistPrecision(distanceErrorPct); // only sort by this, do not filter return(new FunctionQuery(spatialStrategy.MakeValueSource(nearbyArgs))); default: throw new ArgumentOutOfRangeException("relation"); } var args = new SpatialArgs(spatialOperation, shape); args.SetDistPrecision(distanceErrorPct); return(spatialStrategy.MakeQuery(args)); }