I have the following table in my MariaDB database:
This table contains a column called 'coordinates' (type: LONGTEXT) with a wkt representation of either a MultiPolygon or a Polygon. I am attempting to convert this wkt representation to a type geom.
To do this, I tried running the following SQL Statements:
ALTER TABLE `database1`.`Federal_Info` ADD COLUMN `geom` Polygon;
UPDATE `database1`.`Federal_Info` SET geom = ST_GeomFromText(coordinates, 4326);
However, I seem to be getting an error:
#1366 - Incorrect POLYGON value: 'MULTIPOLYGON' for column 'geom' at row 1
I also did try to see if there was anything wrong with the coordinates string, so I copied the entire string from the first row by executing the following command in sql:
SET @g= ST_GEOMFROMTEXT('MULTIPOLYGON (((-53.15910091775785 46.63184979843835, -53.15895811730544 46.63187509350104, ..., -53.96597790139074 47.43489159991098)))')
This code works without error so I'm incredibly confused why converting the column is causing a problem.
A bit of background to the table: I parsed a KML file, converted each of the coordinates to a Polygon Shapely object, and used the unary_union
function to convert each Polygon into a MultiPolygon. From there I uploaded the dataframe (in Python) to my database.