zoukankan      html  css  js  c++  java
  • POSTGIS增删改查 点、线、面表

    一、点表(3857坐标系)

    1.建表

        创建包含空间数据的表mytable。

    CREATE TABLE pointtable ( 
      id SERIAL PRIMARY KEY,
      name VARCHAR(128),
       geom GEOMETRY(Point, 3857)
    );
    

      

    2.添加GIST索引

    CREATE INDEX pointtable_gix ON pointtable USING GIST (geom); 
    

      

    3.插入数据

    INSERT INTO pointtable (NAME, geom)
    VALUES
        (
            'p1',
            st_transform (
                ST_GeomFromText ('POINT(105.1 30)', 4326),
                3857
            )
        );
    
    INSERT INTO pointtable (NAME, geom)
    VALUES
        (
            'p2',
            st_transform (
                ST_GeomFromText ('POINT(105.2 30)', 4326),
                3857
            )
        );
    
    INSERT INTO pointtable (NAME, geom)
    VALUES
        (
            'p3',
            st_transform (
                ST_GeomFromText ('POINT(105.3 30)', 4326),
                3857
            )
        );

    4.字段自增

    alter table "public"."user" alter column id set default nextval('userTable_id_seq');
    
    CREATE SEQUENCE userTable_id_seq
    START WITH 2
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
  • 相关阅读:
    swing加载图片
    能有效解决问题的提问方法
    资源在线汇总
    如何赢得别人的尊重
    算法总结
    软件工程概述
    java语言基础汇总
    DEBUG技巧汇总
    web技术发展历程
    java中BufferedImage类的用法
  • 原文地址:https://www.cnblogs.com/lishanyang/p/14704107.html
Copyright © 2011-2022 走看看