mysql将geojson字符串字段保存成MultiPolygon类型字段

不说废话,直接上代码:

update table_name set the_geom = st_geomfromgeojson ( CONCAT ( '{"type": "MultiPolygon", "coordinates": ', geojson, '}' ) ) where geojson is not null;

说明:geojson是保存geojson格式的字段。