Mysql Spatial 空间查询参考
--mysql5.7空间函数列表
https://dev.mysql.com/doc/refman/5.7/en/spatial-function-reference.html
--查询在面内的要素
SELECT tt.OBJECTID, tt.SHAPE FROM ws_pipe_1 tt WHERE st_contains ( ST_PolyFromText ( 'POLYGON((30.284425 119.986703, 30.288573 120.049944, 30.254575 120.047788, 30.23258 119.841321, 30.284425 119.986703))',4490 ), tt.SHAPE );
--查询表是什么坐标系
SELECT ST_SRID(tt.geom) from ws_pipe tt;
--设置mysql空间坐标系
--存在问题,经纬度会反过来 update ws_pipe set geom= st_geomfromtext(st_astext(geom),4490); --正确 update yh_map_valve set geom=ST_GeomFromGeoJSON(st_asgeojson(geom),4490)