空间数据库(Spatial Database)用于存储、查询点、线、面的空间对象。

为什么需要空间数据库(组件)

做一个区域的人口普查,不仅仅记录人口信息,还需要记录区域地理信息,通过空间数据库字段可以非常快速实现记录和查询。

普通的数据库存储也能做,但因为不能存储复杂的空间几何信息,但方案就非常复杂了,对于上图的人口普查,至少需要三张表来实现。

主流空间数据的存储解决方案

不同数据库空间支持和应用情况的对比可见:

Compare SQL Server 2008 R2, Oracle 11G R2, PostgreSQL/PostGIS 1.5 Spatial Features

GIS: PostGIS/PostgreSQL vs. MySql vs. SQL Server?

毫无疑问,PostgreSQL+PostGIS是当前最主流的地理存储解决方案了,PostgreSQL性能表现优异,而且最重要还免费,怎么可能不流行。

(但因为所在公司历史情况,基本都用的是Oracle数据库,所以我们还必须采用Oracle Spatial作为我们的地理信息存储方式)。

Oracle Spatial

Oracle Spatial 是Oracle企业版提供的一个扩展产品,它具有专门的空间数据管理功能,用于存储、查询点、线、面的空间对象。

ps: MapViewer is a J2EE service for rendering maps using spatial data managed by Oracle's Spatial option. MapViewer hides the complexity of spatial data queries and cartographic rendering.

Oracle Spatial的版本进化

Oracle Spatial was previously known as SDO and before that as MultiDimension. A brief history:

  • Spatial data capabilities as modification shipped by scientists working with the Canadian Hydrographic Service (CHS) to Oracle 4.

  • Spatial Data Option (SDO) shipped in Oracle 7.3.3.

  • Spatial introduced it's object type in Oracle 8.1.5.

  • Spatial added Java Classes, Projections, Linear Referencing and R-Tree Indexing in Oracle 8.1.7.

  • Spatial added Whole Earth Geometry Model, Function-based indexes, Object replication, Partitioning in Oracle 9i.

  • Spatial added Geocoder, GeoRaster, Network Data Model, Topology, Spatial Analytic Functions and Routing engine in Oracle 10g.

  • Spatial added 3D Support and Web Services in Oracle 11g.

  • Oracle Application Server MapViewer first shipped in AS 9.0.2

  • MapViewer current release is FMW Version 10.1.3.3 Patch 5

Oracle Spatial License

Oracle Spatial is only available with Oracle Enterprise Edition as a separately licensed option.

见:Licensing Information

Oracle Spatial支持的空间几何类型

