MDEV-34141: Implements the function ST_Simplify #3376
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
MariaDB GIS functionalities are limited when compared to other DBMs. To facilitate the migration from MySQL to MariaDB the GIS functionality should be the same. This PR implements the GIS function
ST_Simplify(Geometry g, double max_distance)
. It applies the Ramer–Douglas–Peucker algorithm ong
and returns the resulting geometry.The goal of the Douglas-Peucker algorithm is to find a geometry that is similar to
g
but uses only a subset of points. The algorithm may produce self-intersections and therefore result in invalid geometries.If the
max_distance
is not positive or is NULL, an ER_WRONG_ARGUMENT will occur. The same function is also accessible usingsimplify(Geometry g1, double max_distance)
.To ensure compatibility between the MySQL implementation of this function and the MariaDB implementation, the tests for this function have been cherry-picked from MySQL.
This patch has no side effects.
Release Notes
Adds the function:
ST_Simplify(Geometry g, double max_distance)
,Simplify(Geometry g, double max_distance)
: returns the simplified version of g using the Ramer–Douglas–Peucker algorithms.How can this PR be tested?
An extensive test suite has been cherry-picked from MySQL.
Basing the PR against the correct MariaDB version
PR quality check