|
@@ -0,0 +1,201 @@
|
|
|
+####################################################################################################
|
|
|
+# The test data contains four square polygons, with and without holes, and multipolygon combinations of these
|
|
|
+# We test this data against smaller, similar sized and larger query polygons with INTERSECTS, CONTAINS and WITHIN
|
|
|
+
|
|
|
+####################################################################################################
|
|
|
+# Test against a polygon similar in size to the Bottom Left polygon
|
|
|
+
|
|
|
+whereIntersectsSinglePolygon
|
|
|
+required_feature: esql.st_intersects
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Intersects(shape, TO_CARTESIANSHAPE("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
|
|
|
+1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
|
|
|
+5 | Four squares with holes | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4)), ((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4)), ((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4)), ((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4)))
|
|
|
+6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
|
|
|
+;
|
|
|
+
|
|
|
+whereContainsSinglePolygon
|
|
|
+required_feature: esql.st_contains_within
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Contains(shape, TO_CARTESIANSHAPE("POLYGON((0.001 0.001, 0.999 0.001, 0.999 0.999, 0.001 0.999, 0.001 0.001))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
|
|
|
+1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
|
|
|
+;
|
|
|
+
|
|
|
+whereWithinSinglePolygon
|
|
|
+required_feature: esql.st_contains_within
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Within(shape, TO_CARTESIANSHAPE("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
|
|
|
+6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
|
|
|
+;
|
|
|
+
|
|
|
+####################################################################################################
|
|
|
+# Test against a polygon smaller in size to the Bottom Left polygon
|
|
|
+
|
|
|
+whereIntersectsSmallerPolygon
|
|
|
+required_feature: esql.st_intersects
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Intersects(shape, TO_CARTESIANSHAPE("POLYGON((0.2 0.2, 0.8 0.2, 0.8 0.8, 0.2 0.8, 0.2 0.2))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
|
|
|
+1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
|
|
|
+5 | Four squares with holes | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4)), ((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4)), ((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4)), ((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4)))
|
|
|
+6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
|
|
|
+;
|
|
|
+
|
|
|
+whereContainsSmallerPolygon
|
|
|
+required_feature: esql.st_contains_within
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Contains(shape, TO_CARTESIANSHAPE("POLYGON((0.2 0.2, 0.8 0.2, 0.8 0.8, 0.2 0.8, 0.2 0.2))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
|
|
|
+1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
|
|
|
+;
|
|
|
+
|
|
|
+whereWithinSmallerPolygon
|
|
|
+required_feature: esql.st_contains_within
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Within(shape, TO_CARTESIANSHAPE("POLYGON((0.2 0.2, 0.8 0.2, 0.8 0.8, 0.2 0.8, 0.2 0.2))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+;
|
|
|
+
|
|
|
+####################################################################################################
|
|
|
+# Test against a polygon similar in size to the entire test data
|
|
|
+
|
|
|
+whereIntersectsLargerPolygon
|
|
|
+required_feature: esql.st_intersects
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Intersects(shape, TO_CARTESIANSHAPE("POLYGON((0 0, 3 0, 3 3, 0 3, 0 0))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
|
|
|
+1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
|
|
|
+2 | Bottom right | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0))
|
|
|
+3 | Top right | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2))
|
|
|
+4 | Top left | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2))
|
|
|
+5 | Four squares with holes | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4)), ((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4)), ((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4)), ((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4)))
|
|
|
+6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
|
|
|
+7 | Bottom right with holes | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4))
|
|
|
+8 | Top right with holes | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4))
|
|
|
+9 | Top left with holes | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4))
|
|
|
+;
|
|
|
+
|
|
|
+whereContainsLargerPolygon
|
|
|
+required_feature: esql.st_contains_within
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Contains(shape, TO_CARTESIANSHAPE("POLYGON((0 0, 3 0, 3 3, 0 3, 0 0))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+;
|
|
|
+
|
|
|
+whereWithinLargerPolygon
|
|
|
+required_feature: esql.st_contains_within
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Within(shape, TO_CARTESIANSHAPE("POLYGON((0 0, 3 0, 3 3, 0 3, 0 0))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
|
|
|
+1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
|
|
|
+2 | Bottom right | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0))
|
|
|
+3 | Top right | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2))
|
|
|
+4 | Top left | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2))
|
|
|
+5 | Four squares with holes | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4)), ((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4)), ((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4)), ((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4)))
|
|
|
+6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
|
|
|
+7 | Bottom right with holes | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4))
|
|
|
+8 | Top right with holes | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4))
|
|
|
+9 | Top left with holes | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4))
|
|
|
+;
|
|
|
+
|
|
|
+####################################################################################################
|
|
|
+# Test against a polygon larger than all test data
|
|
|
+
|
|
|
+whereIntersectsEvenLargerPolygon
|
|
|
+required_feature: esql.st_intersects
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Intersects(shape, TO_CARTESIANSHAPE("POLYGON((-1 -1, 4 -1, 4 4, -1 4, -1 -1))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
|
|
|
+1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
|
|
|
+2 | Bottom right | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0))
|
|
|
+3 | Top right | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2))
|
|
|
+4 | Top left | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2))
|
|
|
+5 | Four squares with holes | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4)), ((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4)), ((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4)), ((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4)))
|
|
|
+6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
|
|
|
+7 | Bottom right with holes | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4))
|
|
|
+8 | Top right with holes | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4))
|
|
|
+9 | Top left with holes | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4))
|
|
|
+;
|
|
|
+
|
|
|
+whereContainsEvenLargerPolygon
|
|
|
+required_feature: esql.st_contains_within
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Contains(shape, TO_CARTESIANSHAPE("POLYGON((-1 -1, 4 -1, 4 4, -1 4, -1 -1))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+;
|
|
|
+
|
|
|
+whereWithinEvenLargerPolygon
|
|
|
+required_feature: esql.st_contains_within
|
|
|
+
|
|
|
+FROM cartesian_multipolygons
|
|
|
+| WHERE ST_Within(shape, TO_CARTESIANSHAPE("POLYGON((-1 -1, 4 -1, 4 4, -1 4, -1 -1))"))
|
|
|
+| SORT id
|
|
|
+;
|
|
|
+
|
|
|
+id:l | name:keyword | shape:cartesian_shape
|
|
|
+0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
|
|
|
+1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
|
|
|
+2 | Bottom right | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0))
|
|
|
+3 | Top right | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2))
|
|
|
+4 | Top left | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2))
|
|
|
+5 | Four squares with holes | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4)), ((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4)), ((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4)), ((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4)))
|
|
|
+6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
|
|
|
+7 | Bottom right with holes | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4))
|
|
|
+8 | Top right with holes | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4))
|
|
|
+9 | Top left with holes | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4))
|
|
|
+;
|