PostGis 查询

1. 查询一个网格内的所有Feature

select b.*
into build_1090
from huadu b, smallgz3 g
where ST_Intersects(b.the_geom, g.the_geom) AND g."name" = 'Area_1090';


2. 查询相交后的网格
SELECT p.id, b."房高" as height, ST_Intersection(b.the_geom, p.the_geom),
From building b INNER JOIN grids p ON st_intersects(b.the_geom,p.the_geom)
WHERE ST_Overlaps(b.the_geom, p.the_geom)
AND (p.id > 40787660 and p.id < 40787800)
LIMIT 100;

3. 更新地理信息
DROP TABLE mroad_258;

SELECT m.*
INTO mroad_258
FROM main_road as m, smallgz2 as g
WHERE (ST_Overlaps(m.p_geom, g.the_geom) OR st_within(m.p_geom, g.the_geom)) AND
(g.id = 258 OR g.id = 276 OR g.id = 295);
DROP TABLE tmp;

SELECT g.gid
INTO tmp
FROM grid125 as g INNER JOIN mroad_258 as m ON st_intersects(g.the_geom, m.p_geom)
WHERE ST_Overlaps(g.the_geom, m.p_geom) OR ST_Within(g.the_geom, m.p_geom);

UPDATE grid125 as g
SET mroad_type = 1
FROM tmp
WHERE g.gid = tmp.gid;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Create and manage spatial data with PostGIS Key Features Import and export geographic data from the PostGIS database using the available tools Maintain, optimize, and fine-tune spatial data for long-term viability Utilize the parallel support functionality that was introduced in PostgreSQL 9.6 Book Description PostGIS is a spatial database that integrates the advanced storage and analysis of vector and raster data, and is remarkably flexible and powerful. PostGIS provides support for geographic objects to the PostgreSQL object-relational database and is currently the most popular open source spatial databases. If you want to explore the complete range of PostGIS techniques and expose related extensions, then this book is for you. This book is a comprehensive guide to PostGIS tools and concepts which are required to manage, manipulate, and analyze spatial data in PostGIS. It covers key spatial data manipulation tasks, explaining not only how each task is performed, but also why. It provides practical guidance allowing you to safely take advantage of the advanced technology in PostGIS in order to simplify your spatial database administration tasks. Furthermore, you will learn to take advantage of basic and advanced vector, raster, and routing approaches along with the concepts of data maintenance, optimization, and performance, and will help you to integrate these into a large ecosystem of desktop and web tools. By the end, you will be armed with all the tools and instructions you need to both manage the spatial database system and make better decisions as your project's requirements evolve. What you will learn Import and export geographic data from the PostGIS database using the available tools Structure spatial data using the functionality provided by a combination of PostgreSQL and PostGIS Work with a set of PostGIS functions to perform basic and advanced vector analyses Connect PostGIS with Python Learn to use programming frameworks around PostGIS Maintain, optimize, and fine-tune spatial data for long-term viability Explore the 3D capabilities of PostGIS, including LiDAR point clouds and point clouds derived from Structure from Motion (SfM) techniques Distribute 3D models through the Web using the X3D standard Use PostGIS to develop powerful GIS web applications using Open Geospatial Consortium web standards Master PostGIS Raster Who This Book Is For This book is for developers who need some quick solutions for PostGIS. Prior knowledge of PostgreSQL and spatial concepts would be an added advantage. Table of Contents Chapter 1. MOVING DATA IN AND OUT OF POSTGIS Chapter 2. STRUCTURES THAT WORK Chapter 3. WORKING WITH VECTOR DATA THE BASICS Chapter 4. WORKING WITH VECTOR DATA ADVANCED RECIPES Chapter 5. WORKING WITH RASTER DATA Chapter 6. WORKING WITH PGROUTING Chapter 7. Into the Nth Dimension Chapter 8. POSTGIS PROGRAMMING Chapter 9. POSTGIS AND THE WEB Chapter 10. MAINTENANCE OPTIMIZATION AND PERFORMANCE TUNING Chapter 11. USING DESKTOP CLIENTS Chapter 12. Introduction to Location Privacy Protection Mechanisms
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值