MySQL 5.7 came out with support for JSON, improved geometry, and virtual columns. Here's an example showing them all playing together.
Download citylots.json.
It comes as one big object, so we'll break it up into separate
lines:
grep "^{ .type" citylots.json > properties.json
Connect to a 5.7 instance of MySQL.
CREATE TABLE citylots (id serial, j json, p geometry as
(ST_GeomFromGeoJSON(j, 2)));
LOAD DATA LOCAL INFILE 'properties.json' INTO TABLE citylots
(j);
A few of the rows don't contain useful data:
DELETE FROM citylots WHERE j->'$.geometry.type' IS
NULL;
In …
[Read more]