WL#14129: ST_FrechetDistance

Affects: Server-8.0   —   Status: Complete

This WL adds the function ST_FrechetDistance(geometry1, geometry2 [, length_unit) that returns the discrete Fréchet distance between two geometries, reflecting how similar the geometries are. If a length unit is specified, the result is converted to that unit.

This function implements the discrete Fréchet distance, which means it is restricted to distances between the points of the geometry. E.g., given two linestrings only the points explicitly mentioned in the geometries are considered. Points on the line segments between these points are not considered.

The Fréchet distance is defined for linestrings, multilinestrings, polygons and multipolygons, but this WL only implements it for linestrings, since that is what Boost Geometry currently supports. Both Cartesian and geographic SRSs are supported.

F-1
The function MUST return NULL if any of its arguments are NULL.
F-2
If any non-NULL argument is not a syntactically well-formed geometry, the function MUST raise ER_GIS_INVALID_DATA during function evaluation.
F-3
If either argument is a syntactically well-formed geometry in an undefined SRS, the function MUST raise ER_SRS_NOT_FOUND during function evaluation.
F-4
If both arguments are syntactically well-formed geometries but in different SRSs, the function MUST raise ER_GIS_DIFFERENT_SRIDS during function evaluation.
F-5
If both arguments are syntactically well-formed geometries in the same Cartesian SRS, but either argument is not a linestring, the function MUST raise ER_NOT_IMPLEMENTED_FOR_CARTESIAN_SRS during function evaluation.
F-6
If both arguments are syntactically well-formed geometries in the same geographic SRS, but either argument is not a linestring, the function MUST raise ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS during function evaluation.
F-7
If both arguments are syntactically well-formed linestrings in the same SRS, the function MUST return a DOUBLE value representing the Frechet distance in the unit of the SRS.
F-8
If any geometry argument is a geometry in a geographic SRS and a longitude value is not in the range (-180,180] (in degrees -- other limits in other units), the function MUST raise ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE. (*)
F-9
If any geometry argument is a geometry in a geographic SRS and a latitude value is not in the range [-90,90] (in degrees -- other limits in other units), the function MUST raise ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE. (*)
F-10
If a length unit is specified, the unit is found in INFORMATION_SCHEMA.ST_UNITS_OF_MEASURE, and the SRID is 0, the function MUST raise ER_GEOMETRY_IN_UNKNOWN_LENGTH_UNIT.
F-11
If a length unit is specified, the unit is found in INFORMATION_SCHEMA.ST_UNITS_OF_MEASURE, and the SRID is not 0, the result MUST be in that unit.
F-12
If a length unit is not specified and the geometry parameters are in a Cartesian SRS, the result MUST be in the unit of the SRS of the geometries.
F-13
If a length unit is not specified and the geometry parameters are in a geographic SRS, the result MUST be in the unit of the SRS of the geometries.
F-14
If an unsupported length unit is specified, the function MUST raise ER_UNIT_NOT_FOUND.

(*) The exact limits will deviate slightly because of floating point arithmetics.

I-1
Interface SQL01 is extended with one new function, ST_FrechetDistance(geometry1, geometry2 [, length_unit) that returns a DOUBLE.
I-2
No new errors.
I-3
No new warnings.