Polygon data cannot be imported into MySQL, but MultiPolygon data can

262
August 09, 2017, at 9:28 PM

I can’t figure out why this doesn’t work (throws a "Cannot get geometry object from data you send to the GEOMETRY field”):

UPDATE Table
SET Shape = ST_GeomFromGeoJSON('{
    "type": "Polygon",
    "coordinates": [[[-39.440918,-11.113727],[-23.972168,4.981505],[-21.862793,-29.477861],[-39.440918,-11.113727]]]
}')
WHERE Id = 6

and this does:

UPDATE Table
SET Shape = ST_GeomFromGeoJSON('{
    "type": “MultiPolygon",
    "coordinates": [[[[-39.440918,-11.113727],[-23.972168,4.981505],[-21.862793,-29.477861],[-39.440918,-11.113727]]]]
}')
WHERE Id = 6

Doesn’t matter if I use GeoJSON or WKB, the results are the same.

What’s the difference between Polygon and MultiPolygon structures and why the first one is not accepted and the second one is?

Running MySQL 5.7.19.

Rent Charter Buses Company
READ ALSO
mysql too long creating sort index and no order by

mysql too long creating sort index and no order by

I am counting data on a big table with LEFT JOIN, this query is taking 24 seconds, I profiled the query to know what is taking that long and I got this:

421
Join 2 queries on same table and add column to result

Join 2 queries on same table and add column to result

I am pretty new to MYSQL and need assistance to complete a query

219
mysql - check if former entry of uid has property

mysql - check if former entry of uid has property

Since this is my first question here, pls be gentle :)

225