1 / 16

PostGIS 空间数据库特性研究

PostGIS 空间数据库特性研究. 1301110450 侯俊 雄. 目录. PostgreSQL 与 PostGIS 简介 PostGIS 空间字段管理 PostGIS 空间数据类型 PostGIS 与 OpenGIS 标准 对比 PostGIS 空间 相关函数 PostGIS 扩展功能 PostGIS 使用方式 与 应用实例 PostGIS 与其他空间数据库的对比. PostgreSQL 和 PostGIS 简介. PostgreSQL 简介

arne
Télécharger la présentation

PostGIS 空间数据库特性研究

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PostGIS空间数据库特性研究 1301110450 侯俊雄

  2. 目录 • PostgreSQL与PostGIS简介 • PostGIS空间字段管理 • PostGIS空间数据类型 • PostGIS与OpenGIS标准对比 • PostGIS空间相关函数 • PostGIS扩展功能 • PostGIS使用方式与应用实例 • PostGIS与其他空间数据库的对比

  3. PostgreSQL和PostGIS简介 • PostgreSQL简介 • PostgreSQL是一种对象-关系型数据库管理系统(ORDBMS),起源于伯克利(BSD)的数据库研究计划,也是目前功能最强大、特性最丰富和最复杂的自由软件数据库系统。 • PostgreSQL是唯一支持事务、子查询、多版本并行控制系统、数据完整性检查等特性的唯一一种自由软件的数据库管理系统。能在多平台下---包括Linux、FreeBSD、Windows等运行,并且支持多语言的开发。 • PostgreSQL中已经定义了一些基本的几何实体类型,包括:点(POINT)、线(LINE)、线段(LSEG)、方形(BOX)、多边形(POLYGON)和圆(CIRCLE)等。 • PostgreSQL定义了一系列的函数和操作符来实现几何类型的操作和运算以及空间数据索引R-tree。

  4. PostgreSQL和PostGIS简介 • PostGIS简介 • PostGIS是对象关系型数据库系统PostgreSQL的一个扩展,提供如空间对象、空间索引(R树索引以及四叉树索引)、空间操作函数和空间操作符等空间信息服务功能。 • PostGIS遵循OpenGIS的规范 • 基于空间对象库GEOS和空间投影库PROJ.4开发 • 支持桌面GIS软件:GRASS、 QGIS、ArcGIS等 • 支持中间件服务器:ArcSDE、MapServer、GeoServer等 • 支持开发库:GeoTools, OGR

  5. PostGIS空间字段管理 Spatial_ref_sys表:

  6. PostGIS空间字段管理 Geometry_Column表:

  7. PostGIS空间数据类型 • PostGIS基本空间数据类型以WKB和WKT为基础,并基于WKB和WKT扩展出了支持投影坐标系定义、3D定义等功能的EWKT与EWKB类型 • EWKT与EWKB带有一个SRID信息字段,可以支持球面坐标或者平面坐标 • WKT实例: • POINT(0 0) • LINESTRING(0 0,1 1,1 2) • POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)) • MULTIPOINT(0 0,1 2) • MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4)) • MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1))) • GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4))

  8. PostGIS空间数据类型 • EWKT实例 • POINT(0 0 0) -- XYZ • SRID=32632;POINT(0 0) -- XY with SRID • POINTM(0 0 0) -- XYM • POINT(0 0 0 0) -- XYZM • SRID=4326;MULTIPOINTM(0 0 0,1 2 1) -- XYM with SRID • MULTILINESTRING((0 0 0,1 1 0,1 2 1),(2 3 1,3 2 1,5 4 1)) • POLYGON((0 0 0,4 0 0,4 4 0,0 4 0,0 0 0),(1 1 0,2 1 0,2 2 0,1 2 0,1 1 0)) • MULTIPOLYGON(((0 0 0,4 0 0,4 4 0,0 4 0,0 0 0),(1 1 0,2 1 0,2 2 0,1 2 0,1 1 0)),((-1 -1 0,-1 -2 0,-2 -2 0,-2 -1 0,-1 -1 0))) • GEOMETRYCOLLECTIONM( POINTM(2 3 9), LINESTRINGM(2 3 4, 3 4 5) ) • MULTICURVE( (0 0, 5 5), CIRCULARSTRING(4 0, 4 4, 8 4) ) • POLYHEDRALSURFACE( ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)), ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) ) • TRIANGLE ((0 0, 0 9, 9 0, 0 0)) • TIN( ((0 0 0, 0 0 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 0 0 0)) )

  9. PostGIS与OpenGIS标准对比 • PostGIS空间数据类型 • 简单类型:Point, LineString, Polygon • 复杂类型:MultiPoint, MultiLineString, MultiPolygon • 复合类型:GeometryCollection • 扩展类型:PointM, LineStringM, PolygonM, MultiPointM, MultiLineStringM, MultiPolygonM, SRID-Geometry, Tinangle, TIN, CircularString, CompoundCURVE, MultiCurve, CurvePolygon, MultiSurface

  10. PostGIS与OpenGIS标准对比

  11. PostGIS空间相关函数 • 空间字段操作函数(AddGeometryColumn, DropGeometryColumn……) • 空间数据存取函数(ST_GeogFromText, ST_GeogFromWKB……) • 空间数据编辑函数(ST_AddPoint, ST_SetPoint……) • 空间数据输出函数(ST_AsText……) • 空间测量函数(ST_Area, ST_Lenth……) • 空间分析函数(ST_Centroid, ST_Boundary, ST_Buffer, ST_Intersection……) • 三维空间分析/数据函数(ST_3DDistance, ST_3DDWithin……) • 长事务支持函数 • 由于PostgreSQL是唯一一个支持事务的开源数据库,而在空间数据处理的过程中存在着大量的耗时操作,PostGIS提供了一系列的长事务支持,可以有效支持复杂的空间分析功能。

  12. PostGIS空间相关函数 • What is the total length of all roads, expressed in kilometers? • SELECT sum(ST_Length(the_geom))/1000 AS km_roads FROM bc_roads; • What is the length of roads fully contained within each municipality? • SELECT m.name, sum(ST_Length(r.the_geom))/1000 as roads_km FROM bc_roadsAS r, bc_municipalityAS m WHERE ST_Contains(m.the_geom,r.the_geom) GROUP BY m.name ORDER BY roads_km; • What is the largest municipality polygon that has a hole? • SELECT gid, name, ST_Area(the_geom) AS area FROM bc_municipality WHERE ST_NRings(the_geom) > 1 ORDER BY area DESC LIMIT 1;

  13. PostGIS扩展功能 • PostGIS栅格数据支持 • PostGIS通过一种新的数据类型片,提供对于大的栅格数据对象的存储。片由以下几个部分组成:包裹矩形框、SRID、类型和一个字节序列。通过将片的大小控制在数据库页值(32×32)以下,使得快速的随即访问变成可能。一般大的图片也是通过将其切成32×32像素的片然后再存储在数据库中的。 • PostGIS栅格数据导入: • 通过raster2pgsql工具导入栅格数据文件 • 通过SQL方法导入栅格数据 • PostGIS栅格数据相关函数: • 栅格存取编辑函数 • 栅格波段存取编辑函数 • 栅格像素编辑函数 • 栅格分析统计函数 • ……

  14. PostGIS扩展功能 • PostGIS三维扩展 • PostGIS对点实体进行了扩展,实现了三维点,同理线实体、面实体也实现了三维话 • PostGIS提供了一系列三维空间数据处理函数,可以实现简单的三维空间分析 • PostGIS的空间聚类分析 • PostGIS提供了一系列的空间聚类分析,例如简单的SUM等等

  15. PostGIS的使用方式 • 作为单纯的空间数据存储数据库使用 • 使用shp2pgsql工具或者SQL函数插入数据,实现空间数据的固化存储 • 通过SQL函数管理、使用数据 • 与GeoServer、ArcSDE协同工作 • 为各种空间数据服务中间件提供数据支持 • 用户不需涉及SQL或者数据本身的使用,只通过中间件使用编辑空间数据

  16. 报告结束,请老师同学们批评指正!

More Related