zoukankan      html  css  js  c++  java
  • 【Postgres】根据字段数据创建空间字段

    
    
    --添加空间字段
    SELECT AddGeometryColumn ('GIS', '四至', 4326, 'POLYGON', 2);
    
    --根据其他字段更新空间字段数据
    update "GIS" b 
    set "四至"=ST_GeomFromText ('POLYGON((' || to_char(a."东经起",'999.9999') || to_char(a."北纬起",'999.9999') || ',' || to_char(a."东经止",'999.9999') || to_char(a."北纬起",'999.9999') || ',' || to_char(a."东经止",'999.9999') || to_char(a."北纬止",'999.9999') ||',' || to_char(a."东经起",'999.9999') || to_char(a."北纬止",'999.9999') || ',' || to_char(a."东经起",'999.9999') || to_char(a."北纬起",'999.9999') || '))',4326)
    from "GIS" a
    where b."ID"=a."ID"
    
    --创建索引
    CREATE INDEX shape_index_sz1
    ON "GIS"
    USING gist
    (四至); 
    
    --查询与指定范围相交的多边形
    SELECT * FROM "GIS" where 
    ST_Intersects(
    ST_GeomFromText('POLYGON((86 44.1667,87.3333 44.1667,87.3333 45.1667,86 45.1667,86 44.1667))'), ST_GeomFromText(ST_AsText("四至")))
    
     
  • 相关阅读:
    12306.cn网站自动登录器源代码
    从IL看C#
    CanvasRenderingContext2Dhtml5的关键
    慎用Response.Write()
    JPanel 的getGraphics
    怎么用swing绘图
    Win7 双硬盘启动出错处理
    paint repaint实现动画
    多线程一例
    画图,橡皮
  • 原文地址:https://www.cnblogs.com/defineconst/p/10855022.html
Copyright © 2011-2022 走看看