I have a table in MySQL with geometry data in one of the columns. The datatype is text
and I need to save it as Polygon.
I have tried a few solutions, but keep running into the error
Invalid GIS data provided to function st_polygonfromtext.
Sample data to reproduce the error: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=78ac63e16ccb5b1e4012c21809cba5ff
Someone suggested using wrapping the statements around TRY
and CATCH
. https://stackoverflow.com/questions/35616177/detecting-faulty-geometry-wkt-and-returning-the-faulty-record
I am not too familiar with using them in MySQL or stored procedures either. Can anyone suggest a way to get around invalid geometries?
I need a spatial index on the table to be able to use spatial functions and filter queries by location.
POINT (-100, 60)
is large enough (requires naturally ST_PointFromText).