WL#14128: ST_HausdorffDistance
This WL adds the function ST_HausdorffDistance(geometry1, geometry2 [, length_unit]) that returns the discrete Hausdorff 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 Hausdorff 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 Hausdorff distance is defined for all types of geometries, but this WL only implements it for the following combinations LineString-LineString, Point-MultiPoint, LineString-MultiLineString, MultiPoint-MultiPoint, MultiLineString-MultiLineString, which is what Boost Geometry supports at the moment. 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 not one of the following combinations LineString-LineString, Point-MultiPoint, LineString-MultiLineString, MultiPoint-MultiPoint, MultiLineString-MultiLineString, 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 not one of the following combinations LineString-LineString, Point-MultiPoint, LineString-MultiLineString, MultiPoint-MultiPoint, MultiLineString-MultiLineString, the function MUST raise ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS during function evaluation.
- F-7
- If both arguments are syntactically well-formed geometries of the following combinations LineString-LineString, Point-MultiPoint, LineString-MultiLineString, MultiPoint-MultiPoint, MultiLineString-MultiLineString, in the same SRS, the function MUST return a DOUBLE value representing the Hausdorff 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_HausdorffDistance(geometry1, geometry2 [, length_unit]) that returns a DOUBLE.
- I-2
- No new errors.
- I-3
- No new warnings.