| 1 |
# NULL as one of the parameters must result in NULL return value. |
| 2 |
SELECT ST_LONGITUDE(NULL); |
| 3 |
ST_LONGITUDE(NULL) |
| 4 |
NULL |
| 5 |
SELECT ST_LONGITUDE(NULL, NULL); |
| 6 |
ST_LONGITUDE(NULL, NULL) |
| 7 |
NULL |
| 8 |
SELECT ST_LONGITUDE(NULL, 1); |
| 9 |
ST_LONGITUDE(NULL, 1) |
| 10 |
NULL |
| 11 |
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL); |
| 12 |
ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), NULL) |
| 13 |
NULL |
| 14 |
# Invalid data is not allowed. |
| 15 |
DO ST_LONGITUDE(x'000000000123456789abcdef'); |
| 16 |
ERROR 22023: Invalid GIS data provided to function st_longitude. |
| 17 |
DO ST_LONGITUDE(x'000000000123456789abcdef', 1); |
| 18 |
ERROR 22023: Invalid GIS data provided to function st_longitude. |
| 19 |
# New value must be within the allowed range. |
| 20 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), -180.000000001); |
| 21 |
ERROR 22S02: Longitude -180.000000 is out of range in function st_longitude. It must be within (-180.000000, 180.000000]. |
| 22 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 180.000000001); |
| 23 |
ERROR 22S02: Longitude 180.000000 is out of range in function st_longitude. It must be within (-180.000000, 180.000000]. |
| 24 |
# First parameter must be a point. |
| 25 |
# Cartesian SRID 0 |
| 26 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 0)); |
| 27 |
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_longitude. |
| 28 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 0)); |
| 29 |
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_longitude. |
| 30 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 0)); |
| 31 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude. |
| 32 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 0)); |
| 33 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude. |
| 34 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 0)); |
| 35 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_longitude. |
| 36 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 0)); |
| 37 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_longitude. |
| 38 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 0)); |
| 39 |
ERROR 22S01: POINT value is a geometry of unexpected type GEOMCOLLECTION in st_longitude. |
| 40 |
# Projected |
| 41 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 3857)); |
| 42 |
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_longitude. |
| 43 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 3857)); |
| 44 |
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_longitude. |
| 45 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 3857)); |
| 46 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude. |
| 47 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 3857)); |
| 48 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude. |
| 49 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 3857)); |
| 50 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_longitude. |
| 51 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 3857)); |
| 52 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_longitude. |
| 53 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 3857)); |
| 54 |
ERROR 22S01: POINT value is a geometry of unexpected type GEOMCOLLECTION in st_longitude. |
| 55 |
# Geographic |
| 56 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)', 4326)); |
| 57 |
ERROR 22S01: POINT value is a geometry of unexpected type LINESTRING in st_longitude. |
| 58 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POLYGON((0 0, 0 1, 1 1, 0 0))', 4326)); |
| 59 |
ERROR 22S01: POINT value is a geometry of unexpected type POLYGON in st_longitude. |
| 60 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0))', 4326)); |
| 61 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude. |
| 62 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOINT((0 0), (1 1))', 4326)); |
| 63 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOINT in st_longitude. |
| 64 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTILINESTRING((0 0, 1 1))', 4326)); |
| 65 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTILINESTRING in st_longitude. |
| 66 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('MULTIPOLYGON(((0 0, 0 1, 1 1, 0 0)))', 4326)); |
| 67 |
ERROR 22S01: POINT value is a geometry of unexpected type MULTIPOLYGON in st_longitude. |
| 68 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('GEOMETRYCOLLECTION(POINT(0 0))', 4326)); |
| 69 |
ERROR 22S01: POINT value is a geometry of unexpected type GEOMCOLLECTION in st_longitude. |
| 70 |
# Point must be geographic. |
| 71 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0)); |
| 72 |
ERROR 22S00: Function st_longitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 0, which is not geographic. |
| 73 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857)); |
| 74 |
ERROR 22S00: Function st_longitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 3857, which is not geographic. |
| 75 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326)); |
| 76 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 0), 1); |
| 77 |
ERROR 22S00: Function st_longitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 0, which is not geographic. |
| 78 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 3857), 1); |
| 79 |
ERROR 22S00: Function st_longitude is only defined for geographic spatial reference systems, but one of its arguments is in SRID 3857, which is not geographic. |
| 80 |
DO ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 4326), 1); |
| 81 |
# Get or set the longitude of a point in a lat-long SRS. |
| 82 |
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326)); |
| 83 |
ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326)) |
| 84 |
1 |
| 85 |
SELECT HEX(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326), 1)); |
| 86 |
HEX(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4326), 1)) |
| 87 |
E61000000101000000000000000000F03F0000000000000000 |
| 88 |
# Get or set the longitude of a point in a long-lat SRS. |
| 89 |
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 7035)); |
| 90 |
ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(1 0)', 7035)) |
| 91 |
1 |
| 92 |
SELECT HEX(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1)); |
| 93 |
HEX(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 0)', 7035), 1)) |
| 94 |
7B1B00000101000000000000000000F03F0000000000000000 |
| 95 |
# Get or set the longitude of a point in a lat-long SRS with a meridian |
| 96 |
# that doesn't go through Greenwich. |
| 97 |
SELECT ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801)); |
| 98 |
ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801)) |
| 99 |
1.0000000000000009 |
| 100 |
SELECT HEX(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801), 1)); |
| 101 |
HEX(ST_LONGITUDE(ST_GEOMFROMTEXT('POINT(0 1)', 4801), 1)) |
| 102 |
C11200000101000000040000000000F03F0000000000000000 |