Oracle Spatial提供了三种最主要的几何类型(点、线、面世以及由这些几何类型对象组合而成的集合。这三种几何类型又可分为简单点(只有一个点)、点群(有多个点)、简单线(只有一条线)、线群(有多条线)、简单面(只有一个面)、面群(有多个面)。

Oracle Spatial Architecture

Overview of Oracle Spatial:www.oracle.com/technetwork/testcontent/spatial-ch2-129768.pdf

• Data model: Oracle Spatial uses a SQL data type, SDO_GEOMETRY, to store spatial data inside an Oracle database. Users may define tables containing columns of type SDO_GEOMETRY to store the locations of customers, stores, restaurants, and so on, or the locations and spatial extents of geographic entities such as roads, interstates, parks, and land parcels. This data type is described in detail in Chapter 4.

• Location enabling: Users can add SDO_GEOMETRY columns to application tables. This process is described in detail in Chapter 3. Users can populate the tables with SDO_GEOMETRY data using standard Oracle utilities such as SQL*Loader, Import, and Export. This process is described in Chapter 5. Alternatively, users can convert implicit spatial information,such as street addresses, into SDO_GEOMETRY columns using the geocoder component of Oracle Spatial, as described in Chapter 6.

• Spatial query and analysis: Users can query and manipulate the SDO_GEOMETRY data using the query and analysis component, comprising the Index and Geometry Engines. Full details of this process are given in Chapters 8 and 9.

• Advanced Spatial Engine: This component comprises several components that cater to sophisticated spatial applications, such as GIS and bioinformatics. This includes, for example, the GeoRaster component that allows storage of spatial objects using images (groups of pixels) rather than points, lines, and vertices. These components are covered in Appendixes A through D.

• Visualization: The Application Server components of Oracle’s spatial technology include the means to visualize spatial data via the MapViewer tool. MapViewer renders the spatial data that is stored in SDO_GEOMETRY columns of Oracle tables as displayable maps. This feature is described in detail in Chapter 11

一个最简单的示例-地图POI及地理坐标

建表

CREATE TABLE us_restaurants_new

(

id NUMBER,

poi_name VARCHAR2(32),

location SDO_GEOMETRY -- New column to store locations

);

插入样例记录

INSERT INTO us_restaurants_new VALUES

(

1,

'PIZZA HUT',

SDO_GEOMETRY

(

2001, -- SDO_GTYPE attribute: "2" in 2001 specifies dimensionality is 2.

NULL, -- other fields are set to NULL.

SDO_POINT_TYPE -- Specifies the coordinates of the point

(

-87, -- first ordinate, i.e., value in longitude dimension

-78, -- second ordinate, i.e., value in latitude dimension

NULL -- third ordinate, if any

),

NULL,

NULL

)

);

数据模型 - SDO_GEOMETRY

Oracle Spatial的空间数据都存储在空间字段SDO_GEOMETRY中,理解SDO_GEOMETRY是编写Oracle Spatial程序的关键。

Oracle Spatial定义的SDO_GEOMETRY类型为:

CREATE TYPE SDO_GEOMETRY AS OBJECT (

SDO_GTYPE   NUMBER,  //前面字符串为字段名;后面字符串为字段类型

SDO_SRID    NUMBER,

SDO_POINT    SDO_POINT_TYPE,

SDO_ELEM_INFO    SDO_ELEM_INFO_ARRAY,

SDO_ORDINATES    SDO_ORDINATE_ARRAY);

其中SDO_GEOMETRY AS OBJECT ,标识该类型为对象类型。

SDO_GEOMETRY是按照Open GIS规范定义的一个对象,其原始的创建方式如下所示。

SDO_GEOMETRY中各字段类型说明建议阅读:《Oracle Spatial空间信息管理》第4章SDO_GEOMETRY数据类型

1、SDO_GTYPE :表示要存储的几何类型,如点线面。它是通过 NUMBER类型来表达的;

2、SDO_SRID :几何的空间参考坐标系,类型也为 NUMBER;

3、SDO_POINT :如果几何类型点类型的话,就是存储点坐标,否则为空。oracle自定义的SDO_POINT_TYPE类型;

4、SDO_ELEM_INFO :定义要如何理解SDO_ORDINATES中的坐标串的;

5、SDO_ORDINATES :存储实际坐标的,以X、Y以及不同点之间都是逗号隔开;

属性:SDO_GTYPE

描述建模对象的几何形状类型, 通过不同的值来决定所表示的几何体是点、线串、多边形、多重点、多重多边形、多重线串还是一个任意的集合,比如:2003,2001,3006。 SDO_GTYPE是一个4位的数字,结构为D00T。第一位和最后一位根据几何体的维数和形状采用不同的值,如表4-1所示。第二位和第三位通常被设成0。

D(几何体的维度)

2 =二维,3 =三维,4 =四维

T(几何体的形状/类型)

0 =无解释类型,1 =点,5 =多重点,

2 =线串,6 =多重线串,3 =多边形/面,

7 =多重多边形/多重面,4 =集合,

8 =立方体,9 =多重立方体

属性:SDO_SRID

SDO_SRID定义了空间坐标参考系统。如果SDO_SRID为null,则没有指定坐标系统,如果SDO_SRID不为null,那么它的值必须在在MDSYS.CS_SRS 表中的 SRID 列有对应的值,而且它的值必须插入USER_SDO_GEOM_METADATA视图中。

属性:SDO_POINTS

详见:http://book.51cto.com/art/200910/157432.htm

  1. SQL> INSERT INTO geometry_examples (name, description, geom) VALUES

  2. (

  3. 'POINT',

  4. '2-dimensional Point at coordinates (-79,37) with srid set to 8307',

  5. SDO_GEOMETRY

  6. (

  7. 2001, -- SDO_GTYPE format: D00T. Set to 2001 for a 2-dimensional point

  8. 8307, -- SDO_SRID (geodetic)

  9. SDO_POINT_TYPE

  10. (

  11. -79, -- ordinate value for Longitude

  12. 37, -- ordinate value Latitude

  13. NULL -- no third dimension (only 2 dimensions)

  14. ),

  15. NULL,

  16. NULL

  17. )

  18. );

属性:SDO_ELEM_INFO和SDO_ORDINATES

如果你想要存储比点更复杂的元素,也许想要存储线串和多边形(这可能需要很多个顶点)。

要想存储这些类型,你就会用到SDO_ORDINATES和SDO_ELEM_INFO这两个属性。详见:http://book.51cto.com/art/200910/157433.htm

参考

Oracle Spatial

https://de.slideshare.net/camporasimone/oracle-spatial?qid=876c77a2-55d9-43c1-bd38-282cabffc5dd&v=&b=&from_search=

Oracle Spatial的GIS空间数据模型

https://malagis.com/oracle-spatial-gis-spatial-data-model.html

Oracle Spatial

http://www.orafaq.com/wiki/Spatial

Spatial FAQ

http://www.orafaq.com/wiki/Spatial_FAQ

Oracle Spatial and Graph. Jayant Sharma Director

http://docplayer.net/13656744-Oracle-spatial-and-graph-jayant-sharma-director-product-management.html

Introduction to Oracle Spatial

https://de.slideshare.net/ehamzei/introduction-to-oracle-spatial?qid=876c77a2-55d9-43c1-bd38-282cabffc5dd&v=&b=&from_search=2

Raster Algebra mit Oracle Spatial und uDig

https://de.slideshare.net/kpatenge/raster-algebra-mit-oracle-spatial-und-udig?qid=876c77a2-55d9-43c1-bd38-282cabffc5dd&v=&b=&from_search=3

深入浅出Oracle Spatial相关推荐

  1. oracle和arcgis优势,Oracle spatial 使用的一些感受

    最近由于项目需求,要实现Oracle数据源,主要是Oracle Spatial .虽然之前写过PostGIS和Sqlite的,但是对Oracle基本上算一无所知.刚开始接触的那几天,头都大了,Orac ...

  2. shp转oracle spatial

    2010年12月1日 终于搞定了shp到oracle spatial,说下步骤和感受吧! 1 XP系统:转换工具的下载(shp2sdo.exe ):下载后把此文件复制到PATH变量包含的目录下(E:\ ...

  3. oracle spatial(一)开端

    如今的互联网时代,貌似人和人之间,商业活动之间的交流受地理位置的限制越来越小.但实质上,互联网使数字世界和地理世界联系的越来越紧密.跟踪业务的组成部分和分析它们已成为更为重要的事情.地理空间位置信息是 ...

  4. OCCI读写Oracle Spatial的SDO_Geometry

    1.使用Oracle OTT工具生成对应的C++类. 1.1设置ORACLE_HOME:服务器端安装目录. 设置客户端安装目录,提示什么java错误. 暂时不管了. 1.2写一个intype文件tes ...

  5. Oracle spatial 周边查询SQL

    查询距某一点某一距离的所有要素(即我们通常说的周边查询)sql: select t.objectid,t.comp_type,t.datatype,t.comp_name,t.health_lic,t ...

  6. oracle spatial 数据导入_【转】 Oracle Spatial 基本操作

    原文链接: http://www.cnblogs.com/frogbag/archive/2007/10/17/926870.html,感谢作者. 基本操作比较全面,包括建表.建索引和查询. Step ...

  7. 链接oracle spatial,oracle spatial初试

    一.下载shp2sdo 工具,将工具放在 oracle按照目录下的bin目录下 oracle的bin目录一般为:D:\app\***\product\11.2.0\dbhome_2\BIN 或者:在开 ...

  8. oracle 空间数据字段,Oracle spatial创建空间数据的字段详解

    Oracle spatial Oracle spatial主要通过sdo_geometry来储存空间信息,主要有五个参数 SDO_GTYPE    number SDO_SRID number SDO ...

  9. Oracle Spatial 翻译第一漳

    叶科峰本科毕业设计的翻译部分,我稍微改了一下,也放进来.内容是Oracle Spatial 文档的第一部分,<基本概念>,也可能是最重要的部分. 空间概念<?xml:namespac ...

最新文章

  1. 序列处理工具|Seqkit
  2. Nginx启动提示找不到libpcre.so.1解决方法
  3. Aspose.Cells小实例
  4. java自动猜测文件编码
  5. SQLite移植手记1
  6. 探索适用于Apache Spark的Spline Data Tracker和可视化工具(第2部分)
  7. 禁用win10触摸屏手势_笔记本WIN10系统启用或关闭触控板的多指(多点)触控功能步骤...
  8. 【最小开发板】Attiny85开发与实践
  9. CommandNotFoundError: Your shell has not been properly configured to use ‘conda deactivate‘.
  10. 计算机网络谢希仁第七版课后习题答案(第七章)
  11. 抖音04开头xgorgon、xlog、设备注册算法
  12. iphone控制中心自定义没有计算机,如何在iPhone上自定义iOS 11控制中心功能
  13. 内网异地备份_服务器数据全自动异地备份解决方案
  14. 数据结构之二叉树 一
  15. NAS群晖DSM 进阶教程 篇三:DSM 4458 升级 DSM 4493 update7
  16. Day74~75_Flink(一)Flink基础核心知识
  17. [ZT]JavaScript+div实现模态对话框[修正版]
  18. android path 画星星
  19. 服务器放在北极什么位置,服务器放在北极和深海,是谁给了你勇气?
  20. java波斯王子武者之心,波斯王子武者之心

热门文章

  1. 工业互联网:7  项目生命周期管理(1)
  2. 【Android -- 架构】MVP 模式
  3. win7电脑给手机开热点流程
  4. 3d图形设计计算机配置,3d建模电脑配置要求高吗?这样配电脑不多花一分钱
  5. amCharts 5.2.31 Crack
  6. RTL设计(6)- 伪随机数生成器
  7. html table的边框线怎么变圆角_CSS如何设置html table表格边框样式
  8. nginx本地代理调试微信登录(window版本)
  9. SHELL DATE 命令详解
  10. 如何使用 Firebase 建立短網址?