在Oracle数据库中保存多边形 [英] saving a polygon in oracle database

查看:187
本文介绍了在Oracle数据库中保存多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用gps设备捕获了一个图的四个点(坐标).

I have captured four points(coordinate) of a plot using a gps device.

要点1:-纬度-27.54798833长-80.16397166
点2:-纬27.547766,长-80.16450166
点3:-纬27.548131,长-80.164701
点4:----

Point 1:- lat- 27.54798833 long- 80.16397166
Point 2:- lat 27.547766, long- 80.16450166
point 3:- lat 27.548131, long- 80.164701
point 4:- ---

现在我要将这些坐标保存在oracle数据库中,并将其另存为多边形.

now I want to save these coordinate in oracle database which save it as an polygon.

谢谢

推荐答案

如果打算使用Oracle Spatial来存储或处理多边形,则需要将数据存储为SDO_GEOMETRY对象.这是一个简单的示例:

If you're intending to use Oracle Spatial for storage or processing of polygons, then you'll need to store the data as an SDO_GEOMETRY object. Here's a quick example:

CREATE TABLE my_polygons (
  id INTEGER
, polygon sdo_geometry
)
/

INSERT INTO my_polygons (
  id
, polygon
)
VALUES (
  1
, sdo_geometry (
    2003 -- 2D Polygon
  , 4326 -- WGS84, the typical GPS coordinate system
  , NULL -- sdo_point_type, should be NULL if sdo_ordinate_array specified
  , sdo_elem_info_array(
      1    -- First ordinate position within ordinate array
    , 1003 -- Exterior polygon
    , 1    -- All polygon points are specified in the ordinate array
    )
  , sdo_ordinate_array(
      80.16397166, 27.54798833,
    , 80.16450166, 27.547766,
    , 80.164701, 27.548131,
    , 80.16397166, 27.54798833
    )
  )
)
/

这里有关于对象类型的不同标志的更多信息:

There's far more information about the different flags on the object type here: http://docs.oracle.com/cd/B19306_01/appdev.102/b14255/sdo_objrelschema.htm

要注意的重要事项:

  1. 您的源坐标系是什么?您声明GPS-是WGS84(Oracle SRID = 4326)吗?您的GPS设备会告诉您.您可以在表MDSYS.SDO_COORD_REF_SYS
  2. 中为此查找Oracle SRID.
  3. 请确保您的坐标完成了一个完整的多边形(即,回绕到起点).
  4. 您应为多边形外部边界的坐标按逆时针方向排序.
  5. 您可以在几何对象上调用方法st_isvalid(),以快速测试该方法是否有效.在将几何图形呈现给任何其他软件之前,您应确保其有效.
  1. What is your source coordinate system? You state GPS - is it WGS84 (Oracle SRID = 4326)? Your GPS device will tell you. You can look up the Oracle SRID for this in the table MDSYS.SDO_COORD_REF_SYS
  2. Make sure your coordinates complete a full polygon (i.e. loop back around to the starting point).
  3. Your coordinates for a polygon's external boundary should be ordered anticlockwise.
  4. You can call the method st_isvalid() on a geometry object to quickly test whether it is valid or not. You should ensure geometries are valid before presenting them to any other software.

这篇关于在Oracle数据库中保存多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