Mercurial > gemma
annotate schema/isrs_tests.sql @ 5675:b8da63027b48 sr-v2
Started to separate mesh serialisation in different files.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 10 Feb 2024 22:22:03 +0100 |
parents | 8fcabb6f971e |
children |
rev | line source |
---|---|
1298
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
1 -- This is Free Software under GNU Affero General Public License v >= 3.0 |
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
2 -- without warranty, see README.md and license for details. |
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
3 |
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
4 -- SPDX-License-Identifier: AGPL-3.0-or-later |
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
5 -- License-Filename: LICENSES/AGPL-3.0.txt |
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
6 |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
7 -- Copyright (C) 2018, 2019 by via donau |
1298
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
8 -- – Österreichische Wasserstraßen-Gesellschaft mbH |
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
9 -- Software engineering by Intevation GmbH |
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
10 |
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
11 -- Author(s): |
1301
2304778c4432
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1298
diff
changeset
|
12 -- * Tom Gottfried <tom@intevation.de> |
1298
6590208e3ee1
add headers for licensing to some schema files
Fadi Abbud <fadi.abbud@intevation.de>
parents:
578
diff
changeset
|
13 |
569
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
14 -- |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
15 -- pgTAP test script for ISRS location code types and functions |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
16 -- |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
17 |
3566
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
18 -- |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
19 -- Conversion from/to text |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
20 -- |
569
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
21 SELECT results_eq($$ |
578
61af85a432bf
Fix extraction of object reference code
Tom Gottfried <tom@intevation.de>
parents:
569
diff
changeset
|
22 SELECT isrs_fromText('DEBON03901G007906548') |
569
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
23 $$, |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
24 $$ |
578
61af85a432bf
Fix extraction of object reference code
Tom Gottfried <tom@intevation.de>
parents:
569
diff
changeset
|
25 SELECT CAST(('DE', 'BON', '03901', 'G0079', 6548) AS isrs) |
569
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
26 $$, |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
27 'Correct ISRS text input gives respective ISRS location code'); |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
28 |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
29 SELECT throws_ok($$ |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
30 SELECT isrs_fromText('DEUXXX039000000005023') |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
31 $$, |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
32 22023, NULL, |
ad07846b09d1
Add function to construct isrs from text
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
33 'ISRS text input needs to have correct length'); |
1629
9d51f022b8ee
Introduce SQL function to clip an area to a stretch
Tom Gottfried <tom@intevation.de>
parents:
1301
diff
changeset
|
34 |
9d51f022b8ee
Introduce SQL function to clip an area to a stretch
Tom Gottfried <tom@intevation.de>
parents:
1301
diff
changeset
|
35 SELECT ok( |
2081
40711ca3aa19
Add function to get text representation of location code
Tom Gottfried <tom@intevation.de>
parents:
1983
diff
changeset
|
36 'DEBON03901G007906548' = isrs_asText(isrs_fromText('DEBON03901G007906548')) |
40711ca3aa19
Add function to get text representation of location code
Tom Gottfried <tom@intevation.de>
parents:
1983
diff
changeset
|
37 , |
40711ca3aa19
Add function to get text representation of location code
Tom Gottfried <tom@intevation.de>
parents:
1983
diff
changeset
|
38 'isrs_asText() is the inverse of isrs_fromText()'); |
40711ca3aa19
Add function to get text representation of location code
Tom Gottfried <tom@intevation.de>
parents:
1983
diff
changeset
|
39 |
3566
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
40 -- |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
41 -- Comparison operators |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
42 -- |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
43 SELECT ok( |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
44 isrs_fromText('DEBON03901G007906548') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
45 <> isrs_fromText('DEXXX039010000006548'), |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
46 'Different codes at equal hectometre do not equal by default'); |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
47 |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
48 SELECT ok( |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
49 isrs_fromText('DEBON03901G007906548') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
50 ~= isrs_fromText('DEXXX039010000006548') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
51 AND isrs_fromText('DEBON03901G007906548') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
52 >~= isrs_fromText('DEXXX039010000006548') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
53 AND isrs_fromText('DEBON03901G007906548') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
54 <~= isrs_fromText('DEXXX039010000006548'), |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
55 'isrs_ops: Different codes at equal hectometre compare as equal'); |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
56 |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
57 SELECT ok( |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
58 isrs_fromText('DEBON03901G007906549') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
59 >~ isrs_fromText('DEXXX039010000006548') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
60 AND isrs_fromText('DEBON03901G007906549') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
61 >~= isrs_fromText('DEXXX039010000006548') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
62 AND isrs_fromText('DEXXX039010000006547') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
63 <~= isrs_fromText('DEBON03901G007906548') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
64 AND isrs_fromText('DEXXX039010000006547') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
65 <~ isrs_fromText('DEBON03901G007906548'), |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
66 'isrs_ops: Ordering depends on hectometre'); |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
67 |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
68 SELECT ok( |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
69 isrsrange(isrs_fromText('DEXXX039010000006540'), |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
70 isrs_fromText('DEXXX039010000006560')) |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
71 @> isrs_fromText('ATXXX000000000006550') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
72 AND isrs_fromText('DEXXX039010000006560') |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
73 <@ isrsrange(isrs_fromText('ATXXX000000000006550'), |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
74 isrs_fromText('ATXXX000000000006570')), |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
75 'isrsrange: ''Contains'' depends on hectometre'); |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
76 |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
77 SELECT ok( |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
78 isrsrange(isrs_fromText('DEXXX039010000006540'), |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
79 isrs_fromText('DEXXX039010000006560')) |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
80 && isrsrange(isrs_fromText('ATXXX000000000006550'), |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
81 isrs_fromText('ATXXX000000000006570')), |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
82 'isrsrange: Overlap depends on hectometre'); |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
83 |
4431
8fcabb6f971e
Fix operator support functions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
84 SELECT lives_ok($$ |
8fcabb6f971e
Fix operator support functions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
85 SET search_path TO ''; |
8fcabb6f971e
Fix operator support functions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
86 SELECT public.isrs_diff( |
8fcabb6f971e
Fix operator support functions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
87 CAST('(AT,XXX,00000,00000,0)' as public.isrs), |
8fcabb6f971e
Fix operator support functions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
88 CAST('(AT,XXX,00000,00000,1)' as public.isrs)); |
8fcabb6f971e
Fix operator support functions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
89 RESET search_path; |
8fcabb6f971e
Fix operator support functions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
90 $$, |
8fcabb6f971e
Fix operator support functions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
91 'Support function runs with empty search path (as during autovacuum)'); |
8fcabb6f971e
Fix operator support functions
Tom Gottfried <tom@intevation.de>
parents:
3566
diff
changeset
|
92 |
3566
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
93 -- |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
94 -- Geometry processing |
4c585b5d4fe8
Introduce hectometer based order for ranges of ISRS location codes
Tom Gottfried <tom@intevation.de>
parents:
3561
diff
changeset
|
95 -- |
2535
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
96 SELECT throws_ok($$ |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
97 SELECT ISRSrange_points(isrsrange( |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
98 ('AT', 'XXX', '00001', '00000', 0)::isrs, |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
99 ('AT', 'XXX', '00001', '00000', 99999)::isrs)) |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
100 $$, |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
101 'P0002', NULL, |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
102 'ISRSrange_points fails if not both distance marks can be found'); |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
103 |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
104 SELECT throws_ok($$ |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
105 SELECT ISRSrange_axis(isrsrange( |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
106 ('AT', 'XXX', '00001', '00000', 0)::isrs, |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
107 ('AT', 'XXX', '00001', '00000', 2)::isrs), |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
108 0) |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
109 $$, |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
110 'P0002', NULL, |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
111 'ISRSrange_axis fails if no contiguous axis can be constructed'); |
73c8762cee60
Stretch area generation: Throw errors instead of returning NULL
Tom Gottfried <tom@intevation.de>
parents:
2453
diff
changeset
|
112 |
2081
40711ca3aa19
Add function to get text representation of location code
Tom Gottfried <tom@intevation.de>
parents:
1983
diff
changeset
|
113 SELECT ok( |
2688
d316a6e41f54
Test if overlapping axis chunks are sewed together correctly
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
114 ST_IsSimple(ISRSrange_axis(isrsrange( |
d316a6e41f54
Test if overlapping axis chunks are sewed together correctly
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
115 ('AT', 'XXX', '00001', '00000', 0)::isrs, |
d316a6e41f54
Test if overlapping axis chunks are sewed together correctly
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
116 ('AT', 'XXX', '00001', '00000', 2)::isrs), |
d316a6e41f54
Test if overlapping axis chunks are sewed together correctly
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
117 5)), |
d316a6e41f54
Test if overlapping axis chunks are sewed together correctly
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
118 'ISRSrange_axis returns a valid simple feature'); |
d316a6e41f54
Test if overlapping axis chunks are sewed together correctly
Tom Gottfried <tom@intevation.de>
parents:
2563
diff
changeset
|
119 |
3561
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
120 SELECT throws_ok($$ |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
121 SELECT ISRSrange_area('LINESTRING(0 0, 1 1)', NULL) |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
122 $$, |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
123 'P0002', NULL, |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
124 'ISRSrange_area fails if no input area is given'); |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
125 |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
126 SELECT throws_ok($$ |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
127 SELECT ISRSrange_area(ISRSrange_axis(isrsrange( |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
128 ('AT', 'XXX', '00001', '00000', 0)::isrs, |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
129 ('AT', 'XXX', '00001', '00000', 1)::isrs), |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
130 5), |
3561
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
131 ST_SetSRID('POLYGON((0 1, 0 2, 1 2, 1 1, 0 1))'::geometry, 4326)) |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
132 $$, |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
133 'P0002', NULL, |
453f15ba8030
Improve error handling in area generation
Tom Gottfried <tom@intevation.de>
parents:
2688
diff
changeset
|
134 'ISRSrange_area fails, if given area does not intersect with axis'); |
1629
9d51f022b8ee
Introduce SQL function to clip an area to a stretch
Tom Gottfried <tom@intevation.de>
parents:
1301
diff
changeset
|
135 |
2453 | 136 SELECT results_eq($$ |
137 SELECT every(ST_DWithin( | |
138 ST_Boundary(ISRSrange_area( | |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
139 ISRSrange_axis(isrsrange( |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
140 ('AT', 'XXX', '00001', '00000', 0)::isrs, |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
141 ('AT', 'XXX', '00001', '00000', 1)::isrs), |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
142 5), |
2453 | 143 (SELECT ST_Collect(CAST(area AS geometry)) |
144 FROM waterway.waterway_area))), | |
145 geom, | |
146 1)) | |
147 FROM waterway.distance_marks_virtual | |
148 WHERE location_code IN( | |
149 ('AT', 'XXX', '00001', '00000', 0)::isrs, | |
150 ('AT', 'XXX', '00001', '00000', 1)::isrs) | |
151 $$, | |
152 $$ | |
153 SELECT true | |
154 $$, | |
1629
9d51f022b8ee
Introduce SQL function to clip an area to a stretch
Tom Gottfried <tom@intevation.de>
parents:
1301
diff
changeset
|
155 'Resulting polygon almost ST_Touches points corresponding to stretch'); |
1983
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
156 |
2398
8481e6266691
Fix corner case in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2232
diff
changeset
|
157 \set test_area 'POLYGON((-1 1, 2 1, 2 -1, -1 -1, -1 1))' |
1983
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
158 SELECT ok( |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
159 2 = ST_NumGeometries( |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
160 ISRSrange_area( |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
161 ISRSrange_axis(isrsrange( |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
162 ('AT', 'XXX', '00001', '00000', 0)::isrs, |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
163 ('AT', 'XXX', '00001', '00000', 1)::isrs), |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
164 5), |
1983
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
165 ST_SetSRID(ST_Collect( |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
166 ST_Translate(:'test_area', |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
167 (ST_XMax(:'test_area'::geometry) |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
168 - ST_XMin(:'test_area'::geometry))/2 |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
169 + 0.1, 0), |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
170 ST_Translate(:'test_area', |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
171 -((ST_XMax(:'test_area'::geometry) |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
172 - ST_XMin(:'test_area'::geometry))/2 |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
173 + 0.1), 0)), |
f9f1babe52ae
Fix area generation from multipolygon input
Tom Gottfried <tom@intevation.de>
parents:
1629
diff
changeset
|
174 4326))), |
2232
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
175 'Two polygons intersecting the axis lead to two polygons in result'); |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
176 |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
177 SELECT ok( |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
178 1 = ST_NumGeometries( |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
179 ISRSrange_area( |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
180 ISRSrange_axis(isrsrange( |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
181 ('AT', 'XXX', '00001', '00000', 0)::isrs, |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
182 ('AT', 'XXX', '00001', '00000', 1)::isrs), |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
183 5), |
2232
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
184 ST_SetSRID(ST_Collect( |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
185 ST_Translate(:'test_area', |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
186 (ST_XMax(:'test_area'::geometry) |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
187 - ST_XMin(:'test_area'::geometry))/3, |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
188 0), |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
189 ST_Translate(:'test_area', |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
190 -((ST_XMax(:'test_area'::geometry) |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
191 - ST_XMin(:'test_area'::geometry))/3), |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
192 0)), |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
193 4326))), |
7936b46a88d4
Handle invalid multipolygons in area generation from stretch
Tom Gottfried <tom@intevation.de>
parents:
2081
diff
changeset
|
194 'Self-intersecting multipolygon leads to one polygon in result'); |
2431
48495bd3081d
Construct stretch area between distance marks also from non-contiguous axis
Tom Gottfried <tom@intevation.de>
parents:
2398
diff
changeset
|
195 |
2453 | 196 SELECT results_eq($$ |
197 SELECT every(ST_DWithin( | |
198 ST_Boundary(ISRSrange_area( | |
2563
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
199 ISRSrange_axis(isrsrange( |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
200 ('AT', 'XXX', '00001', '00000', 0)::isrs, |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
201 ('AT', 'XXX', '00001', '00000', 2)::isrs), |
dc4fae4bdb8f
Expose axis snapping tolerance to users
Tom Gottfried <tom@intevation.de>
parents:
2535
diff
changeset
|
202 5), |
2453 | 203 (SELECT ST_Collect(CAST(area AS geometry)) |
204 FROM waterway.waterway_area))), | |
205 geom, | |
206 1)) | |
207 FROM waterway.distance_marks_virtual | |
208 WHERE location_code IN( | |
2431
48495bd3081d
Construct stretch area between distance marks also from non-contiguous axis
Tom Gottfried <tom@intevation.de>
parents:
2398
diff
changeset
|
209 ('AT', 'XXX', '00001', '00000', 0)::isrs, |
2453 | 210 ('AT', 'XXX', '00001', '00000', 2)::isrs) |
211 $$, | |
212 $$ | |
213 SELECT true | |
214 $$, | |
2431
48495bd3081d
Construct stretch area between distance marks also from non-contiguous axis
Tom Gottfried <tom@intevation.de>
parents:
2398
diff
changeset
|
215 'Area generated from non-matching distance mark and non-contiguous axis'); |