1. 程式人生 > >與postgis相關的一些常用的sql

與postgis相關的一些常用的sql

geo value lec insert type point nes table null

create table NODES (ID SERIAL not null,geometry geography(POINTZ, 4326) null);
create table EDGES (ID SERIAL not null,geometry geography(LINESTRINGZ, 4326) null);


insert into nodes(geometry) values(ST_GeographyFromText(‘SRID=4326; POINT(-110 30 40)‘));
insert into edges(geometry) values(ST_GeographyFromText(‘SRID=4326; LINESTRING(-110 30 40,11 22 33)‘));

alter table public.nodes alter column geometry set data type geography(PointZ,4326);

select ST_AsText(geometry) from nodes;
select ST_AsText(geometry) from edges;

  

與postgis相關的一些常用的sql