| 1 |
SET @wkb_pt = ST_AsWKB(ST_GeomFromText('POINT(0 1)')); |
| 2 |
SET @wkb_ln = ST_AsWKB(ST_GeomFromText('LINESTRING(0 1,2 3,4 5,6 7,8 9, 10 11)')); |
| 3 |
SET @wkb_py = ST_AsWKB(ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))')); |
| 4 |
SET @wkb_mpt = ST_AsWKB(ST_GeomFromText('MULTIPOINT(0 1,2 3,4 5,6 7)')); |
| 5 |
SET @wkb_mln = ST_AsWKB(ST_GeomFromText('MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))')); |
| 6 |
SET @wkb_mpy = ST_AsWKB(ST_GeomFromText('MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),' |
| 7 |
'((10 11,10 12,12 13,12 10,10 11)))')); |
| 8 |
SET @wkb_gc = ST_AsWKB(ST_GeomFromText('GEOMETRYCOLLECTION(' |
| 9 |
'POINT(0 1),' |
| 10 |
'LINESTRING(0 1,10 11),' |
| 11 |
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),' |
| 12 |
'MULTIPOINT(0 1,2 3,4 5,6 7,8 9,10 11),' |
| 13 |
'MULTILINESTRING((0 1,10 11),(0 10,10 0)),' |
| 14 |
'MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))')); |
| 15 |
# |
| 16 |
# Functions that accept a WKT value of any geometry type. |
| 17 |
# |
| 18 |
# ST_GeomFromWKB() |
| 19 |
SELECT ST_AsText(ST_GeomFromWKB(@wkb_pt)); |
| 20 |
ST_AsText(ST_GeomFromWKB(@wkb_pt)) |
| 21 |
POINT(0 1) |
| 22 |
SELECT ST_AsText(ST_GeomFromWKB(@wkb_ln)); |
| 23 |
ST_AsText(ST_GeomFromWKB(@wkb_ln)) |
| 24 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 25 |
SELECT ST_AsText(ST_GeomFromWKB(@wkb_py)); |
| 26 |
ST_AsText(ST_GeomFromWKB(@wkb_py)) |
| 27 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 28 |
SELECT ST_AsText(ST_GeomFromWKB(@wkb_mpt)); |
| 29 |
ST_AsText(ST_GeomFromWKB(@wkb_mpt)) |
| 30 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 31 |
SELECT ST_AsText(ST_GeomFromWKB(@wkb_mln)); |
| 32 |
ST_AsText(ST_GeomFromWKB(@wkb_mln)) |
| 33 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 34 |
SELECT ST_AsText(ST_GeomFromWKB(@wkb_mpy)); |
| 35 |
ST_AsText(ST_GeomFromWKB(@wkb_mpy)) |
| 36 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 37 |
SELECT ST_AsText(ST_GeomFromWKB(@wkb_gc)); |
| 38 |
ST_AsText(ST_GeomFromWKB(@wkb_gc)) |
| 39 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 40 |
# ST_GeometryFromWKB() |
| 41 |
SELECT ST_AsText(ST_GeometryFromWKB(@wkb_pt)); |
| 42 |
ST_AsText(ST_GeometryFromWKB(@wkb_pt)) |
| 43 |
POINT(0 1) |
| 44 |
SELECT ST_AsText(ST_GeometryFromWKB(@wkb_ln)); |
| 45 |
ST_AsText(ST_GeometryFromWKB(@wkb_ln)) |
| 46 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 47 |
SELECT ST_AsText(ST_GeometryFromWKB(@wkb_py)); |
| 48 |
ST_AsText(ST_GeometryFromWKB(@wkb_py)) |
| 49 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 50 |
SELECT ST_AsText(ST_GeometryFromWKB(@wkb_mpt)); |
| 51 |
ST_AsText(ST_GeometryFromWKB(@wkb_mpt)) |
| 52 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 53 |
SELECT ST_AsText(ST_GeometryFromWKB(@wkb_mln)); |
| 54 |
ST_AsText(ST_GeometryFromWKB(@wkb_mln)) |
| 55 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 56 |
SELECT ST_AsText(ST_GeometryFromWKB(@wkb_mpy)); |
| 57 |
ST_AsText(ST_GeometryFromWKB(@wkb_mpy)) |
| 58 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 59 |
SELECT ST_AsText(ST_GeometryFromWKB(@wkb_gc)); |
| 60 |
ST_AsText(ST_GeometryFromWKB(@wkb_gc)) |
| 61 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 62 |
# |
| 63 |
# Function that accepts a WKT value of Point geometry |
| 64 |
# |
| 65 |
# ST_PointFromWKB() |
| 66 |
SELECT ST_AsText(ST_PointFromWKB(@wkb_pt)); |
| 67 |
ST_AsText(ST_PointFromWKB(@wkb_pt)) |
| 68 |
POINT(0 1) |
| 69 |
# |
| 70 |
# Functions that accept a WKT value of LineString geometry |
| 71 |
# |
| 72 |
# ST_LineFromWKB() |
| 73 |
SELECT ST_AsText(ST_LineFromWKB(@wkb_ln)); |
| 74 |
ST_AsText(ST_LineFromWKB(@wkb_ln)) |
| 75 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 76 |
# ST_LineStringFromWKB() |
| 77 |
SELECT ST_AsText(ST_LineStringFromWKB(@wkb_ln)); |
| 78 |
ST_AsText(ST_LineStringFromWKB(@wkb_ln)) |
| 79 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 80 |
# |
| 81 |
# Functions that accept a WKT value of Polygon geometry |
| 82 |
# |
| 83 |
# ST_PolyFromWKB() |
| 84 |
SELECT ST_AsText(ST_PolyFromWKB(@wkb_py)); |
| 85 |
ST_AsText(ST_PolyFromWKB(@wkb_py)) |
| 86 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 87 |
# ST_PolygonFromWKB() |
| 88 |
SELECT ST_AsText(ST_PolygonFromWKB(@wkb_py)); |
| 89 |
ST_AsText(ST_PolygonFromWKB(@wkb_py)) |
| 90 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 91 |
# |
| 92 |
# Functions that accept a WKT value of MultiPoint geometry |
| 93 |
# |
| 94 |
# ST_MPointFromWKB() |
| 95 |
SELECT ST_AsText(ST_MPointFromWKB(@wkb_mpt)); |
| 96 |
ST_AsText(ST_MPointFromWKB(@wkb_mpt)) |
| 97 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 98 |
# ST_MultiPointFromWKB() |
| 99 |
SELECT ST_AsText(ST_MultiPointFromWKB(@wkb_mpt)); |
| 100 |
ST_AsText(ST_MultiPointFromWKB(@wkb_mpt)) |
| 101 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 102 |
# |
| 103 |
# Functions that accept a WKT value of MultiLineString geometry |
| 104 |
# |
| 105 |
# ST_MLineFromWKB() |
| 106 |
SELECT ST_AsText(ST_MLineFromWKB(@wkb_mln)); |
| 107 |
ST_AsText(ST_MLineFromWKB(@wkb_mln)) |
| 108 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 109 |
# ST_MultiLineStringFromWKB() |
| 110 |
SELECT ST_AsText(ST_MultiLineStringFromWKB(@wkb_mln)); |
| 111 |
ST_AsText(ST_MultiLineStringFromWKB(@wkb_mln)) |
| 112 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 113 |
# |
| 114 |
# Functions that accept a WKT value of MultiPolygon geometry |
| 115 |
# |
| 116 |
# ST_MPolyFromWKB() |
| 117 |
SELECT ST_AsText(ST_MPolyFromWKB(@wkb_mpy)); |
| 118 |
ST_AsText(ST_MPolyFromWKB(@wkb_mpy)) |
| 119 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 120 |
# ST_MultiPolygonFromWKB() |
| 121 |
SELECT ST_AsText(ST_MultiPolygonFromWKB(@wkb_mpy)); |
| 122 |
ST_AsText(ST_MultiPolygonFromWKB(@wkb_mpy)) |
| 123 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 124 |
# |
| 125 |
# Functions that accept a WKT value of GeometryCollection geometry |
| 126 |
# |
| 127 |
# ST_GeomCollFromWKB() |
| 128 |
SELECT ST_AsText(ST_GeomCollFromWKB(@wkb_gc)); |
| 129 |
ST_AsText(ST_GeomCollFromWKB(@wkb_gc)) |
| 130 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 131 |
# ST_GeometryCollectionFromWKB() |
| 132 |
SELECT ST_AsText(ST_GeometryCollectionFromWKB(@wkb_gc)); |
| 133 |
ST_AsText(ST_GeometryCollectionFromWKB(@wkb_gc)) |
| 134 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 135 |
# |
| 136 |
# Invalid function calls |
| 137 |
# |
| 138 |
SELECT ST_GeomFromWKB(); |
| 139 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeomFromWKB' |
| 140 |
SELECT ST_GeomFromWKB(NULL); |
| 141 |
ST_GeomFromWKB(NULL) |
| 142 |
NULL |
| 143 |
SELECT ST_GeomFromWKB(ST_GeomFromText('POINT()')); |
| 144 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 145 |
SELECT ST_GeomFromWKB(ST_GeomFromText('LINESTRING(0 0,! 10)')); |
| 146 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 147 |
SELECT ST_GeometryFromWKB(); |
| 148 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeometryFromWKB' |
| 149 |
SELECT ST_GeometryFromWKB(NULL); |
| 150 |
ST_GeometryFromWKB(NULL) |
| 151 |
NULL |
| 152 |
SELECT ST_GeometryFromWKB(ST_GeomFromText('POINT(! 0)')); |
| 153 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 154 |
SELECT ST_GeometryFromWKB(ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0)')); |
| 155 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 156 |
SELECT ST_PointFromWKB(); |
| 157 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_PointFromWKB' |
| 158 |
SELECT ST_PointFromWKB(NULL); |
| 159 |
ST_PointFromWKB(NULL) |
| 160 |
NULL |
| 161 |
SELECT ST_PointFromWKB(ST_GeomFromText('POINT()')); |
| 162 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 163 |
SELECT ST_LineFromWKB(); |
| 164 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_LineFromWKB' |
| 165 |
SELECT ST_LineFromWKB(NULL); |
| 166 |
ST_LineFromWKB(NULL) |
| 167 |
NULL |
| 168 |
SELECT ST_LineFromWKB(ST_GeomFromText('LINESTRING(a a,b b)')); |
| 169 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 170 |
SELECT ST_LineStringFromWKB(); |
| 171 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_LineStringFromWKB' |
| 172 |
SELECT ST_LineStringFromWKB(NULL); |
| 173 |
ST_LineStringFromWKB(NULL) |
| 174 |
NULL |
| 175 |
SELECT ST_LineStringFromWKB(ST_GeomFromText('LINESTRING(1 1,1 b)')); |
| 176 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 177 |
SELECT ST_PolyFromWKB(); |
| 178 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_PolyFromWKB' |
| 179 |
SELECT ST_PolyFromWKB(NULL); |
| 180 |
ST_PolyFromWKB(NULL) |
| 181 |
NULL |
| 182 |
SELECT ST_PolyFromWKB(ST_GeomFromText('POLYGON(())')); |
| 183 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 184 |
SELECT ST_PolygonFromWKB(); |
| 185 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_PolygonFromWKB' |
| 186 |
SELECT ST_PolygonFromWKB(NULL); |
| 187 |
ST_PolygonFromWKB(NULL) |
| 188 |
NULL |
| 189 |
SELECT ST_PolygonFromWKB(ST_GeomFromText('POLYGON((0 0,0 5,5 5,5 0,0 0),())')); |
| 190 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 191 |
SELECT ST_MPointFromWKB(); |
| 192 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MPointFromWKB' |
| 193 |
SELECT ST_MPointFromWKB(NULL); |
| 194 |
ST_MPointFromWKB(NULL) |
| 195 |
NULL |
| 196 |
SELECT ST_MPointFromWKB(ST_GeomFromText('MULTIPOINT(0 0,1)')); |
| 197 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 198 |
SELECT ST_MultiPointFromWKB(); |
| 199 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MultiPointFromWKB' |
| 200 |
SELECT ST_MultiPointFromWKB(NULL); |
| 201 |
ST_MultiPointFromWKB(NULL) |
| 202 |
NULL |
| 203 |
SELECT ST_MultiPointFromWKB(ST_GeomFromText('MULTIPOINT(0 0,1 1 1)')); |
| 204 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 205 |
SELECT ST_MLineFromWKB(); |
| 206 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MLineFromWKB' |
| 207 |
SELECT ST_MLineFromWKB(NULL); |
| 208 |
ST_MLineFromWKB(NULL) |
| 209 |
NULL |
| 210 |
SELECT ST_MLineFromWKB(ST_GeomFromText('MULTILINESTRING((0 0,1),())')); |
| 211 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 212 |
SELECT ST_MultiLineStringFromWKB(); |
| 213 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MultiLineStringFromWKB' |
| 214 |
SELECT ST_MultiLineStringFromWKB(NULL); |
| 215 |
ST_MultiLineStringFromWKB(NULL) |
| 216 |
NULL |
| 217 |
SELECT ST_MultiLineStringFromWKB(ST_GeomFromText('MULTILINESTRING((0 0,1),(1 1,2 2)')); |
| 218 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 219 |
SELECT ST_MPolyFromWKB(); |
| 220 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MPolyFromWKB' |
| 221 |
SELECT ST_MPolyFromWKB(NULL); |
| 222 |
ST_MPolyFromWKB(NULL) |
| 223 |
NULL |
| 224 |
SELECT ST_MPolyFromWKB(ST_GeomFromText('MULTIPOLYGON(((0 0,1)),(()))')); |
| 225 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 226 |
SELECT ST_MultiPolygonFromWKB(); |
| 227 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MultiPolygonFromWKB' |
| 228 |
SELECT ST_MultiPolygonFromWKB(NULL); |
| 229 |
ST_MultiPolygonFromWKB(NULL) |
| 230 |
NULL |
| 231 |
SELECT ST_MultiPolygonFromWKB(ST_GeomFromText('MULTIPOLYGON(((0 0,0 1,1 1,1 0,0 0)),(2 2,2 3,3 3,3 2,2 2))')); |
| 232 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 233 |
SELECT ST_GeomCollFromWKB(); |
| 234 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeomCollFromWKB' |
| 235 |
SELECT ST_GeomCollFromWKB(NULL); |
| 236 |
ST_GeomCollFromWKB(NULL) |
| 237 |
NULL |
| 238 |
SELECT ST_GeomCollFromWKB(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(a a))')); |
| 239 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 240 |
SELECT ST_GeometryCollectionFromWKB(); |
| 241 |
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeometryCollectionFromWKB' |
| 242 |
SELECT ST_GeometryCollectionFromWKB(NULL); |
| 243 |
ST_GeometryCollectionFromWKB(NULL) |
| 244 |
NULL |
| 245 |
SELECT ST_GeometryCollectionFromWKB(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,1 1)')); |
| 246 |
ERROR 22023: Invalid GIS data provided to function st_geomfromtext. |
| 247 |
# |
| 248 |
# WL#8579 Spatial Reference Systems |
| 249 |
# |
| 250 |
CREATE PROCEDURE gis_wkb_funcs(IN srid INT) |
| 251 |
BEGIN |
| 252 |
SET @wkb_pt = ST_AsWKB(ST_GeomFromText('POINT(0 1)')); |
| 253 |
SET @wkb_ln = ST_AsWKB(ST_GeomFromText('LINESTRING(0 1,2 3,4 5,6 7,8 9, 10 11)')); |
| 254 |
SET @wkb_py = ST_AsWKB(ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))')); |
| 255 |
SET @wkb_mpt = ST_AsWKB(ST_GeomFromText('MULTIPOINT(0 1,2 3,4 5,6 7)')); |
| 256 |
SET @wkb_mln = ST_AsWKB(ST_GeomFromText('MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))')); |
| 257 |
SET @wkb_mpy = ST_AsWKB(ST_GeomFromText('MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),' |
| 258 |
'((10 11,10 12,12 13,12 10,10 11)))')); |
| 259 |
SET @wkb_gc = ST_AsWKB(ST_GeomFromText('GEOMETRYCOLLECTION(' |
| 260 |
'POINT(0 1),' |
| 261 |
'LINESTRING(0 1,10 11),' |
| 262 |
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),' |
| 263 |
'MULTIPOINT(0 1,2 3,4 5,6 7,8 9,10 11),' |
| 264 |
'MULTILINESTRING((0 1,10 11),(0 10,10 0)),' |
| 265 |
'MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))')); |
| 266 |
# GIS WKB functions |
| 267 |
DO ST_GeomFromWKB(@wkb_pt, srid); |
| 268 |
DO ST_GeometryFromWKB(@wkb_pt, srid); |
| 269 |
DO ST_PointFromWKB(@wkb_pt, srid); |
| 270 |
DO ST_LineFromWKB(@wkb_ln, srid); |
| 271 |
DO ST_LineStringFromWKB(@wkb_ln, srid); |
| 272 |
DO ST_PolyFromWKB(@wkb_py, srid); |
| 273 |
DO ST_PolygonFromWKB(@wkb_py, srid); |
| 274 |
DO ST_MPointFromWKB(@wkb_mpt, srid); |
| 275 |
DO ST_MultiPointFromWKB(@wkb_mpt, srid); |
| 276 |
DO ST_MLineFromWKB(@wkb_mln, srid); |
| 277 |
DO ST_MultiLineStringFromWKB(@wkb_mln, srid); |
| 278 |
DO ST_MPolyFromWKB(@wkb_mpy, srid); |
| 279 |
DO ST_MultiPolygonFromWKB(@wkb_mpy, srid); |
| 280 |
DO ST_GeomCollFromWKB(@wkb_gc, srid); |
| 281 |
DO ST_GeometryCollectionFromWKB(@wkb_gc, srid); |
| 282 |
END | |
| 283 |
# SRID 0 (should pass) |
| 284 |
CALL gis_wkb_funcs(0); |
| 285 |
# Projected SRS (should pass) |
| 286 |
CALL gis_wkb_funcs(2000); |
| 287 |
# Geographic SRS (should pass) |
| 288 |
CALL gis_wkb_funcs(4326); |
| 289 |
# Undefined SRS (should pass) |
| 290 |
CALL gis_wkb_funcs(19000000); |
| 291 |
ERROR SR001: There's no spatial reference system with SRID 19000000. |
| 292 |
######################################################################## |
| 293 |
# WL 9435 Axis order in WKB parsing functions |
| 294 |
# ST_GeomFromWKB |
| 295 |
# ST_GeometryFromWKB |
| 296 |
# ST_PointFromWKB |
| 297 |
# ST_LineFromWKB |
| 298 |
# ST_LineStringFromWKB |
| 299 |
# ST_PolyFromWKB |
| 300 |
# ST_PolygonFromWKB |
| 301 |
# ST_GeomCollFromWKB |
| 302 |
# ST_GeometryCollectionFromWKB |
| 303 |
# ST_MPointFromWKB |
| 304 |
# ST_MultiPointFromWKB |
| 305 |
# ST_MLineFromWKB |
| 306 |
# ST_MultiLineStringFromWKB |
| 307 |
# ST_MPolyFromWKB |
| 308 |
# ST_MultiPolygonFromWKB |
| 309 |
######################################################################## |
| 310 |
######################################################################## |
| 311 |
# Inserting testing SRS values in spatial reference table |
| 312 |
######################################################################## |
| 313 |
# Inserting geographical srs with long-lat ordering |
| 314 |
CREATE SPATIAL REFERENCE SYSTEM 31000000 NAME 'TEST31000000' DEFINITION 'GEOGCS["SIRGAS 1995",DATUM["Sistema de Referencia Geocentrico para America del Sur 1995",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6170"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["LONG",EAST],AXIS["LAT",NORTH],AUTHORITY["EPSG","31000000"]]'; |
| 315 |
# Inserting geographical srs with lat-long ordering |
| 316 |
CREATE SPATIAL REFERENCE SYSTEM 31100000 NAME 'TEST31100000' DEFINITION 'GEOGCS["SIRGAS 1995",DATUM["Sistema de Referencia Geocentrico para America del Sur 1995",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6170"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["LAT",NORTH],AXIS["LONG",EAST],AUTHORITY["EPSG","31100000"]]'; |
| 317 |
# Inserting projected srs with northing-easting ordering |
| 318 |
CREATE SPATIAL REFERENCE SYSTEM 31200000 NAME 'TEST31200000' DEFINITION 'PROJCS["NAD83(NSRS2007) / Virginia Lambert",GEOGCS["NAD83(NSRS2007)",DATUM["NAD83 (National Spatial Reference System 2007)",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6759"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4759"]],PROJECTION["Lambert Conic Conformal (2SP)",AUTHORITY["EPSG","9802"]],PARAMETER["Latitude of false origin",36,AUTHORITY["EPSG","8821"]],PARAMETER["Longitude of false origin",-79.5,AUTHORITY["EPSG","8822"]],PARAMETER["Latitude of 1st standard parallel",37,AUTHORITY["EPSG","8823"]],PARAMETER["Latitude of 2nd standard parallel",39.5,AUTHORITY["EPSG","8824"]],PARAMETER["Easting at false origin",0,AUTHORITY["EPSG","8826"]],PARAMETER["Northing at false origin",0,AUTHORITY["EPSG","8827"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",NORTH],AXIS["Y",EAST],AUTHORITY["EPSG","31200000"]]'; |
| 319 |
# Inserting projected srs with easting-northing ordering |
| 320 |
CREATE SPATIAL REFERENCE SYSTEM 31300000 NAME 'TEST31300000' DEFINITION 'PROJCS["NAD83(NSRS2007) / Virginia Lambert",GEOGCS["NAD83(NSRS2007)",DATUM["NAD83 (National Spatial Reference System 2007)",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6759"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4759"]],PROJECTION["Lambert Conic Conformal (2SP)",AUTHORITY["EPSG","9802"]],PARAMETER["Latitude of false origin",36,AUTHORITY["EPSG","8821"]],PARAMETER["Longitude of false origin",-79.5,AUTHORITY["EPSG","8822"]],PARAMETER["Latitude of 1st standard parallel",37,AUTHORITY["EPSG","8823"]],PARAMETER["Latitude of 2nd standard parallel",39.5,AUTHORITY["EPSG","8824"]],PARAMETER["Easting at false origin",0,AUTHORITY["EPSG","8826"]],PARAMETER["Northing at false origin",0,AUTHORITY["EPSG","8827"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","31300000"]]'; |
| 321 |
# When the geometry is in a projected spatial reference system, |
| 322 |
# the coordinates are interpreted as in the order they appear in the geometry. |
| 323 |
######################################################################## |
| 324 |
# Retrieving geometrycollections with the ST_GEOMFROMWKB function |
| 325 |
# |
| 326 |
######################################################################## |
| 327 |
# Retrieve values with long lat ordering. |
| 328 |
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(3, 5))), |
| 329 |
31000000, 'axis-order=long-lat')); |
| 330 |
ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(3, 5))), |
| 331 |
31000000, 'axis-order=long-lat')) |
| 332 |
GEOMETRYCOLLECTION(POINT(3 5)) |
| 333 |
# Retrieve values with lat-long ordering. |
| 334 |
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(3, 5))), |
| 335 |
31000000, 'axis-order=lat-long')); |
| 336 |
ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(3, 5))), |
| 337 |
31000000, 'axis-order=lat-long')) |
| 338 |
GEOMETRYCOLLECTION(POINT(5 3)) |
| 339 |
# Retrieve values with SRID-defined ordering. |
| 340 |
SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(3, 5))), |
| 341 |
31000000, 'axis-order=srid-defined')); |
| 342 |
ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(3, 5))), |
| 343 |
31000000, 'axis-order=srid-defined')) |
| 344 |
GEOMETRYCOLLECTION(POINT(3 5)) |
| 345 |
######################################################################## |
| 346 |
# Retrieving points with the ST_GEOMETRYFROMWKB function |
| 347 |
# |
| 348 |
######################################################################## |
| 349 |
# Retrieve values with long lat ordering. |
| 350 |
SELECT ST_ASTEXT(ST_GEOMETRYFROMWKB(@wkb_pt, |
| 351 |
31000000,'axis-order=long-lat')); |
| 352 |
ST_ASTEXT(ST_GEOMETRYFROMWKB(@wkb_pt, |
| 353 |
31000000,'axis-order=long-lat')) |
| 354 |
POINT(0 1) |
| 355 |
# Retrieve values with lat-long ordering. |
| 356 |
SELECT ST_ASTEXT(ST_GEOMETRYFROMWKB(@wkb_mpt, |
| 357 |
31100000,'axis-order=lat-long')); |
| 358 |
ST_ASTEXT(ST_GEOMETRYFROMWKB(@wkb_mpt, |
| 359 |
31100000,'axis-order=lat-long')) |
| 360 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 361 |
# Retrieve values with SRID-defined ordering. |
| 362 |
SELECT ST_ASTEXT(ST_GEOMETRYFROMWKB(@wkb_mpt, |
| 363 |
31200000,'axis-order=srid-defined')); |
| 364 |
ST_ASTEXT(ST_GEOMETRYFROMWKB(@wkb_mpt, |
| 365 |
31200000,'axis-order=srid-defined')) |
| 366 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 367 |
######################################################################## |
| 368 |
# Retrieving points with the ST_POINTFROMWKB function |
| 369 |
######################################################################## |
| 370 |
# Retrieve values with long lat ordering. |
| 371 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)), 31000000, 'axis-order=long-lat')); |
| 372 |
ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)), 31000000, 'axis-order=long-lat')) |
| 373 |
POINT(1 2) |
| 374 |
# Retrieve values with lat-long ordering. |
| 375 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)), 31000000, 'axis-order=lat-long')); |
| 376 |
ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)), 31000000, 'axis-order=lat-long')) |
| 377 |
POINT(2 1) |
| 378 |
# Retrieve values with SRID-defined ordering. |
| 379 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)),31000000, 'axis-order=srid-defined')); |
| 380 |
ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)),31000000, 'axis-order=srid-defined')) |
| 381 |
POINT(1 2) |
| 382 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)),31300000, 'axis-order=srid-defined')); |
| 383 |
ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)),31300000, 'axis-order=srid-defined')) |
| 384 |
POINT(1 2) |
| 385 |
######################################################################## |
| 386 |
# Retrieving linestrings with the ST_LineFromWKB function |
| 387 |
######################################################################## |
| 388 |
# Retrieve values with long lat ordering. |
| 389 |
SELECT ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31000000, |
| 390 |
'axis-order=long-lat')); |
| 391 |
ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31000000, |
| 392 |
'axis-order=long-lat')) |
| 393 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 394 |
# Retrieve values with lat-long ordering. |
| 395 |
SELECT ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31000000, |
| 396 |
'axis-order=lat-long')); |
| 397 |
ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31000000, |
| 398 |
'axis-order=lat-long')) |
| 399 |
LINESTRING(1 0,3 2,5 4,7 6,9 8,11 10) |
| 400 |
# Retrieve values with SRID-defined ordering. |
| 401 |
SELECT ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31100000, |
| 402 |
'axis-order=srid-defined')); |
| 403 |
ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31100000, |
| 404 |
'axis-order=srid-defined')) |
| 405 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 406 |
SELECT ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31000000, |
| 407 |
'axis-order=srid-defined')); |
| 408 |
ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31000000, |
| 409 |
'axis-order=srid-defined')) |
| 410 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 411 |
######################################################################## |
| 412 |
# Retrieving linestrings with the ST_LineStringFromWKB function |
| 413 |
######################################################################## |
| 414 |
# Retrieve values with long lat ordering. |
| 415 |
SELECT ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31000000, |
| 416 |
'axis-order=long-lat')); |
| 417 |
ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31000000, |
| 418 |
'axis-order=long-lat')) |
| 419 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 420 |
# Retrieve values with lat-long ordering. |
| 421 |
SELECT ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31000000, |
| 422 |
'axis-order=lat-long')); |
| 423 |
ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31000000, |
| 424 |
'axis-order=lat-long')) |
| 425 |
LINESTRING(1 0,3 2,5 4,7 6,9 8,11 10) |
| 426 |
# Retrieve values with SRID-defined ordering. |
| 427 |
SELECT ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31100000, |
| 428 |
'axis-order=srid-defined')); |
| 429 |
ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31100000, |
| 430 |
'axis-order=srid-defined')) |
| 431 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 432 |
SELECT ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31000000, |
| 433 |
'axis-order=srid-defined')); |
| 434 |
ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31000000, |
| 435 |
'axis-order=srid-defined')) |
| 436 |
LINESTRING(0 1,2 3,4 5,6 7,8 9,10 11) |
| 437 |
######################################################################## |
| 438 |
# Retrieving polygons with the ST_POLYFROMWKB function |
| 439 |
# |
| 440 |
######################################################################## |
| 441 |
# Retrieve values with long lat ordering. |
| 442 |
SELECT ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31000000, |
| 443 |
'axis-order=long-lat')); |
| 444 |
ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31000000, |
| 445 |
'axis-order=long-lat')) |
| 446 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 447 |
# Retrieve values with lat-long ordering. |
| 448 |
SELECT ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31000000, |
| 449 |
'axis-order=lat-long')); |
| 450 |
ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31000000, |
| 451 |
'axis-order=lat-long')) |
| 452 |
POLYGON((0 0,10 0,10 10,0 10,0 0),(4 4,6 4,6 6,4 6,4 4)) |
| 453 |
# Retrieve values with SRID-defined ordering. |
| 454 |
SELECT ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31000000, |
| 455 |
'axis-order=srid-defined')); |
| 456 |
ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31000000, |
| 457 |
'axis-order=srid-defined')) |
| 458 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 459 |
SELECT ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31300000, |
| 460 |
'axis-order=srid-defined')); |
| 461 |
ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31300000, |
| 462 |
'axis-order=srid-defined')) |
| 463 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 464 |
######################################################################## |
| 465 |
# Retrieving polygons with the ST_POLYGONFROMWKB function |
| 466 |
# |
| 467 |
######################################################################## |
| 468 |
# Retrieve values with long lat ordering. |
| 469 |
SELECT ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31000000, |
| 470 |
'axis-order=long-lat')); |
| 471 |
ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31000000, |
| 472 |
'axis-order=long-lat')) |
| 473 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 474 |
# Retrieve values with lat-long ordering. |
| 475 |
SELECT ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31000000, |
| 476 |
'axis-order=lat-long')); |
| 477 |
ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31000000, |
| 478 |
'axis-order=lat-long')) |
| 479 |
POLYGON((0 0,10 0,10 10,0 10,0 0),(4 4,6 4,6 6,4 6,4 4)) |
| 480 |
# Retrieve values with SRID-defined ordering. |
| 481 |
SELECT ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31000000, |
| 482 |
'axis-order=srid-defined')); |
| 483 |
ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31000000, |
| 484 |
'axis-order=srid-defined')) |
| 485 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 486 |
SELECT ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31300000, |
| 487 |
'axis-order=srid-defined')); |
| 488 |
ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31300000, |
| 489 |
'axis-order=srid-defined')) |
| 490 |
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)) |
| 491 |
######################################################################## |
| 492 |
# Retrieving geometrycollections with the ST_GEOMCOLLFROMWKB function |
| 493 |
# |
| 494 |
######################################################################## |
| 495 |
# Retrieve values with long lat ordering. |
| 496 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=long-lat')); |
| 497 |
ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=long-lat')) |
| 498 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 499 |
# Retrieve values with lat-long ordering. |
| 500 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=lat-long')); |
| 501 |
ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=lat-long')) |
| 502 |
GEOMETRYCOLLECTION(POINT(1 0),LINESTRING(1 0,11 10),POLYGON((0 0,10 0,10 10,0 10,0 0)),MULTIPOINT((1 0),(3 2),(5 4),(7 6),(9 8),(11 10)),MULTILINESTRING((1 0,11 10),(10 0,0 10)),MULTIPOLYGON(((1 0,5 0,6 5,0 5,1 0)),((4 5,10 5,11 10,5 10,4 5)))) |
| 503 |
# Retrieve values with SRID-defined ordering. |
| 504 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=srid-defined')); |
| 505 |
ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=srid-defined')) |
| 506 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 507 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31300000,'axis-order=srid-defined')); |
| 508 |
ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31300000,'axis-order=srid-defined')) |
| 509 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 510 |
######################################################################## |
| 511 |
# Retrieving geometrycollections with the ST_GEOMETRYCOLLECTIONFROMWKB function |
| 512 |
# |
| 513 |
######################################################################## |
| 514 |
# Retrieve values with long lat ordering. |
| 515 |
SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, |
| 516 |
31000000,'axis-order=long-lat')); |
| 517 |
ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, |
| 518 |
31000000,'axis-order=long-lat')) |
| 519 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 520 |
# Retrieve values with lat-long ordering. |
| 521 |
SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, |
| 522 |
31000000,'axis-order=lat-long')); |
| 523 |
ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, |
| 524 |
31000000,'axis-order=lat-long')) |
| 525 |
GEOMETRYCOLLECTION(POINT(1 0),LINESTRING(1 0,11 10),POLYGON((0 0,10 0,10 10,0 10,0 0)),MULTIPOINT((1 0),(3 2),(5 4),(7 6),(9 8),(11 10)),MULTILINESTRING((1 0,11 10),(10 0,0 10)),MULTIPOLYGON(((1 0,5 0,6 5,0 5,1 0)),((4 5,10 5,11 10,5 10,4 5)))) |
| 526 |
# Retrieve values with SRID-defined ordering. |
| 527 |
SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, |
| 528 |
31000000,'axis-order=srid-defined')); |
| 529 |
ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, |
| 530 |
31000000,'axis-order=srid-defined')) |
| 531 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 532 |
SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, |
| 533 |
31300000,'axis-order=srid-defined')); |
| 534 |
ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, |
| 535 |
31300000,'axis-order=srid-defined')) |
| 536 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 537 |
######################################################################## |
| 538 |
# Retrieving multipoints with the ST_MPOINTFROMWKB function |
| 539 |
# |
| 540 |
######################################################################## |
| 541 |
# Retrieve values with long lat ordering. |
| 542 |
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, |
| 543 |
31000000,'axis-order=long-lat')); |
| 544 |
ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, |
| 545 |
31000000,'axis-order=long-lat')) |
| 546 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 547 |
# Retrieve values with lat-long ordering. |
| 548 |
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, |
| 549 |
31000000,'axis-order=lat-long')); |
| 550 |
ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, |
| 551 |
31000000,'axis-order=lat-long')) |
| 552 |
MULTIPOINT((1 0),(3 2),(5 4),(7 6)) |
| 553 |
# Retrieve values with SRID-defined ordering. |
| 554 |
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, |
| 555 |
31000000,'axis-order=srid-defined')); |
| 556 |
ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, |
| 557 |
31000000,'axis-order=srid-defined')) |
| 558 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 559 |
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, |
| 560 |
31300000,'axis-order=srid-defined')); |
| 561 |
ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, |
| 562 |
31300000,'axis-order=srid-defined')) |
| 563 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 564 |
######################################################################## |
| 565 |
# Retrieving multipoints with the ST_MULTIPOINTFROMWKB function |
| 566 |
# |
| 567 |
######################################################################## |
| 568 |
# Retrieve values with long lat ordering. |
| 569 |
SELECT ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, |
| 570 |
31000000,'axis-order=long-lat')); |
| 571 |
ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, |
| 572 |
31000000,'axis-order=long-lat')) |
| 573 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 574 |
# Retrieve values with lat-long ordering. |
| 575 |
SELECT ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, |
| 576 |
31000000,'axis-order=lat-long')); |
| 577 |
ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, |
| 578 |
31000000,'axis-order=lat-long')) |
| 579 |
MULTIPOINT((1 0),(3 2),(5 4),(7 6)) |
| 580 |
# Retrieve values with SRID-defined ordering. |
| 581 |
SELECT ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, |
| 582 |
31000000,'axis-order=srid-defined')); |
| 583 |
ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, |
| 584 |
31000000,'axis-order=srid-defined')) |
| 585 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 586 |
SELECT ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, |
| 587 |
31300000,'axis-order=srid-defined')); |
| 588 |
ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, |
| 589 |
31300000,'axis-order=srid-defined')) |
| 590 |
MULTIPOINT((0 1),(2 3),(4 5),(6 7)) |
| 591 |
######################################################################## |
| 592 |
# Retrieving multistrings with the ST_MLINEFROMWKB function |
| 593 |
# |
| 594 |
######################################################################## |
| 595 |
# Retrieve values with long lat ordering. |
| 596 |
SELECT ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31000000,'axis-order=long-lat')); |
| 597 |
ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31000000,'axis-order=long-lat')) |
| 598 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 599 |
# Retrieve values with lat-long ordering. |
| 600 |
SELECT ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31000000,'axis-order=lat-long')); |
| 601 |
ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31000000,'axis-order=lat-long')) |
| 602 |
MULTILINESTRING((1 0,3 2,5 4),(7 6,9 8,11 10)) |
| 603 |
# Retrieve values with SRID-defined ordering. |
| 604 |
SELECT ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31000000,'axis-order=srid-defined')); |
| 605 |
ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31000000,'axis-order=srid-defined')) |
| 606 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 607 |
SELECT ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31300000,'axis-order=srid-defined')); |
| 608 |
ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31300000,'axis-order=srid-defined')) |
| 609 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 610 |
######################################################################## |
| 611 |
# Retrieving multistrings with the ST_MULTILINESTRINGFROMWKB function |
| 612 |
# |
| 613 |
######################################################################## |
| 614 |
# Retrieve values with long lat ordering. |
| 615 |
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, |
| 616 |
31000000,'axis-order=long-lat')); |
| 617 |
ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, |
| 618 |
31000000,'axis-order=long-lat')) |
| 619 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 620 |
# Retrieve values with lat-long ordering. |
| 621 |
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, |
| 622 |
31000000,'axis-order=lat-long')); |
| 623 |
ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, |
| 624 |
31000000,'axis-order=lat-long')) |
| 625 |
MULTILINESTRING((1 0,3 2,5 4),(7 6,9 8,11 10)) |
| 626 |
# Retrieve values with SRID-defined ordering. |
| 627 |
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, |
| 628 |
31000000,'axis-order=srid-defined')); |
| 629 |
ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, |
| 630 |
31000000,'axis-order=srid-defined')) |
| 631 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 632 |
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, |
| 633 |
31300000,'axis-order=srid-defined')); |
| 634 |
ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, |
| 635 |
31300000,'axis-order=srid-defined')) |
| 636 |
MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11)) |
| 637 |
######################################################################## |
| 638 |
# Retrieving multipolygons with the ST_MPOLYFROMWKB function |
| 639 |
# |
| 640 |
######################################################################## |
| 641 |
# Retrieve values with long lat ordering. |
| 642 |
SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31000000, 'axis-order=long-lat')); |
| 643 |
ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31000000, 'axis-order=long-lat')) |
| 644 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 645 |
# Retrieve values with lat-long ordering. |
| 646 |
SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31000000, 'axis-order=lat-long')); |
| 647 |
ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31000000, 'axis-order=lat-long')) |
| 648 |
MULTIPOLYGON(((1 0,10 0,11 10,0 10,1 0),(5 4,6 4,7 6,4 6,5 4)),((11 10,12 10,13 12,10 12,11 10))) |
| 649 |
# Retrieve values with SRID-defined ordering. |
| 650 |
SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, |
| 651 |
31000000, 'axis-order=srid-defined')); |
| 652 |
ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, |
| 653 |
31000000, 'axis-order=srid-defined')) |
| 654 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 655 |
SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, |
| 656 |
31300000, 'axis-order=srid-defined')); |
| 657 |
ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, |
| 658 |
31300000, 'axis-order=srid-defined')) |
| 659 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 660 |
######################################################################## |
| 661 |
# Retrieving multipolygons with the ST_MULTIPOLYGONFROMWKB function |
| 662 |
# |
| 663 |
######################################################################## |
| 664 |
# Retrieve values with long lat ordering. |
| 665 |
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'axis-order=long-lat')); |
| 666 |
ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'axis-order=long-lat')) |
| 667 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 668 |
# Retrieve values with lat-long ordering. |
| 669 |
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'axis-order=lat-long')); |
| 670 |
ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'axis-order=lat-long')) |
| 671 |
MULTIPOLYGON(((1 0,10 0,11 10,0 10,1 0),(5 4,6 4,7 6,4 6,5 4)),((11 10,12 10,13 12,10 12,11 10))) |
| 672 |
# Retrieve values with SRID-defined ordering. |
| 673 |
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, |
| 674 |
31000000, 'axis-order=srid-defined')); |
| 675 |
ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, |
| 676 |
31000000, 'axis-order=srid-defined')) |
| 677 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 678 |
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, |
| 679 |
31300000, 'axis-order=srid-defined')); |
| 680 |
ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, |
| 681 |
31300000, 'axis-order=srid-defined')) |
| 682 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 683 |
######################################################################## |
| 684 |
# Error testing |
| 685 |
######################################################################## |
| 686 |
# Test with too many options. |
| 687 |
SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31000000, |
| 688 |
'axis-order=srid-defined, axis-order=lat-long')); |
| 689 |
ERROR 22023: Duplicate option key 'axis-order' in funtion 'st_mpolyfromwkb'. |
| 690 |
# Test with invalid options key. |
| 691 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 692 |
31000000,'axix-order=srid-defined')); |
| 693 |
ERROR 22023: Invalid option key 'axix-order' in function st_geomcollfromwkb. |
| 694 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 695 |
31000000,'axix-order=lat-long')); |
| 696 |
ERROR 22023: Invalid option key 'axix-order' in function st_geomcollfromwkb. |
| 697 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 698 |
31000000,'axix-order=lat-long')); |
| 699 |
ERROR 22023: Invalid option key 'axix-order' in function st_geomcollfromwkb. |
| 700 |
# Test with invalid options value |
| 701 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 702 |
31300000,'axis-order=srid-dfined')); |
| 703 |
ERROR 22023: Invalid value 'srid-dfined' for option 'axis-order' in function 'st_geomcollfromwkb'. |
| 704 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 705 |
31000000,'axis-order=lat-bong')); |
| 706 |
ERROR 22023: Invalid value 'lat-bong' for option 'axis-order' in function 'st_geomcollfromwkb'. |
| 707 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 708 |
31000000,'axis-order=lat-shwong')); |
| 709 |
ERROR 22023: Invalid value 'lat-shwong' for option 'axis-order' in function 'st_geomcollfromwkb'. |
| 710 |
# Test with both invalid option and invalid value |
| 711 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 712 |
31000000,'axis-border=lat-shwong')); |
| 713 |
ERROR 22023: Invalid option key 'axis-border' in function st_geomcollfromwkb. |
| 714 |
# Testing for badly formed options argument. |
| 715 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 716 |
31000000,'axis-order srid-defined')); |
| 717 |
ERROR 22023: The string 'axis-order srid-defined' is not a valid key = value pair in function st_geomcollfromwkb. |
| 718 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 719 |
31000000,'=axis-order srid-defined')); |
| 720 |
ERROR 22023: The options argument in function st_geomcollfromwkb starts with the invalid character '='. |
| 721 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 722 |
31000000,'axis-order=srid-defined=')); |
| 723 |
ERROR 22023: The options argument in function st_geomcollfromwkb ends with the invalid character '='. |
| 724 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 725 |
31000000,'axis-order== srid-defined')); |
| 726 |
ERROR 22023: The options argument in function st_geomcollfromwkb contains the invalid character sequence '=='. |
| 727 |
# ###################################################################### |
| 728 |
# Empty string and white space testing |
| 729 |
# ###################################################################### |
| 730 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'')); |
| 731 |
ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'')) |
| 732 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 733 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,' ')); |
| 734 |
ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,' ')) |
| 735 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 736 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 737 |
31000000,' axis-order = srid-defined ')); |
| 738 |
ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, |
| 739 |
31000000,' axis-order = srid-defined ')) |
| 740 |
GEOMETRYCOLLECTION(POINT(0 1),LINESTRING(0 1,10 11),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 1),(2 3),(4 5),(6 7),(8 9),(10 11)),MULTILINESTRING((0 1,10 11),(0 10,10 0)),MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4)))) |
| 741 |
######################################################################## |
| 742 |
# Case insensitive testing in otions argument |
| 743 |
# (both option keys and values) |
| 744 |
######################################################################## |
| 745 |
# Retrieve values with long lat ordering. |
| 746 |
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'aXis-Order=LONG-LAT')); |
| 747 |
ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'aXis-Order=LONG-LAT')) |
| 748 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 749 |
# Retrieve values with lat-long ordering. |
| 750 |
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'AXis-OrdEr=Lat-Long')); |
| 751 |
ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'AXis-OrdEr=Lat-Long')) |
| 752 |
MULTIPOLYGON(((1 0,10 0,11 10,0 10,1 0),(5 4,6 4,7 6,4 6,5 4)),((11 10,12 10,13 12,10 12,11 10))) |
| 753 |
# Retrieve values with SRID-defined ordering. |
| 754 |
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, |
| 755 |
31000000, 'Axis-Order=sRid-dEfined')); |
| 756 |
ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, |
| 757 |
31000000, 'Axis-Order=sRid-dEfined')) |
| 758 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 759 |
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, |
| 760 |
31300000, 'aXiS-oRdeR=sriD-dEfinEd')); |
| 761 |
ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, |
| 762 |
31300000, 'aXiS-oRdeR=sriD-dEfinEd')) |
| 763 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 764 |
# ###################################################################### |
| 765 |
# NULL value and 0 value srid testing |
| 766 |
# ###################################################################### |
| 767 |
# NULL value testing: Should return NULL if either or both parameters is NULL |
| 768 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(NULL,31000000, 'axis-order=long-lat')); |
| 769 |
ST_ASTEXT(ST_POINTFROMWKB(NULL,31000000, 'axis-order=long-lat')) |
| 770 |
NULL |
| 771 |
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, NULL, 'axis-order=lat-long')); |
| 772 |
ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, NULL, 'axis-order=lat-long')) |
| 773 |
NULL |
| 774 |
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, 31000000, NULL)); |
| 775 |
ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, 31000000, NULL)) |
| 776 |
NULL |
| 777 |
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, NULL, NULL)); |
| 778 |
ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, NULL, NULL)) |
| 779 |
NULL |
| 780 |
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(NULL, NULL, NULL)); |
| 781 |
ST_ASTEXT(ST_MPOINTFROMWKB(NULL, NULL, NULL)) |
| 782 |
NULL |
| 783 |
# Coordinates are interpreted as in the order they appear in the geometry |
| 784 |
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 0, 'axis-order=srid-defined')); |
| 785 |
ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 0, 'axis-order=srid-defined')) |
| 786 |
MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),((10 11,10 12,12 13,12 10,10 11))) |
| 787 |
########################################################## |
| 788 |
# Inserting testing SRS values in spatial reference table |
| 789 |
########################################################## |
| 790 |
# Inserting geographical srs with long-lat ordering |
| 791 |
CREATE SPATIAL REFERENCE SYSTEM 32000000 NAME 'TEST32000000' DEFINITION 'GEOGCS["SIRGAS 1995",DATUM["Sistema de Referencia Geocentrico para America del Sur 1995",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6170"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["LONG",EAST],AXIS["LAT",NORTH],AUTHORITY["EPSG","32000000"]]'; |
| 792 |
# Inserting geographical srs with lat-long ordering |
| 793 |
CREATE SPATIAL REFERENCE SYSTEM 32100000 NAME 'TEST32100000' DEFINITION 'GEOGCS["SIRGAS 1995",DATUM["Sistema de Referencia Geocentrico para America del Sur 1995",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6170"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["LAT",NORTH],AXIS["LONG",EAST],AUTHORITY["EPSG","32100000"]]'; |
| 794 |
# Inserting projected srs with northing-easting ordering |
| 795 |
CREATE SPATIAL REFERENCE SYSTEM 32200000 NAME 'TEST32200000' DEFINITION 'PROJCS["NAD83(NSRS2007) / Virginia Lambert",GEOGCS["NAD83(NSRS2007)",DATUM["NAD83 (National Spatial Reference System 2007)",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6759"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4759"]],PROJECTION["Lambert Conic Conformal (2SP)",AUTHORITY["EPSG","9802"]],PARAMETER["Latitude of false origin",36,AUTHORITY["EPSG","8821"]],PARAMETER["Longitude of false origin",-79.5,AUTHORITY["EPSG","8822"]],PARAMETER["Latitude of 1st standard parallel",37,AUTHORITY["EPSG","8823"]],PARAMETER["Latitude of 2nd standard parallel",39.5,AUTHORITY["EPSG","8824"]],PARAMETER["Easting at false origin",0,AUTHORITY["EPSG","8826"]],PARAMETER["Northing at false origin",0,AUTHORITY["EPSG","8827"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",NORTH],AXIS["Y",EAST],AUTHORITY["EPSG","32200000"]]'; |
| 796 |
######################################################################### |
| 797 |
# Test with geometries with geographic SRS with long-lat ordering outside |
| 798 |
# valid range. |
| 799 |
######################################################################### |
| 800 |
SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-200 10)', 0)), 32000000); |
| 801 |
ERROR 22S02: Longitude -200.000000 is out of range in function st_pointfromwkb. It must be within (-180.000000, 180.000000]. |
| 802 |
SELECT ST_LINEFROMWKB(ST_ASWKB(ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)', 0)), 32000000); |
| 803 |
ERROR 22S02: Longitude 194.000000 is out of range in function st_linefromwkb. It must be within (-180.000000, 180.000000]. |
| 804 |
SELECT ST_POLYFROMWKB(ST_ASWKB(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',0)), 32000000); |
| 805 |
ERROR 22S02: Longitude -300.000000 is out of range in function st_polyfromwkb. It must be within (-180.000000, 180.000000]. |
| 806 |
SELECT ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (-344 9))',0)),32000000); |
| 807 |
ERROR 22S02: Longitude 798.000000 is out of range in function st_mpointfromwkb. It must be within (-180.000000, 180.000000]. |
| 808 |
SELECT ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',0)),32000000); |
| 809 |
ERROR 22S02: Longitude 744.000000 is out of range in function st_mlinefromwkb. It must be within (-180.000000, 180.000000]. |
| 810 |
SELECT ST_MPOLYFROMWKB(ST_ASWKB(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,350 0,350 350,0 350,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',0)),32000000); |
| 811 |
ERROR 22S02: Longitude 350.000000 is out of range in function st_mpolyfromwkb. It must be within (-180.000000, 180.000000]. |
| 812 |
SELECT ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(-199 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',0)), 32000000); |
| 813 |
ERROR 22S02: Longitude -199.000000 is out of range in function st_geomcollfromwkb. It must be within (-180.000000, 180.000000]. |
| 814 |
######################################################################### |
| 815 |
# Test with geometries with geographic SRS with lat-long ordering outside |
| 816 |
# valid range (same geometries as above, but with different error since |
| 817 |
# coordinates are flipped). |
| 818 |
######################################################################### |
| 819 |
SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-200 10)',0)),32100000); |
| 820 |
ERROR 22S03: Latitude -200.000000 is out of range in function st_pointfromwkb. It must be within [-90.000000, 90.000000]. |
| 821 |
SELECT ST_LINEFROMWKB(ST_ASWKB(ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)',0)),32100000); |
| 822 |
ERROR 22S03: Latitude 194.000000 is out of range in function st_linefromwkb. It must be within [-90.000000, 90.000000]. |
| 823 |
SELECT ST_POLYFROMWKB(ST_ASWKB(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',0)),32100000); |
| 824 |
ERROR 22S03: Latitude -300.000000 is out of range in function st_polyfromwkb. It must be within [-90.000000, 90.000000]. |
| 825 |
SELECT ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (4 9))',0)),32100000); |
| 826 |
ERROR 22S03: Latitude 798.000000 is out of range in function st_mpointfromwkb. It must be within [-90.000000, 90.000000]. |
| 827 |
SELECT ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',0)),32100000); |
| 828 |
ERROR 22S03: Latitude 744.000000 is out of range in function st_mlinefromwkb. It must be within [-90.000000, 90.000000]. |
| 829 |
SELECT ST_MPOLYFROMWKB(ST_ASWKB(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,350 0,350 350,0 350,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',0)),32100000); |
| 830 |
ERROR 22S03: Latitude 350.000000 is out of range in function st_mpolyfromwkb. It must be within [-90.000000, 90.000000]. |
| 831 |
SELECT ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(-199 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',0)), 32100000); |
| 832 |
ERROR 22S03: Latitude -199.000000 is out of range in function st_geomcollfromwkb. It must be within [-90.000000, 90.000000]. |
| 833 |
############################## |
| 834 |
# Miscellaneous error testing |
| 835 |
############################## |
| 836 |
SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-91 10)',0)),32100000); |
| 837 |
ERROR 22S03: Latitude -91.000000 is out of range in function st_pointfromwkb. It must be within [-90.000000, 90.000000]. |
| 838 |
SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 -182)',0)),32100000); |
| 839 |
ERROR 22S02: Longitude -182.000000 is out of range in function st_pointfromwkb. It must be within (-180.000000, 180.000000]. |
| 840 |
SELECT ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 91,14 17))',0)),32000000); |
| 841 |
ERROR 22S02: Longitude 744.000000 is out of range in function st_mlinefromwkb. It must be within (-180.000000, 180.000000]. |
| 842 |
SELECT ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 95,2 4,4 6),(744 11,11 91,14 17))',0)),32000000); |
| 843 |
ERROR 22S03: Latitude 95.000000 is out of range in function st_mlinefromwkb. It must be within [-90.000000, 90.000000]. |
| 844 |
################### |
| 845 |
# Edge case testing |
| 846 |
################### |
| 847 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-90.0000000 10)',0)),32100000)); |
| 848 |
ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-90.0000000 10)',0)),32100000)) |
| 849 |
POINT(-90 10) |
| 850 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 -180.0000000)',0)),32100000)); |
| 851 |
ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 -180.0000000)',0)),32100000)) |
| 852 |
POINT(10 -180) |
| 853 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(90.0000000 10)',0)),32100000)); |
| 854 |
ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(90.0000000 10)',0)),32100000)) |
| 855 |
POINT(90 10) |
| 856 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 180.0000000)',0)),32100000)); |
| 857 |
ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 180.0000000)',0)),32100000)) |
| 858 |
POINT(10 180) |
| 859 |
SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-90.0000001 10)',0)),32100000); |
| 860 |
ERROR 22S03: Latitude -90.000000 is out of range in function st_pointfromwkb. It must be within [-90.000000, 90.000000]. |
| 861 |
SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 -180.0000001)',0)),32100000); |
| 862 |
ERROR 22S02: Longitude -180.000000 is out of range in function st_pointfromwkb. It must be within (-180.000000, 180.000000]. |
| 863 |
SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(90.0000001 10)',0)),32100000); |
| 864 |
ERROR 22S03: Latitude 90.000000 is out of range in function st_pointfromwkb. It must be within [-90.000000, 90.000000]. |
| 865 |
SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 180.0000001)',0)),32100000); |
| 866 |
ERROR 22S02: Longitude 180.000000 is out of range in function st_pointfromwkb. It must be within (-180.000000, 180.000000]. |
| 867 |
################################################################# |
| 868 |
# Test that range restriction does not apply to projected spatial |
| 869 |
# reference systems |
| 870 |
################################################################# |
| 871 |
SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-200 10)',0)),32200000)); |
| 872 |
ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-200 10)',0)),32200000)) |
| 873 |
POINT(-200 10) |
| 874 |
SELECT ST_ASTEXT(ST_LINEFROMWKB(ST_ASWKB(ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)',0)),32200000)); |
| 875 |
ST_ASTEXT(ST_LINEFROMWKB(ST_ASWKB(ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)',0)),32200000)) |
| 876 |
LINESTRING(0 5,194 10,10 15) |
| 877 |
SELECT ST_ASTEXT(ST_POLYFROMWKB(ST_ASWKB(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',0)),32200000)); |
| 878 |
ST_ASTEXT(ST_POLYFROMWKB(ST_ASWKB(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',0)),32200000)) |
| 879 |
POLYGON((0 0,5 0,5 5,-300 5,0 0)) |
| 880 |
SELECT ST_ASTEXT(ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (4 9))',0)),32200000)); |
| 881 |
ST_ASTEXT(ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (4 9))',0)),32200000)) |
| 882 |
MULTIPOINT((0 2),(5 7),(798 2),(4 9)) |
| 883 |
SELECT ST_ASTEXT(ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',0)),32200000)); |
| 884 |
ST_ASTEXT(ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',0)),32200000)) |
| 885 |
MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17)) |
| 886 |
SELECT ST_ASTEXT(ST_MPOLYFROMWKB(ST_ASWKB(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,350 0,350 350,0 350,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',0)),32200000)); |
| 887 |
ST_ASTEXT(ST_MPOLYFROMWKB(ST_ASWKB(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,350 0,350 350,0 350,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',0)),32200000)) |
| 888 |
MULTIPOLYGON(((0 0,350 0,350 350,0 350,0 0),(4 4,4 6,6 6,6 4,4 4)),((0 0,-2 -2,0 -2,0 0))) |
| 889 |
SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(-199 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',0)), 32200000)); |
| 890 |
ST_ASTEXT(ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(-199 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',0)), 32200000)) |
| 891 |
GEOMETRYCOLLECTION(POINT(-199 5),POLYGON((0 0,10 0,10 10,0 10,0 0)),MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4,4 4)),((0 0,-2 -2,0 -2,0 0)))) |
| 892 |
# Clean up |
| 893 |
DROP PROCEDURE gis_wkb_funcs; |
| 894 |
DROP SPATIAL REFERENCE SYSTEM 31000000; |
| 895 |
DROP SPATIAL REFERENCE SYSTEM 31100000; |
| 896 |
DROP SPATIAL REFERENCE SYSTEM 31200000; |
| 897 |
DROP SPATIAL REFERENCE SYSTEM 31300000; |
| 898 |
DROP SPATIAL REFERENCE SYSTEM 32000000; |
| 899 |
DROP SPATIAL REFERENCE SYSTEM 32100000; |
| 900 |
DROP SPATIAL REFERENCE SYSTEM 32200000; |
| 901 |
# |
| 902 |
# WL#11096 Don't do Cartesian computations on geographic geometries |
| 903 |
# |
| 904 |
# Assume SRID 10 is not defined. Should raise warning. |
| 905 |
DO ST_ASBINARY(x'0A000000010100000000000000000000000000000000000000'); |
| 906 |
Warnings: |
| 907 |
Warning 3565 There's no spatial reference system with SRID 10. The axis order is unknown. |
| 908 |
DO ST_ASWKB(x'0A000000010100000000000000000000000000000000000000'); |
| 909 |
Warnings: |
| 910 |
Warning 3565 There's no spatial reference system with SRID 10. The axis order is unknown. |