Changeset: bf839bde5af5 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bf839bde5af5 Added Files: geom/sql/Tests/functions/Tests/ST_CoveredBy.sql geom/sql/Tests/functions/Tests/ST_Covers.sql Removed Files: geom/sql/Tests/functions/Tests/coveredBy.sql geom/sql/Tests/functions/Tests/coveredBy.stable.err geom/sql/Tests/functions/Tests/coveredBy.stable.out geom/sql/Tests/functions/Tests/covers.sql geom/sql/Tests/functions/Tests/covers.stable.err geom/sql/Tests/functions/Tests/covers.stable.out Modified Files: geom/monetdb5/geom.c geom/sql/Tests/functions/Tests/All Branch: geo Log Message:
tests for ST_Covers, ST_CoveredBy diffs (truncated from 345 to 300 lines): diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -3855,6 +3855,18 @@ static int wkbspatial(wkb **geomWKB_a, w GEOSGeom geosGeometry_a = wkb2geos(*geomWKB_a); GEOSGeom geosGeometry_b = wkb2geos(*geomWKB_b); +/* + str strA, strB; + int typeA, typeB; + int f =0; + wkbAsText(&strA, geomWKB_a, &f); + wkbAsText(&strB, geomWKB_b, &f); + typeA = GEOSGeomTypeId(geosGeometry_a); + typeB = GEOSGeomTypeId(geosGeometry_b); + +fprintf(stderr, "A: %s\tB: %s\n", strA, strB); +fprintf(stderr, "A: %s\tB: %s\n", geom_type2str(typeA+(typeA>2), 0), geom_type2str(typeB+(typeB>2), 0)); +*/ if (!geosGeometry_a && geosGeometry_b) { GEOSGeom_destroy(geosGeometry_b); return 3; diff --git a/geom/sql/Tests/functions/Tests/All b/geom/sql/Tests/functions/Tests/All --- a/geom/sql/Tests/functions/Tests/All +++ b/geom/sql/Tests/functions/Tests/All @@ -1,43 +1,57 @@ -pointFromText -lineFromText -polygonFromText -mpointFromText -mlineFromText -mpolygonFromText -makePoint -geomFromText -geometryType -asText -isClosed -isSimple -isValid -isRing -coordinates -srid -geometryN -numGeometries -numPoints -numRings -transform -contains -equals -boundary -dimension -asEWKT -covers -coveredBy -makeBox2D -makeEnvelope +loadTestGeometries -mbr_overlap -mbr_contains -mbr_equal -mbr_contained -mbr_overlap_or_right -mbr_overlap_or_left -mbr_below -mbr_overlap_or_above -mbr_above -mbr_overlap_or_below -mbr_distance +#pointFromText +#lineFromText +#polygonFromText +#mpointFromText +#mlineFromText +#mpolygonFromText +#makePoint +#geomFromText +#geometryType + +ST_AsText + +#isClosed +#isSimple +#isValid +#isRing +#coordinates +#srid +#geometryN +#numGeometries +#numPoints +#numRings +#transform + +ST_Contains + +#equals + +ST_Boundary #Missing geom_bat + bat_geom + +#dimension + +ST_AsEWKT + +#ST_Covers #Look at ST_Covers.sql for more details on the problem +#ST_CoveredBy #Look at ST_CoveredBy.sql for more details on the problem + +#makeBox2D +#makeEnvelope + +#mbr_overlap +#mbr_contains +#mbr_equal +#mbr_contained +#mbr_overlap_or_right +#mbr_overlap_or_left +#mbr_below +#mbr_overlap_or_above +#mbr_above +#mbr_overlap_or_below +#mbr_distance + + +dropTestGeometries diff --git a/geom/sql/Tests/functions/Tests/ST_CoveredBy.sql b/geom/sql/Tests/functions/Tests/ST_CoveredBy.sql new file mode 100644 --- /dev/null +++ b/geom/sql/Tests/functions/Tests/ST_CoveredBy.sql @@ -0,0 +1,16 @@ +SELECT ST_CoveredBy(smallc,smallc) AS small_coveredBy_small, + ST_CoveredBy(smallc, bigc) AS small_coveredby_big, + ST_CoveredBy(bigc, smallc) as big_coveredby_small, + ST_CoveredBy(ST_ExteriorRing(bigc), bigc) as exterior_coveredby_big, +FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 2)'), 10) As smallc, ST_Buffer(ST_GeomFromText('POINT(1 2)'), 20) As bigc) As foo; + +--it should return false but geos it seems only looks ta the first polygon in the multipolygon and thus returns true +--but postgis also uses the geos for this function and returns false (why?) +SELECT ST_CoveredBy('MULTIPOLYGON(((10 10,10 20,20 20,20 10,10 10),(30 300,300 40,40 40,40 30,30 300)))', 'POLYGON((10 10,10 20,20 20,20 10,10 10))'); + +SELECT geom AS "GEOMETRY", ST_CoveredBy('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))', geom) FROM geometries; + +--there is at least one more pair that should not because of the problem with the multipolygon against polygon. +--I am not sure whether the same happens when comparing whether a multipolygon is covered by a geometry collection. Postgis does not support geometry collections +SELECT g1.geom AS "GEOMETRY_1", g2.geom AS "GEOMETRY_2" FROM geometries g1, geometries g2 WHERE ST_CoveredBy(g1.geom, g2.geom); + diff --git a/geom/sql/Tests/functions/Tests/ST_Covers.sql b/geom/sql/Tests/functions/Tests/ST_Covers.sql new file mode 100644 --- /dev/null +++ b/geom/sql/Tests/functions/Tests/ST_Covers.sql @@ -0,0 +1,17 @@ +SELECT ST_Covers(smallc,smallc) As small_covers_small, + ST_Covers(smallc, bigc) As small_covers_big, + ST_Covers(bigc, ST_ExteriorRing(bigc)) As big_covers_exterior, + ST_Contains(bigc, ST_ExteriorRing(bigc)) As big_contains_exterior +FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 2)'), 10) As smallc, ST_Buffer(ST_GeomFromText('POINT(1 2)'), 20) As bigc) As foo; + +--it should return false but geos it seems only looks at the first polygon in the multipolygon and thus returns true +--but postgis also uses the geos for this function and returns false (why?) +SELECT ST_Covers('POLYGON((10 10,10 20,20 20,20 10,10 10))', 'MULTIPOLYGON(((10 10,10 20,20 20,20 10,10 10),(30 300,300 40,40 40,40 30,30 300)))'); + + +SELECT geom AS "GEOMETRY", ST_Covers('POLYGON((20 20, 20 5, 5 5, 5 20, 20 20))', geom) FROM geometries; + +--there is at least one more pair that should not because of the problem with the multipolygon against polygon. +--I am not sure whether the same happens when comparing whether a multipolygon is covered by a geometry collection. Postgis does not support geometry collections +SELECT g1.geom AS "GEOMETRY_1", g2.geom AS "GEOMETRY_2" FROM geometries g1, geometries g2 WHERE ST_Covers(g1.geom, g2.geom); + diff --git a/geom/sql/Tests/functions/Tests/coveredBy.sql b/geom/sql/Tests/functions/Tests/coveredBy.sql deleted file mode 100644 --- a/geom/sql/Tests/functions/Tests/coveredBy.sql +++ /dev/null @@ -1,1 +0,0 @@ -SELECT ST_CoveredBy(smallc,smallc) AS small_coveredBy_small, ST_CoveredBy(smallc, bigc) AS small_coveredby_big, ST_CoveredBy(bigc, smallc) as big_coveredby_small, ST_CoveredBy(ST_ExteriorRing(bigc), bigc) as exterior_coveredby_big, ST_Within(ST_ExteriorRing(bigc),bigc) as exterior_within_big FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 2)'), 10) As smallc, ST_Buffer(ST_GeomFromText('POINT(1 2)'), 20) As bigc) As foo; diff --git a/geom/sql/Tests/functions/Tests/coveredBy.stable.err b/geom/sql/Tests/functions/Tests/coveredBy.stable.err deleted file mode 100644 --- a/geom/sql/Tests/functions/Tests/coveredBy.stable.err +++ /dev/null @@ -1,36 +0,0 @@ -stderr of test 'coveredBy` in directory 'geom/sql/Tests/functions` itself: - - -# 10:52:19 > -# 10:52:19 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=39851" "--set" "mapi_usock=/var/tmp/mtest-4010/.s.monetdb.39851" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch1/alvanaki/INSTALL/MonetDB-public/var/MonetDB/mTests_geom_sql_Tests_functions" "--set" "mal_listing=0" -# 10:52:19 > - -# builtin opt gdk_dbpath = /export/scratch1/alvanaki/INSTALL/MonetDB-public/var/monetdb5/dbfarm/demo -# builtin opt gdk_debug = 0 -# builtin opt gdk_vmtrim = no -# builtin opt monet_prompt = > -# builtin opt monet_daemon = no -# builtin opt mapi_port = 50000 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_optimizer = default_pipe -# builtin opt sql_debug = 0 -# cmdline opt gdk_nr_threads = 0 -# cmdline opt mapi_open = true -# cmdline opt mapi_port = 39851 -# cmdline opt mapi_usock = /var/tmp/mtest-4010/.s.monetdb.39851 -# cmdline opt monet_prompt = -# cmdline opt mal_listing = 2 -# cmdline opt gdk_dbpath = /export/scratch1/alvanaki/INSTALL/MonetDB-public/var/MonetDB/mTests_geom_sql_Tests_functions -# cmdline opt mal_listing = 0 -# cmdline opt gdk_debug = 536870922 - -# 10:52:19 > -# 10:52:19 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-4010" "--port=39851" -# 10:52:19 > - - -# 10:52:19 > -# 10:52:19 > "Done." -# 10:52:19 > - diff --git a/geom/sql/Tests/functions/Tests/coveredBy.stable.out b/geom/sql/Tests/functions/Tests/coveredBy.stable.out deleted file mode 100644 --- a/geom/sql/Tests/functions/Tests/coveredBy.stable.out +++ /dev/null @@ -1,37 +0,0 @@ -stdout of test 'coveredBy` in directory 'geom/sql/Tests/functions` itself: - - -# 10:52:19 > -# 10:52:19 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=39851" "--set" "mapi_usock=/var/tmp/mtest-4010/.s.monetdb.39851" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch1/alvanaki/INSTALL/MonetDB-public/var/MonetDB/mTests_geom_sql_Tests_functions" "--set" "mal_listing=0" -# 10:52:19 > - -# MonetDB 5 server v11.20.0 -# This is an unreleased version -# Serving database 'mTests_geom_sql_Tests_functions', using 8 threads -# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit integers dynamically linked -# Found 15.356 GiB available main-memory. -# Copyright (c) 1993-July 2008 CWI. -# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved -# Visit http://www.monetdb.org/ for further information -# Listening for connection requests on mapi:monetdb://sibuyan.da.cwi.nl:39851/ -# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-4010/.s.monetdb.39851 -# MonetDB/GIS module loaded -# MonetDB/SQL module loaded - -Ready. - -# 10:52:19 > -# 10:52:19 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-4010" "--port=39851" -# 10:52:19 > - -#SELECT ST_CoveredBy(smallc,smallc) AS small_coveredBy_small, ST_CoveredBy(smallc, bigc) AS small_coveredby_big, ST_CoveredBy(bigc, smallc) as big_coveredby_small, ST_CoveredBy(ST_ExteriorRing(bigc), bigc) as exterior_coveredby_big, ST_Within(ST_ExteriorRing(bigc),bigc) as exterior_within_big FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 2)'), 10) As smallc, ST_Buffer(ST_GeomFromText('POINT(1 2)'), 20) As bigc) As foo; -% .L, .L, .L, .L, .L # table_name -% small_coveredby_small, small_coveredby_big, big_coveredby_small, exterior_coveredby_big, exterior_within_big # name -% boolean, boolean, boolean, boolean, boolean # type -% 5, 5, 5, 5, 5 # length -[ true, true, false, true, false ] - -# 10:52:19 > -# 10:52:19 > "Done." -# 10:52:19 > - diff --git a/geom/sql/Tests/functions/Tests/covers.sql b/geom/sql/Tests/functions/Tests/covers.sql deleted file mode 100644 --- a/geom/sql/Tests/functions/Tests/covers.sql +++ /dev/null @@ -1,1 +0,0 @@ -SELECT ST_Covers(smallc,smallc) As small_covers_small, ST_Covers(smallc, bigc) As small_covers_big, ST_Covers(bigc, ST_ExteriorRing(bigc)) As big_covers_exterior, ST_Contains(bigc, ST_ExteriorRing(bigc)) As big_contains_exterior FROM (SELECT ST_Buffer(ST_GeomFromText('POINT(1 2)'), 10) As smallc, ST_Buffer(ST_GeomFromText('POINT(1 2)'), 20) As bigc) As foo; diff --git a/geom/sql/Tests/functions/Tests/covers.stable.err b/geom/sql/Tests/functions/Tests/covers.stable.err deleted file mode 100644 --- a/geom/sql/Tests/functions/Tests/covers.stable.err +++ /dev/null @@ -1,36 +0,0 @@ -stderr of test 'covers` in directory 'geom/sql/Tests/functions` itself: - - -# 10:52:19 > -# 10:52:19 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=39851" "--set" "mapi_usock=/var/tmp/mtest-4010/.s.monetdb.39851" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/export/scratch1/alvanaki/INSTALL/MonetDB-public/var/MonetDB/mTests_geom_sql_Tests_functions" "--set" "mal_listing=0" -# 10:52:19 > - -# builtin opt gdk_dbpath = /export/scratch1/alvanaki/INSTALL/MonetDB-public/var/monetdb5/dbfarm/demo -# builtin opt gdk_debug = 0 -# builtin opt gdk_vmtrim = no -# builtin opt monet_prompt = > -# builtin opt monet_daemon = no -# builtin opt mapi_port = 50000 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_optimizer = default_pipe -# builtin opt sql_debug = 0 -# cmdline opt gdk_nr_threads = 0 -# cmdline opt mapi_open = true -# cmdline opt mapi_port = 39851 -# cmdline opt mapi_usock = /var/tmp/mtest-4010/.s.monetdb.39851 -# cmdline opt monet_prompt = -# cmdline opt mal_listing = 2 -# cmdline opt gdk_dbpath = /export/scratch1/alvanaki/INSTALL/MonetDB-public/var/MonetDB/mTests_geom_sql_Tests_functions -# cmdline opt mal_listing = 0 -# cmdline opt gdk_debug = 536870922 - -# 10:52:19 > -# 10:52:19 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-4010" "--port=39851" -# 10:52:19 > - - -# 10:52:19 > _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list