zoukankan      html  css  js  c++  java
  • 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)  
  • 相关阅读:
    函数之返回值
    函数之初识函数
    三元运算符
    枚举enumerate
    模块
    迭代器
    斐波那契
    leetcode155 最小栈
    leetcode94 二叉树的中序遍历
    leetcode20 有效的括号
  • 原文地址:https://www.cnblogs.com/lishanyang/p/14283564.html
Copyright © 2011-2022 走看看