From: Regina Obe Date: Fri, 4 Aug 2017 16:24:34 +0000 (+0000) Subject: Missed test commit for ST_Centroid geography support X-Git-Tag: 2.4.0alpha~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69bf15c243a6e29e42e250859f3a2081fe4ae09e;p=postgis Missed test commit for ST_Centroid geography support References #2951 git-svn-id: http://svn.osgeo.org/postgis/trunk@15520 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/regress/geography_centroid.sql b/regress/geography_centroid.sql new file mode 100644 index 000000000..7e1edabbe --- /dev/null +++ b/regress/geography_centroid.sql @@ -0,0 +1,33 @@ + +-- check for pole crossing +SELECT c, ST_Centroid(g::geography) FROM +( VALUES + ('geog_centroid_mpt_pole_north', 'MULTIPOINT ( 90 80, -90 80)'), + ('geog_centroid_mpt_pole_south', 'MULTIPOINT ( 90 -80, -90 -80)') +) AS u(c, g); + +-- check for IDL crossing +SELECT c, ST_Centroid(g::geography) FROM +( VALUES + ('geog_centroid_mpt_idl_1', 'MULTIPOINT ( 179 0, -179 0)'), + ('geog_centroid_mpt_idl_2', 'MULTIPOINT ( 178 0, -179 0)'), + ('geog_centroid_mpt_idl_3', 'MULTIPOINT ( 179 0, -178 0)') +) AS u(c, g); + +-- point should return itself +SELECT c, ST_Centroid(g::geography) FROM +( VALUES + ('geog_centroid_pt_self_1', 'POINT ( 4 8)'), + ('geog_centroid_pt_self_2', 'POINT ( -15 16)'), + ('geog_centroid_pt_self_3', 'POINT ( -23 -42)') +) AS u(c, g); + +-- test supported geometry types +SELECT c, ST_Centroid(g::geography) FROM +( VALUES + ('geog_centroid_sup_pt', 'POINT (23 42)'), + ('geog_centroid_sup_line', 'LINESTRING(-20 35, 8 46)'), + ('geog_centroid_sup_mline', 'MULTILINESTRING((-5 45, 8 36), (1 49, 15 41))'), + ('geog_centroid_sup_poly', 'POLYGON((10.9099 50.6917,10.9483 50.6917,10.9483 50.6732,10.9099 50.6732,10.9099 50.6917))'), + ('geog_centroid_sup_mpoly', 'MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)))') +) AS u(c, g); diff --git a/regress/geography_centroid_expected b/regress/geography_centroid_expected new file mode 100644 index 000000000..0701e361e --- /dev/null +++ b/regress/geography_centroid_expected @@ -0,0 +1,13 @@ +geog_centroid_mpt_pole_north|0101000020E610000000000000000000000000000000805640 +geog_centroid_mpt_pole_south|0101000020E6100000000000000000000000000000008056C0 +geog_centroid_mpt_idl_1|0101000020E610000000000000008066400000000000000000 +geog_centroid_mpt_idl_2|0101000020E610000000000000007066400000000000000000 +geog_centroid_mpt_idl_3|0101000020E610000000000000007066C00000000000000000 +geog_centroid_pt_self_1|0101000020E610000000000000000010400000000000002040 +geog_centroid_pt_self_2|0101000020E61000000000000000002EC00000000000003040 +geog_centroid_pt_self_3|0101000020E610000000000000000037C000000000000045C0 +geog_centroid_sup_pt|0101000020E610000000000000000037400000000000004540 +geog_centroid_sup_line|0101000020E6100000753A468ED7B21CC00371ADA1B0AC4440 +geog_centroid_sup_mline|0101000020E61000009809DA1111101440C8CB7BE13F784540 +geog_centroid_sup_poly|0101000020E610000032ABE2FEB2DB25407A5DAC8D5A574940 +geog_centroid_sup_mpoly|0101000020E610000028B38B0AF4FFFFFF28B38B0AF4FFFFFF