WL#9433: Axis order in ST_AsText/ST_AsWKT

Affects: Server-8.0   —   Status: Complete

Import and export functions have to take axis order into consideration. Some spatial reference systems are latitude-longitude, while other are longitude-latitude.

This WL modifies ST_AsText/ST_AsWKT to return coordinates in the order specified in the spatial reference system. An optional options argument and an option argument value to override the default and specify a particular axis order is also added.

The axis order of geometries in projected spatial reference systems is not affected.

This WL changes the output of the functions. Output of existing queries may change, depending on which spatial reference systems are used.

User Documentation

F-1
If no options argument is specified, the functions MUST return coordinates in the order specified in the spatial reference system definition.
F-2
If an axis order is specified, the functions MUST return coordinates in that axis order.
F-3
If the options argument contains an invalid option key, the functions MUST raise ER_INVALID_OPTION_KEY.
F-4
If the options argument contains an invalid option value, the functions MUST raise ER_INVALID_OPTION_VALUE.
F-5
If the options argument is an empty string or contains only whitespace, the functions MUST use the default axis order.
F-6
If the options argument is NULL, the functions MUST return NULL.
F-7
If the options argument contains the same option key more than once, the functions MUST raise ER_DUPLICATE_OPTION_KEY.
F-8
If the options argument is badly formed, the functions MUST raise ER_INVALID_OPTION_KEY_VALUE_PAIR, ER_INVALID_OPTION_START_CHARACTER, ER_INVALID_OPTION_END_CHARACTER or ER_INVALID_OPTION_CHARACTERS.
F-9
If the geometry is in a projected spatial reference system (or SRID 0), the axes are output in the order they appear in the geometry.
F-10
If the geometry is in an undefined spatial reference system, the axes are output in the order they appear in the geometry. The functions MUST raise ER_WARN_SRS_NOT_FOUND_AXIS_ORDER.
F-11
The options argument (both option keys and values) MUST be case insensitive.
NF-1
The functions MUST be non-nullable if all arguments are non-nullable.
I-1
No new files.
I-2
Interface SQL02 is extended with new two-parameter forms of ST_AsText and ST_AsWKT:
<string> = ST_AsText(<geometry>, <string>)
<string> = ST_AsWKT(<geometry>, <string>)
I-3
No new commands.
I-4
No new tools.
I-5
No impact on existing functionality.
I-6
No new errors.
I-7
No new warnings.

The options argument is a string. Currently there is only one option, but in the future there may be more. Options are separated by comma. Each option is on the form "key=value". Whitespace (tabs, spaces, carriage returns and linefeeds) at the beginning and end of keys and values are ignored.

The only valid key is "axis-order". The valid values are "long-lat", "lat-long" and "srid-defined". "srid-defined" is the default if no option string is specified.

Parsing of the options argument shall fail on the first error. The errors are described in WL#9432.