1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242
|
SET @wkt_pt = 'POINT(0 0)';
SET @wkt_ln = 'LINESTRING(0 0,2 2,4 4,6 6,8 8, 10 10)';
SET @wkt_py = 'POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))';
SET @wkt_mpt = 'MULTIPOINT(0 0,2 2,4 4,6 6)';
SET @wkt_mln = 'MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))';
SET @wkt_mpy = 'MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),'
'((10 10,10 12,12 12,12 10,10 10)))';
SET @wkt_gc = 'GEOMETRYCOLLECTION('
'POINT(0 0),'
'LINESTRING(0 0,10 10),'
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),'
'MULTIPOINT(0 0,2 2,4 4,6 6,8 8,10 10),'
'MULTILINESTRING((0 0,10 10),(0 10,10 0)),'
'MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))';
#
# Functions that accept a WKT value of any geometry type.
#
# ST_GeomFromText()
SELECT ST_AsText(ST_GeomFromText(@wkt_pt));
ST_AsText(ST_GeomFromText(@wkt_pt))
POINT(0 0)
SELECT ST_AsText(ST_GeomFromText(@wkt_ln));
ST_AsText(ST_GeomFromText(@wkt_ln))
LINESTRING(0 0,2 2,4 4,6 6,8 8,10 10)
SELECT ST_AsText(ST_GeomFromText(@wkt_py));
ST_AsText(ST_GeomFromText(@wkt_py))
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
SELECT ST_AsText(ST_GeomFromText(@wkt_mpt));
ST_AsText(ST_GeomFromText(@wkt_mpt))
MULTIPOINT((0 0),(2 2),(4 4),(6 6))
SELECT ST_AsText(ST_GeomFromText(@wkt_mln));
ST_AsText(ST_GeomFromText(@wkt_mln))
MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))
SELECT ST_AsText(ST_GeomFromText(@wkt_mpy));
ST_AsText(ST_GeomFromText(@wkt_mpy))
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((10 10,10 12,12 12,12 10,10 10)))
SELECT ST_AsText(ST_GeomFromText(@wkt_gc));
ST_AsText(ST_GeomFromText(@wkt_gc))
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 0),(2 2),(4 4),(6 6),(8 8),(10 10)),MULTILINESTRING((0 0,10 10),(0 10,10 0)),MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))
# ST_GeometryFromText()
SELECT ST_AsText(ST_GeometryFromText(@wkt_pt));
ST_AsText(ST_GeometryFromText(@wkt_pt))
POINT(0 0)
SELECT ST_AsText(ST_GeometryFromText(@wkt_ln));
ST_AsText(ST_GeometryFromText(@wkt_ln))
LINESTRING(0 0,2 2,4 4,6 6,8 8,10 10)
SELECT ST_AsText(ST_GeometryFromText(@wkt_py));
ST_AsText(ST_GeometryFromText(@wkt_py))
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
SELECT ST_AsText(ST_GeometryFromText(@wkt_mpt));
ST_AsText(ST_GeometryFromText(@wkt_mpt))
MULTIPOINT((0 0),(2 2),(4 4),(6 6))
SELECT ST_AsText(ST_GeometryFromText(@wkt_mln));
ST_AsText(ST_GeometryFromText(@wkt_mln))
MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))
SELECT ST_AsText(ST_GeometryFromText(@wkt_mpy));
ST_AsText(ST_GeometryFromText(@wkt_mpy))
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((10 10,10 12,12 12,12 10,10 10)))
SELECT ST_AsText(ST_GeometryFromText(@wkt_gc));
ST_AsText(ST_GeometryFromText(@wkt_gc))
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 0),(2 2),(4 4),(6 6),(8 8),(10 10)),MULTILINESTRING((0 0,10 10),(0 10,10 0)),MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))
#
# Function that accepts a WKT value of Point geometry
#
# ST_PointFromText()
SELECT ST_AsText(ST_PointFromText(@wkt_pt));
ST_AsText(ST_PointFromText(@wkt_pt))
POINT(0 0)
#
# Functions that accept a WKT value of LineString geometry
#
# ST_LineFromText()
SELECT ST_AsText(ST_LineFromText(@wkt_ln));
ST_AsText(ST_LineFromText(@wkt_ln))
LINESTRING(0 0,2 2,4 4,6 6,8 8,10 10)
# ST_LineStringFromText()
SELECT ST_AsText(ST_LineStringFromText(@wkt_ln));
ST_AsText(ST_LineStringFromText(@wkt_ln))
LINESTRING(0 0,2 2,4 4,6 6,8 8,10 10)
#
# Functions that accept a WKT value of Polygon geometry
#
# ST_PolyFromText()
SELECT ST_AsText(ST_PolyFromText(@wkt_py));
ST_AsText(ST_PolyFromText(@wkt_py))
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
# ST_PolygonFromText()
SELECT ST_AsText(ST_PolygonFromText(@wkt_py));
ST_AsText(ST_PolygonFromText(@wkt_py))
POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))
#
# Functions that accept a WKT value of MultiPoint geometry
#
# ST_MPointFromText()
SELECT ST_AsText(ST_MPointFromText(@wkt_mpt));
ST_AsText(ST_MPointFromText(@wkt_mpt))
MULTIPOINT((0 0),(2 2),(4 4),(6 6))
# ST_MultiPointFromText()
SELECT ST_AsText(ST_MultiPointFromText(@wkt_mpt));
ST_AsText(ST_MultiPointFromText(@wkt_mpt))
MULTIPOINT((0 0),(2 2),(4 4),(6 6))
#
# Functions that accept a WKT value of MultiLineString geometry
#
# ST_MLineFromText()
SELECT ST_AsText(ST_MLineFromText(@wkt_mln));
ST_AsText(ST_MLineFromText(@wkt_mln))
MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))
# ST_MultiLineStringFromText()
SELECT ST_AsText(ST_MultiLineStringFromText(@wkt_mln));
ST_AsText(ST_MultiLineStringFromText(@wkt_mln))
MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))
#
# Functions that accept a WKT value of MultiPolygon geometry
#
# ST_MPolyFromText()
SELECT ST_AsText(ST_MPolyFromText(@wkt_mpy));
ST_AsText(ST_MPolyFromText(@wkt_mpy))
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((10 10,10 12,12 12,12 10,10 10)))
# ST_MultiPolygonFromText()
SELECT ST_AsText(ST_MultiPolygonFromText(@wkt_mpy));
ST_AsText(ST_MultiPolygonFromText(@wkt_mpy))
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((10 10,10 12,12 12,12 10,10 10)))
#
# Functions that accept a WKT value of GeometryCollection geometry
#
# ST_GeomCollFromTxt()
SELECT ST_AsText(ST_GeomCollFromTxt(@wkt_gc));
ST_AsText(ST_GeomCollFromTxt(@wkt_gc))
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 0),(2 2),(4 4),(6 6),(8 8),(10 10)),MULTILINESTRING((0 0,10 10),(0 10,10 0)),MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))
# ST_GeomCollFromText()
SELECT ST_AsText(ST_GeomCollFromText(@wkt_gc));
ST_AsText(ST_GeomCollFromText(@wkt_gc))
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 0),(2 2),(4 4),(6 6),(8 8),(10 10)),MULTILINESTRING((0 0,10 10),(0 10,10 0)),MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))
# ST_GeometryCollectionFromText()
SELECT ST_AsText(ST_GeometryCollectionFromText(@wkt_gc));
ST_AsText(ST_GeometryCollectionFromText(@wkt_gc))
GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOINT((0 0),(2 2),(4 4),(6 6),(8 8),(10 10)),MULTILINESTRING((0 0,10 10),(0 10,10 0)),MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))
#
# Invalid function calls
#
SELECT ST_GeomFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeomFromText'
SELECT ST_GeomFromText(NULL);
ST_GeomFromText(NULL)
NULL
SELECT ST_GeomFromText('POINT()');
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_GeomFromText('LINESTRING(0 0,! 10)');
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_GeometryFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeometryFromText'
SELECT ST_GeometryFromText(NULL);
ST_GeometryFromText(NULL)
NULL
SELECT ST_GeometryFromText('POINT(! 0)');
ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SELECT ST_GeometryFromText('POLYGON((0 0,0 10,10 10,10 0,0 0)');
ERROR 22023: Invalid GIS data provided to function st_geometryfromtext.
SELECT ST_PointFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_PointFromText'
SELECT ST_PointFromText(NULL);
ST_PointFromText(NULL)
NULL
SELECT ST_PointFromText('POINT()');
ERROR 22023: Invalid GIS data provided to function st_pointfromtext.
SELECT ST_LineFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_LineFromText'
SELECT ST_LineFromText(NULL);
ST_LineFromText(NULL)
NULL
SELECT ST_LineFromText('LINESTRING(a a,b b)');
ERROR 22023: Invalid GIS data provided to function st_linefromtext.
SELECT ST_LineStringFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_LineStringFromText'
SELECT ST_LineStringFromText(NULL);
ST_LineStringFromText(NULL)
NULL
SELECT ST_LineStringFromText('LINESTRING(1 1,1 b)');
ERROR 22023: Invalid GIS data provided to function st_linestringfromtext.
SELECT ST_PolyFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_PolyFromText'
SELECT ST_PolyFromText(NULL);
ST_PolyFromText(NULL)
NULL
SELECT ST_PolyFromText('POLYGON(())');
ERROR 22023: Invalid GIS data provided to function st_polyfromtext.
SELECT ST_PolygonFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_PolygonFromText'
SELECT ST_PolygonFromText(NULL);
ST_PolygonFromText(NULL)
NULL
SELECT ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0),())');
ERROR 22023: Invalid GIS data provided to function st_polygonfromtext.
SELECT ST_MPointFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MPointFromText'
SELECT ST_MPointFromText(NULL);
ST_MPointFromText(NULL)
NULL
SELECT ST_MPointFromText('MULTIPOINT(0 0,1)');
ERROR 22023: Invalid GIS data provided to function st_mpointfromtext.
SELECT ST_MultiPointFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MultiPointFromText'
SELECT ST_MultiPointFromText(NULL);
ST_MultiPointFromText(NULL)
NULL
SELECT ST_MultiPointFromText('MULTIPOINT(0 0,1 1 1)');
ERROR 22023: Invalid GIS data provided to function st_multipointfromtext.
SELECT ST_MLineFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MLineFromText'
SELECT ST_MLineFromText(NULL);
ST_MLineFromText(NULL)
NULL
SELECT ST_MLineFromText('MULTILINESTRING((0 0,1),())');
ERROR 22023: Invalid GIS data provided to function st_mlinefromtext.
SELECT ST_MultiLineStringFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MultiLineStringFromText'
SELECT ST_MultiLineStringFromText(NULL);
ST_MultiLineStringFromText(NULL)
NULL
SELECT ST_MultiLineStringFromText('MULTILINESTRING((0 0,1),(1 1,2 2)');
ERROR 22023: Invalid GIS data provided to function st_multilinestringfromtext.
SELECT ST_MPolyFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MPolyFromText'
SELECT ST_MPolyFromText(NULL);
ST_MPolyFromText(NULL)
NULL
SELECT ST_MPolyFromText('MULTIPOLYGON(((0 0,1)),(()))');
ERROR 22023: Invalid GIS data provided to function st_mpolyfromtext.
SELECT ST_MultiPolygonFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_MultiPolygonFromText'
SELECT ST_MultiPolygonFromText(NULL);
ST_MultiPolygonFromText(NULL)
NULL
SELECT ST_MultiPolygonFromText('MULTIPOLYGON(((0 0,0 1,1 1,1 0,0 0)),(2 2,2 3,3 3,3 2,2 2))');
ERROR 22023: Invalid GIS data provided to function st_multipolygonfromtext.
SELECT ST_GeomCollFromTxt();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeomCollFromTxt'
SELECT ST_GeomCollFromTxt(NULL);
ST_GeomCollFromTxt(NULL)
NULL
SELECT ST_GeomCollFromTxt('GEOMETRYCOLLECTION(POINT())');
ERROR 22023: Invalid GIS data provided to function st_geomcollfromtxt.
SELECT ST_GeomCollFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeomCollFromText'
SELECT ST_GeomCollFromText(NULL);
ST_GeomCollFromText(NULL)
NULL
SELECT ST_GeomCollFromText('GEOMETRYCOLLECTION(POINT(a a))');
ERROR 22023: Invalid GIS data provided to function st_geomcollfromtext.
SELECT ST_GeometryCollectionFromText();
ERROR 42000: Incorrect parameter count in the call to native function 'ST_GeometryCollectionFromText'
SELECT ST_GeometryCollectionFromText(NULL);
ST_GeometryCollectionFromText(NULL)
NULL
SELECT ST_GeometryCollectionFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,1 1)');
ERROR 22023: Invalid GIS data provided to function st_geometrycollectionfromtext.
#
# WL#8579 Spatial Reference Systems
#
CREATE PROCEDURE gis_wkt_funcs(IN srid INT)
BEGIN
SET @wkt_pt = 'POINT(0 0)';
SET @wkt_ln = 'LINESTRING(0 0,2 2,4 4,6 6,8 8, 10 10)';
SET @wkt_py = 'POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))';
SET @wkt_mpt = 'MULTIPOINT(0 0,2 2,4 4,6 6)';
SET @wkt_mln = 'MULTILINESTRING((0 0,2 2,4 4),(6 6,8 8,10 10))';
SET @wkt_mpy = 'MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),'
'((10 10,10 12,12 12,12 10,10 10)))';
SET @wkt_gc = 'GEOMETRYCOLLECTION('
'POINT(0 0),'
'LINESTRING(0 0,10 10),'
'POLYGON((0 0,0 10,10 10,10 0, 0 0)),'
'MULTIPOINT(0 0,2 2,4 4,6 6,8 8,10 10),'
'MULTILINESTRING((0 0,10 10),(0 10,10 0)),'
'MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 10,10 10,10 5,5 5))))';
# GIS WKT functions
DO ST_GeomFromText(@wkt_pt, srid);
DO ST_GeometryFromText(@wkt_pt, srid);
DO ST_PointFromText(@wkt_pt, srid);
DO ST_LineFromText(@wkt_ln, srid);
DO ST_LineStringFromText(@wkt_ln, srid);
DO ST_PolyFromText(@wkt_py, srid);
DO ST_PolygonFromText(@wkt_py, srid);
DO ST_MPointFromText(@wkt_mpt, srid);
DO ST_MultiPointFromText(@wkt_mpt, srid);
DO ST_MLineFromText(@wkt_mln, srid);
DO ST_MultiLineStringFromText(@wkt_mln, srid);
DO ST_MPolyFromText(@wkt_mpy, srid);
DO ST_MultiPolygonFromText(@wkt_mpy, srid);
DO ST_GeomCollFromTxt(@wkt_gc, srid);
DO ST_GeomCollFromText(@wkt_gc, srid);
DO ST_GeometryCollectionFromText(@wkt_gc, srid);
END |
# SRID 0 (should pass)
CALL gis_wkt_funcs(0);
# Projected SRS (should pass)
CALL gis_wkt_funcs(2000);
# Geographic SRS (should pass)
CALL gis_wkt_funcs(4326);
# Undefined SRS (should fail)
CALL gis_wkt_funcs(19000000);
ERROR SR001: There's no spatial reference system with SRID 19000000.
# Clean up
DROP PROCEDURE gis_wkt_funcs;
#
# Bug #23632147 MYSQL USES INVALID WKT FOR EMPTY GEOMETRYCOLLECTION
#
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POINT EMPTY'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POINT()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(' POINT EMPTY '));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POINT EMPTY()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POINT EMPT'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POINT EMPTYNESS'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('LINESTRING EMPTY'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('LINESTRING()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(' LINESTRING EMPTY '));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('LINESTRING EMPTY()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('LINESTRING EMPT'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('LINESTRING EMPTYNESS'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON EMPTY'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(' POLYGON EMPTY '));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON EMPTY()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON EMPT'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('POLYGON EMPTYNESS'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT EMPTY'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(' MULTIPOINT EMPTY '));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT EMPTY()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT EMPT'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOINT EMPTYNESS'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING EMPTY'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(' MULTILINESTRING EMPTY '));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING EMPTY()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING EMPT'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTILINESTRING EMPTYNESS'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON EMPTY'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(' MULTIPOLYGON EMPTY '));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON EMPTY()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON EMPT'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('MULTIPOLYGON EMPTYNESS'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY'));
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY'))
GEOMETRYCOLLECTION EMPTY
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'));
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'))
GEOMETRYCOLLECTION EMPTY
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(' GEOMETRYCOLLECTION EMPTY '));
ST_ASTEXT(ST_GEOMFROMTEXT(' GEOMETRYCOLLECTION EMPTY '))
GEOMETRYCOLLECTION EMPTY
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTY()'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPT'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION EMPTYNESS'));
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT(
'GEOMETRYCOLLECTION(
GEOMETRYCOLLECTION(
GEOMETRYCOLLECTION EMPTY,
GEOMETRYCOLLECTION ()
)
)'
));
ST_ASTEXT(ST_GEOMFROMTEXT(
'GEOMETRYCOLLECTION(
GEOMETRYCOLLECTION(
GEOMETRYCOLLECTION EMPTY,
GEOMETRYCOLLECTION ()
)
)'
))
GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(GEOMETRYCOLLECTION EMPTY,GEOMETRYCOLLECTION EMPTY))
########################################################################
# Inserting testing SRS values in spatial reference table
########################################################################
# Inserting geographical srs with long-lat ordering
CREATE SPATIAL REFERENCE SYSTEM 30000000 NAME 'TEST30000000' 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","30000000"]]';
# Inserting geographical srs with lat-long ordering
CREATE SPATIAL REFERENCE SYSTEM 30100000 NAME 'TEST30100000' 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","30100000"]]';
# Inserting projected srs with northing-easting ordering
CREATE SPATIAL REFERENCE SYSTEM 30200000 NAME 'TEST30200000' 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","30200000"]]';
# Inserting projected srs with easting-northing ordering
CREATE SPATIAL REFERENCE SYSTEM 30300000 NAME 'TEST30300000' 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","30300000"]]';
########################################################################
# Retrieving geometrycollections with the ST_GEOMCOLLFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'))
GEOMETRYCOLLECTION(POINT(3 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))))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 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))))
########################################################################
# Retrieving geometrycollections with the ST_GEOMCOLLFROMTXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'));
ST_ASTEXT(ST_GEOMCOLLFROMTXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'))
GEOMETRYCOLLECTION(POINT(3 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))))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'));
ST_ASTEXT(ST_GEOMCOLLFROMTXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMCOLLFROMTXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMCOLLFROMTXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 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))))
########################################################################
# Retrieving geometrycollections with the ST_GEOMETRYCOLLECTIONFROMTEXT
# function
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'));
ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'))
GEOMETRYCOLLECTION(POINT(3 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))))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'));
ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 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))))
########################################################################
# Retrieving geometrycollections with the ST_GEOMETRYFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'));
ST_ASTEXT(ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'))
GEOMETRYCOLLECTION(POINT(3 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))))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'));
ST_ASTEXT(ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
SELECT ST_ASTEXT(ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 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))))
########################################################################
# Retrieving geometrycollections with the ST_GEOMFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'));
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=long-lat'))
GEOMETRYCOLLECTION(POINT(3 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))))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'));
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-long'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'));
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30300000,'axis-order=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 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))))
########################################################################
# Retrieving linestrings with the ST_LINEFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=long-lat'));
ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=long-lat'))
LINESTRING(5 0,10 5,15 10)
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=lat-long'));
ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=lat-long'))
LINESTRING(0 5,5 10,10 15)
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=srid-defined'))
LINESTRING(0 5,5 10,10 15)
SELECT ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30000000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30000000,
'axis-order=srid-defined'))
LINESTRING(0 5,5 10,10 15)
########################################################################
# Retrieving linestrings with the ST_LINESTRINGFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_LINESTRINGFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=long-lat'));
ST_ASTEXT(ST_LINESTRINGFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=long-lat'))
LINESTRING(5 0,10 5,15 10)
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_LINESTRINGFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=lat-long'));
ST_ASTEXT(ST_LINESTRINGFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=lat-long'))
LINESTRING(0 5,5 10,10 15)
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_LINESTRINGFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_LINESTRINGFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30100000,
'axis-order=srid-defined'))
LINESTRING(0 5,5 10,10 15)
SELECT ST_ASTEXT(ST_LINESTRINGFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30000000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_LINESTRINGFROMTEXT('LINESTRING(0 5,5 10,10 15)', 30000000,
'axis-order=srid-defined'))
LINESTRING(0 5,5 10,10 15)
########################################################################
# Retrieving multistrings with the ST_MLINEFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30000000,'axis-order=long-lat'));
ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30000000,'axis-order=long-lat'))
MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30100000,'axis-order=lat-long'));
ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30100000,'axis-order=lat-long'))
MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30200000,'axis-order=srid-defined'));
ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30200000,'axis-order=srid-defined'))
MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))
SELECT ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30300000,'axis-order=srid-defined'));
ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30300000,'axis-order=srid-defined'))
MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))
########################################################################
# Retrieving multipoints with the ST_MPOINTFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',
30000000,'axis-order=long-lat'));
ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',
30000000,'axis-order=long-lat'))
MULTIPOINT((0 2),(5 7),(8 2),(4 9))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',
30100000,'axis-order=lat-long'));
ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',
30100000,'axis-order=lat-long'))
MULTIPOINT((0 2),(5 7),(8 2),(4 9))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',
30200000,'axis-order=srid-defined'));
ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',
30200000,'axis-order=srid-defined'))
MULTIPOINT((0 2),(5 7),(8 2),(4 9))
SELECT ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',
30300000,'axis-order=srid-defined'));
ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2), (4 9))',
30300000,'axis-order=srid-defined'))
MULTIPOINT((0 2),(5 7),(8 2),(4 9))
########################################################################
# Retrieving multipolygons with the ST_MPOLYFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_MPOLYFROMTEXT('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)))', 30000000,
'axis-order=long-lat'));
ST_ASTEXT(ST_MPOLYFROMTEXT('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)))', 30000000,
'axis-order=long-lat'))
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)))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),
(4 4,6 4,6 6,4 6, 4 4)),((0 0,-2 -2,-2 0, 0 0)))', 30100000,
'axis-order=lat-long'));
ST_ASTEXT(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),
(4 4,6 4,6 6,4 6, 4 4)),((0 0,-2 -2,-2 0, 0 0)))', 30100000,
'axis-order=lat-long'))
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0)))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),
(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))', 30200000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),
(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))', 30200000,
'axis-order=srid-defined'))
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((0 0,-2 -2,0 -2,0 0)))
SELECT ST_ASTEXT(ST_MPOLYFROMTEXT('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)))', 30300000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_MPOLYFROMTEXT('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)))', 30300000,
'axis-order=srid-defined'))
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)))
########################################################################
# Retrieving multistrings with the ST_MULTILINESTRINGFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30000000,'axis-order=long-lat'));
ST_ASTEXT(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30000000,'axis-order=long-lat'))
MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30100000,'axis-order=lat-long'));
ST_ASTEXT(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30100000,'axis-order=lat-long'))
MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30200000,'axis-order=srid-defined'));
ST_ASTEXT(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30200000,'axis-order=srid-defined'))
MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))
SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30300000,'axis-order=srid-defined'));
ST_ASTEXT(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),
(8 11,11 14,14 17))', 30300000,'axis-order=srid-defined'))
MULTILINESTRING((0 2,2 4,4 6),(8 11,11 14,14 17))
########################################################################
# Retrieving multipoints with the ST_MULTIPOINTFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_MULTIPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2),
(4 9))', 30000000,'axis-order=long-lat'));
ST_ASTEXT(ST_MULTIPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2),
(4 9))', 30000000,'axis-order=long-lat'))
MULTIPOINT((0 2),(5 7),(8 2),(4 9))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_MULTIPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2),
(4 9))', 30100000,'axis-order=lat-long'));
ST_ASTEXT(ST_MULTIPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2),
(4 9))', 30100000,'axis-order=lat-long'))
MULTIPOINT((0 2),(5 7),(8 2),(4 9))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_MULTIPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2),
(4 9))', 30200000,'axis-order=srid-defined'));
ST_ASTEXT(ST_MULTIPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2),
(4 9))', 30200000,'axis-order=srid-defined'))
MULTIPOINT((0 2),(5 7),(8 2),(4 9))
SELECT ST_ASTEXT(ST_MULTIPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2),
(4 9))', 30300000,'axis-order=srid-defined'));
ST_ASTEXT(ST_MULTIPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (8 2),
(4 9))', 30300000,'axis-order=srid-defined'))
MULTIPOINT((0 2),(5 7),(8 2),(4 9))
########################################################################
# Retrieving multipolygons with the ST_MULTIPOLYGONFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMTEXT(
'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)))', 30000000, 'axis-order=long-lat'));
ST_ASTEXT(ST_MULTIPOLYGONFROMTEXT(
'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)))', 30000000, 'axis-order=long-lat'))
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)))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMTEXT(
'MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0), (4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0)))', 30100000, 'axis-order=lat-long'));
ST_ASTEXT(ST_MULTIPOLYGONFROMTEXT(
'MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0), (4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0)))', 30100000, 'axis-order=lat-long'))
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0)))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMTEXT(
'MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0), (4 4,4 6,6 6,6 4, 4 4)),
((0 0,-2 -2,0 -2, 0 0)))', 30200000, 'axis-order=srid-defined'));
ST_ASTEXT(ST_MULTIPOLYGONFROMTEXT(
'MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0), (4 4,4 6,6 6,6 4, 4 4)),
((0 0,-2 -2,0 -2, 0 0)))', 30200000, 'axis-order=srid-defined'))
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4)),((0 0,-2 -2,0 -2,0 0)))
SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMTEXT(
'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)))', 30300000, 'axis-order=srid-defined'));
ST_ASTEXT(ST_MULTIPOLYGONFROMTEXT(
'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)))', 30300000, 'axis-order=srid-defined'))
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)))
########################################################################
# Retrieving points with the ST_POINTFROMTEXT function
#
########################################################################
# When the geometry is in a projected spatial reference system,
# the coordinates are interpreted as in the order they appear in the geometry.
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)',30300000, 'axis-order=long-lat'));
ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)',30300000, 'axis-order=long-lat'))
POINT(1 2)
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)',30100000, 'axis-order=lat-long'));
ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)',30100000, 'axis-order=lat-long'))
POINT(1 2)
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)',30200000, 'axis-order=srid-defined'));
ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)',30200000, 'axis-order=srid-defined'))
POINT(1 2)
SELECT ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)',30100000, 'axis-order=srid-defined'));
ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)',30100000, 'axis-order=srid-defined'))
POINT(1 2)
########################################################################
# Retrieving polygons with the ST_POLYFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,0 5,0 0))', 30000000,
'axis-order=long-lat'));
ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,0 5,0 0))', 30000000,
'axis-order=long-lat'))
POLYGON((0 0,5 0,5 5,0 5,0 0))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))', 30100000,
'axis-order=lat-long'));
ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))', 30100000,
'axis-order=lat-long'))
POLYGON((0 0,0 5,5 5,5 0,0 0))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))', 30200000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))', 30200000,
'axis-order=srid-defined'))
POLYGON((0 0,0 5,5 5,5 0,0 0))
SELECT ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,0 5,0 0))', 30300000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,0 5,0 0))', 30300000,
'axis-order=srid-defined'))
POLYGON((0 0,5 0,5 5,0 5,0 0))
########################################################################
# Retrieving polygons with the ST_POLYGONFROMTEXT function
#
########################################################################
# Retrieve values with long lat ordering.
SELECT ST_ASTEXT(ST_POLYGONFROMTEXT('POLYGON((0 0,5 0,5 5,0 5,0 0))', 30000000,
'axis-order=long-lat'));
ST_ASTEXT(ST_POLYGONFROMTEXT('POLYGON((0 0,5 0,5 5,0 5,0 0))', 30000000,
'axis-order=long-lat'))
POLYGON((0 0,5 0,5 5,0 5,0 0))
# Retrieve values with lat-long ordering.
SELECT ST_ASTEXT(ST_POLYGONFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))', 30100000,
'axis-order=lat-long'));
ST_ASTEXT(ST_POLYGONFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))', 30100000,
'axis-order=lat-long'))
POLYGON((0 0,0 5,5 5,5 0,0 0))
# Retrieve values with SRID-defined ordering.
SELECT ST_ASTEXT(ST_POLYGONFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))', 30200000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_POLYGONFROMTEXT('POLYGON((0 0,0 5,5 5,5 0,0 0))', 30200000,
'axis-order=srid-defined'))
POLYGON((0 0,0 5,5 5,5 0,0 0))
SELECT ST_ASTEXT(ST_POLYGONFROMTEXT('POLYGON((0 0,5 0,5 5,0 5,0 0))', 30300000,
'axis-order=srid-defined'));
ST_ASTEXT(ST_POLYGONFROMTEXT('POLYGON((0 0,5 0,5 5,0 5,0 0))', 30300000,
'axis-order=srid-defined'))
POLYGON((0 0,5 0,5 5,0 5,0 0))
# ######################################################################
# Options upper and lower case testing
# ######################################################################
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=Long-Lat'));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,'axis-order=Long-Lat'))
GEOMETRYCOLLECTION(POINT(3 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))))
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axiS-Order=Lat-lonG'));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axiS-Order=Lat-lonG'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'AXis-orDer=srid-defined'));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'AXis-orDer=srid-defined'))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
########################################################################
# Error testing
########################################################################
# Test with too many options.
SELECT ST_ASTEXT(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),
(4 4,6 4,6 6,4 6, 4 4)),((0 0,-2 -2,-2 0, 0 0)))', 30300000,
'axis-order=srid-defined, axis-order=lat-long'));
ERROR 22023: Duplicate option key 'axis-order' in funtion 'st_mpolyfromtext'.
# Test with invalid options key.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30300000,'axix-order=srid-defined'));
ERROR 22023: Invalid option key 'axix-order' in function st_geomcollfromtext.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axix-order=lat-long'));
ERROR 22023: Invalid option key 'axix-order' in function st_geomcollfromtext.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axix-order=lat-long'));
ERROR 22023: Invalid option key 'axix-order' in function st_geomcollfromtext.
# Test with invalid options value
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30300000,'axis-order=srid-dfined'));
ERROR 22023: Invalid value 'srid-dfined' for option 'axis-order' in function 'st_geomcollfromtext'.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,'axis-order=lat-bong'));
ERROR 22023: Invalid value 'lat-bong' for option 'axis-order' in function 'st_geomcollfromtext'.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=lat-shwong'));
ERROR 22023: Invalid value 'lat-shwong' for option 'axis-order' in function 'st_geomcollfromtext'.
# Test with both invalid option and invalid value
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30100000,'axis-border=lat-shwong'));
ERROR 22023: Invalid option key 'axis-border' in function st_geomcollfromtext.
# Testing for badly formed options argument.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order srid-defined'));
ERROR 22023: The string 'axis-order srid-defined' is not a valid key = value pair in function st_geomcollfromtext.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'=axis-order srid-defined'));
ERROR 22023: The options argument in function st_geomcollfromtext starts with the invalid character '='.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order=srid-defined='));
ERROR 22023: The options argument in function st_geomcollfromtext ends with the invalid character '='.
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30100000,'axis-order== srid-defined'));
ERROR 22023: The options argument in function st_geomcollfromtext contains the invalid character sequence '=='.
# ######################################################################
# Empty string and white space testing
# ######################################################################
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,''));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 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))))', 30000000,''))
GEOMETRYCOLLECTION(POINT(3 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))))
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,' '));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,' '))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
SELECT ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,' axis-order = srid-defined '));
ST_ASTEXT(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(3 5),
POLYGON((0 0,0 10,10 10,10 0,0 0)),
MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6, 4 4)),
((0 0,-2 -2,-2 0, 0 0))))', 30200000,' axis-order = srid-defined '))
GEOMETRYCOLLECTION(POINT(3 5),POLYGON((0 0,0 10,10 10,10 0,0 0)),MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4)),((0 0,-2 -2,-2 0,0 0))))
# ######################################################################
# NULL value testing
# ######################################################################
# NULL value testing: Should return NULL if either or both parameters is NULL
SELECT ST_ASTEXT(ST_POINTFROMTEXT(NULL,30300000, 'axis-order=long-lat'));
ST_ASTEXT(ST_POINTFROMTEXT(NULL,30300000, 'axis-order=long-lat'))
NULL
SELECT ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)', NULL, 'axis-order=lat-long'));
ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)', NULL, 'axis-order=lat-long'))
NULL
SELECT ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)', 30200000, NULL));
ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)', 30200000, NULL))
NULL
SELECT ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)', NULL, NULL));
ST_ASTEXT(ST_POINTFROMTEXT('point(1 2)', NULL, NULL))
NULL
SELECT ST_ASTEXT(ST_POINTFROMTEXT(NULL, NULL, NULL));
ST_ASTEXT(ST_POINTFROMTEXT(NULL, NULL, NULL))
NULL
#
# Bug #25818451 ASAN HEAP-USE-AFTER-FREE WITH GEOMETRY + STRING
#
SET @c:=REPEAT('a',128);
SET @f:=0x336f;
SET @s:=REPLACE("DO ST_ASTEXT(LEFT(@c,@f));","'",'"');
PREPARE s FROM @s;
EXECUTE s;
ERROR 22023: Invalid GIS data provided to function st_astext.
DROP PREPARE s;
##########################################################
# Inserting testing SRS values in spatial reference table
##########################################################
# Inserting geographical srs with long-lat ordering
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"]]';
# Inserting geographical srs with lat-long ordering
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"]]';
# Inserting projected srs with northing-easting ordering
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"]]';
#########################################################################
# Test with geometries with geographic SRS with long-lat ordering outside
# valid range.
#########################################################################
SELECT ST_POINTFROMTEXT('POINT(-200 10)',32000000);
ERROR 22S02: Longitude -200.000000 is out of range in function st_pointfromtext. It must be within (-180.000000, 180.000000].
SELECT ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)',32000000);
ERROR 22S02: Longitude 194.000000 is out of range in function st_linefromtext. It must be within (-180.000000, 180.000000].
SELECT ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',32000000);
ERROR 22S02: Longitude -300.000000 is out of range in function st_polyfromtext. It must be within (-180.000000, 180.000000].
SELECT ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (-344 9))',32000000);
ERROR 22S02: Longitude 798.000000 is out of range in function st_mpointfromtext. It must be within (-180.000000, 180.000000].
SELECT ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',32000000);
ERROR 22S02: Longitude 744.000000 is out of range in function st_mlinefromtext. It must be within (-180.000000, 180.000000].
SELECT 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)))',32000000);
ERROR 22S02: Longitude 350.000000 is out of range in function st_mpolyfromtext. It must be within (-180.000000, 180.000000].
SELECT 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))))',32000000);
ERROR 22S02: Longitude -199.000000 is out of range in function st_geomcollfromtext. It must be within (-180.000000, 180.000000].
#########################################################################
# Test with geometries with geographic SRS with lat-long ordering outside
# valid range (same geometries as above, but with different error since
# coordinates are flipped).
#########################################################################
SELECT ST_POINTFROMTEXT('POINT(-200 10)',32100000);
ERROR 22S03: Latitude -200.000000 is out of range in function st_pointfromtext. It must be within [-90.000000, 90.000000].
SELECT ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)',32100000);
ERROR 22S03: Latitude 194.000000 is out of range in function st_linefromtext. It must be within [-90.000000, 90.000000].
SELECT ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',32100000);
ERROR 22S03: Latitude -300.000000 is out of range in function st_polyfromtext. It must be within [-90.000000, 90.000000].
SELECT ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (4 9))',32100000);
ERROR 22S03: Latitude 798.000000 is out of range in function st_mpointfromtext. It must be within [-90.000000, 90.000000].
SELECT ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',32100000);
ERROR 22S03: Latitude 744.000000 is out of range in function st_mlinefromtext. It must be within [-90.000000, 90.000000].
SELECT 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)))',32100000);
ERROR 22S03: Latitude 350.000000 is out of range in function st_mpolyfromtext. It must be within [-90.000000, 90.000000].
SELECT 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))))',32100000);
ERROR 22S03: Latitude -199.000000 is out of range in function st_geomcollfromtext. It must be within [-90.000000, 90.000000].
##############################
# Miscellaneous error testing
##############################
SELECT ST_POINTFROMTEXT('POINT(-91 10)',32100000);
ERROR 22S03: Latitude -91.000000 is out of range in function st_pointfromtext. It must be within [-90.000000, 90.000000].
SELECT ST_POINTFROMTEXT('POINT(10 -182)',32100000);
ERROR 22S02: Longitude -182.000000 is out of range in function st_pointfromtext. It must be within (-180.000000, 180.000000].
SELECT ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 91,14 17))',32000000);
ERROR 22S02: Longitude 744.000000 is out of range in function st_mlinefromtext. It must be within (-180.000000, 180.000000].
SELECT ST_MLINEFROMTEXT('MULTILINESTRING((0 95,2 4,4 6),(744 11,11 91,14 17))',32000000);
ERROR 22S03: Latitude 95.000000 is out of range in function st_mlinefromtext. It must be within [-90.000000, 90.000000].
###################
# Edge case testing
###################
SELECT ST_ASTEXT(ST_POINTFROMTEXT('POINT(-90.0000000 10)',32100000));
ST_ASTEXT(ST_POINTFROMTEXT('POINT(-90.0000000 10)',32100000))
POINT(-90 10)
SELECT ST_ASTEXT(ST_POINTFROMTEXT('POINT(10 -180.000000)',32100000));
ST_ASTEXT(ST_POINTFROMTEXT('POINT(10 -180.000000)',32100000))
POINT(10 -180)
SELECT ST_ASTEXT(ST_POINTFROMTEXT('POINT(90.0000000 10)',32100000));
ST_ASTEXT(ST_POINTFROMTEXT('POINT(90.0000000 10)',32100000))
POINT(90 10)
SELECT ST_ASTEXT(ST_POINTFROMTEXT('POINT(10 180.000000)',32100000));
ST_ASTEXT(ST_POINTFROMTEXT('POINT(10 180.000000)',32100000))
POINT(10 180)
SELECT ST_POINTFROMTEXT('POINT(-90.0000001 10)',32100000);
ERROR 22S03: Latitude -90.000000 is out of range in function st_pointfromtext. It must be within [-90.000000, 90.000000].
SELECT ST_POINTFROMTEXT('POINT(10 -180.0000001)',32100000);
ERROR 22S02: Longitude -180.000000 is out of range in function st_pointfromtext. It must be within (-180.000000, 180.000000].
SELECT ST_POINTFROMTEXT('POINT(90.0000001 10)',32100000);
ERROR 22S03: Latitude 90.000000 is out of range in function st_pointfromtext. It must be within [-90.000000, 90.000000].
SELECT ST_POINTFROMTEXT('POINT(10 180.0000001)',32100000);
ERROR 22S02: Longitude 180.000000 is out of range in function st_pointfromtext. It must be within (-180.000000, 180.000000].
#################################################################
# Test that range restriction does not apply to projected spatial
# reference systems
#################################################################
SELECT ST_ASTEXT(ST_POINTFROMTEXT('POINT(-200 10)',32200000));
ST_ASTEXT(ST_POINTFROMTEXT('POINT(-200 10)',32200000))
POINT(-200 10)
SELECT ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)',32200000));
ST_ASTEXT(ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)',32200000))
LINESTRING(0 5,194 10,10 15)
SELECT ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',32200000));
ST_ASTEXT(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',32200000))
POLYGON((0 0,5 0,5 5,-300 5,0 0))
SELECT ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (4 9))',32200000));
ST_ASTEXT(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (4 9))',32200000))
MULTIPOINT((0 2),(5 7),(798 2),(4 9))
SELECT ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',32200000));
ST_ASTEXT(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',32200000))
MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))
SELECT ST_ASTEXT(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)))',32200000));
ST_ASTEXT(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)))',32200000))
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)))
SELECT ST_ASTEXT(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))))',32200000));
ST_ASTEXT(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))))',32200000))
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))))
########################################################
# Test with empty GEOMETRYCOLLECTION with geographic SRS
########################################################
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()', 32000000));
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()', 32000000))
GEOMETRYCOLLECTION EMPTY
SELECT ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()', 32100000));
ST_ASTEXT(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()', 32100000))
GEOMETRYCOLLECTION EMPTY
DROP SPATIAL REFERENCE SYSTEM 30000000;
DROP SPATIAL REFERENCE SYSTEM 30100000;
DROP SPATIAL REFERENCE SYSTEM 30200000;
DROP SPATIAL REFERENCE SYSTEM 30300000;
DROP SPATIAL REFERENCE SYSTEM 32000000;
DROP SPATIAL REFERENCE SYSTEM 32100000;
DROP SPATIAL REFERENCE SYSTEM 32200000;
#
# WL#11096 Don't do Cartesian computations on geographic geometries
#
# Assume SRID 10 is not defined. Should raise warning.
DO ST_ASTEXT(x'0A000000010100000000000000000000000000000000000000');
Warnings:
Warning 3565 There's no spatial reference system with SRID 10. The axis order is unknown.
DO ST_ASWKT(x'0A000000010100000000000000000000000000000000000000');
Warnings:
Warning 3565 There's no spatial reference system with SRID 10. The axis order is unknown.
#
# Bug #27427677 SIG 11 IN STRING::APPEND() METHOD,
# SQL-COMMON/SQL_STRING.CC:535
#
CREATE TABLE t1(c1 GEOMETRY);
INSERT INTO t1 VALUES (ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0))'));
SELECT ST_AsText(c1) AS f1 FROM t1 ORDER BY f1;
f1
GEOMETRYCOLLECTION(POINT(0 0))
DROP TABLE t1;
|