PostgreSQL_PostGIS_常用空间操作语句(转载)

本文主要是博主一年内PostGIS工作经验的所有精华SQL,每个SQL都仔细研究并优化了10分钟以上,非常实用,请收藏,以后你的工作上会用到。

– 查询每一个格网的人口数,并返回该格网的空间面图层
select expanded_total_population2,gridtag,st_asgeojson(r_sz_all_grid_250.geom) as one_geojson from official_population,r_sz_all_grid_250
where official_population.gid = r_sz_all_grid_250.gridtag and expanded_total_population2> 0

– 根据起点和终点经纬度,创建空间线字段表
create table company_branches_street_geom as
select company_branches_street.*,st_geomfromtext(‘linestring(’||longitude_origin||’ ‘||latitude_origin||’,’||longitude_destination||’ ‘||latitude_destination||’)’,4326) as geom
from company_branches_street

– 根据经纬度,创建空间点字段表
CREATE TABLE patent_geom AS SELECT
patent.*,st_geomfromtext ( ‘POINT(’ || longitude || ’ ’ || latitude || ‘)’, 4326 ) AS geom
FROM patent

– 将gcj02的空间字段转化为wgs84
create table didi_boundary_lines_wgs84_geom as
select geoc_gcj02towgs84(geom) from didi_boundary_lines_geom

原文链接:https://blog.csdn.net/qq_30803353/article/details/108145115?utm_medium=distribute.pc_feed.none-task-blog-personrec_tag-6.nonecase&depth_1-utm_source=distribute.pc_feed.none-task-blog-personrec_tag-6.nonecase&request_id=5f4726f80388ae0b5643d962

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值