我是用ORACLE SPATIAL进行地图数据管理里的。我现在需要实现在一个自定义的矩形区内将所有实体的坐标查询出来,而ORACLE SPATIAL是用一个类型GEOLOC(SDO_GTYPE,SDO_SRID,SDO_POINT(X,Y,Z),SDO_ELEM_INFO,SDO_ORDINATES)来存放的。数据例如下:
 SDO_GEOMETRY(3,NULL,SDO_POINT_TYPE(104.038363,31.9384623,NULL),SDO_ELEM_INFO_ARRAY(1,3,1),SDO_ORDINATE_ARRAY(104.357906,31.865439,104.987655,31.875544,.....))
请问
1、有什么办法得到这些坐标值呢?
2、ORACLE SPATIAL中提供了一些空间查询的函数比如mdsys.sdo_filter之类的在哪里可以用呢?MAPX中用得到吗?还是只有在MAPbasic中用呢?MAPX 之类的是不是也本身有矩形选择函数呢?或者有没有什么别的方法存放数据并能很快的得到矩形区内对象的坐标的方法呢?
感谢万分拉!

解决方案 »

  1.   

    SDO_FILTER
    FormatSDO_FILTER(geometry1, geometry2, params);DescriptionUses the spatial index to identify either the set of spatial objects that are likely to interact spatially with a given object (such as an area of interest), or pairs of spatial objects that are likely to interact spatially. Objects interact spatially if they are not disjoint.This operator performs only a primary filter operation. The secondary filtering operation, performed by the SDO_RELATE operator, can be used to determine with certainty if objects interact spatially.Keywords and ParametersValue Description 
    geometry1 Specifies a geometry column in a table. The column must be spatially indexed.
    Data type is MDSYS.SDO_GEOMETRY. 
    geometry2 Specifies either a geometry from a table or a transient instance of a geometry. (Specified using a bind variable or SDO_GEOMETRY constructor.)
    Data type is MDSYS.SDO_GEOMETRY. 
    PARAMS Determines the behavior of the operator. Data type is VARCHAR2. 
    querytype Specifies valid query types: WINDOW or JOIN. This is a required parameter. 
    WINDOW is recommended in almost all cases. WINDOW implies that a query is performed for every geometry1 candidate geometry to be compared with geometry2. WINDOW can be used to compare a single geometry (geometry2) to all the geometries in a column (geometry1).JOIN is rarely used. Use JOIN when you want to compare all the geometries of a column to all the geometries of another column. JOIN implies that geometry2 refers to a table column that must have a spatial index built on it. (See the Usage Notes for additional requirements.)
     
    idxtab1 Specifies the name of the index table, if there are multiple spatial indexes, for geometry1. 
    idxtab2 Specifies the name of the index table, if there are multiple spatial indexes, for geometry2. Valid only if querytype is JOIN. ReturnsThe expression SDO_FILTER(arg1, arg2, arg3) = 'TRUE' evaluates to TRUE for object pairs that are non-disjoint, and FALSE otherwise.Usage NotesSDO_FILTER is the only operator that can be used with data that is indexed using more than two dimensions. The operator considers all dimensions specified in the spatial index.The operator must always be used in a WHERE clause and the condition that includes the operator should be an expression of the form SDO_FILTER(arg1, arg2, arg3) = 'TRUE'.If querytype is WINDOW, geometry2 can come from a table or be a transient SDO_GEOMETRY object (such as a bind variable or SDO_GEOMETRY constructor).If the geometry2 column is not spatially indexed, the operator indexes the query window in memory and performance is very good.If the geometry2 column is spatially indexed with the same SDO_LEVEL value as the geometry1 column, the operator reuses the existing index, and performance is very good or better.If the geometry2 column is spatially indexed with a different SDO_LEVEL value than the geometry1 column, the operator reindexes geometry2 in the same way as if there were no index on the column originally, and then performance is very good.If two or more geometries from geometry2 are passed to the operator, the ORDERED optimizer hint must be specified, and the table in geometry2 must be specified first in the FROM clause.If querytype is JOIN:geometry2 must be a column in a table.For best performance, both geometry1 and geometry2 should have the same type of index (R-tree or quadtree); and if the geometries have quadtree indexes, the indexes should have the same sdo_level value. If the geometries do not have the same index type (and for quadtree indexes the same sdo_level value), geometry2 is reindexed to be indexed as geometry1 (with the considerations listed for querytype = WINDOW), and performance is less efficient.If geometry1 and geometry2 are based on different coordinate systems, geometry2 is temporarily transformed to the coordinate system of geometry1 for the operation to be performed, as described in Section 5.7.1.The layer_gtype keyword for PARAMS has been deprecated, and it is ignored if specified. The operator automatically optimizes its behavior based on the SDO_GTYPE value (explained in Section 2.2.1) of the geometries, which can be specified using the layer_gtype keyword in the parameters for the CREATE INDEX or ALTER INDEX REBUILD statement.ExamplesThe following example selects the GID values from the POLYGONS table where the GEOMETRY column objects are likely to interact spatially with the GEOMETRY column object in the QUERY_POLYS table that has a GID value of 1.SELECT A.gid 
      FROM Polygons A, query_polys B 
      WHERE B.gid = 1 
      AND SDO_FILTER(A.Geometry, B.Geometry, 'querytype = WINDOW') = 'TRUE';The following example selects the GID values from the POLYGONS table where the GEOMETRY column object is likely to interact spatially with the geometry stored in the aGeom variable.Select A.Gid
      FROM Polygons A 
      WHERE SDO_FILTER(A.Geometry, :aGeom, 'querytype=WINDOW') = 'TRUE';The following example selects the GID values from the POLYGONS table where the GEOMETRY column object is likely to interact spatially with the specified rectangle having the lower-left coordinates (x1,y1) and the upper-right coordinates (x2, y2).Select A.Gid 
      FROM Polygons A 
      WHERE SDO_FILTER(A.Geometry, mdsys.sdo_geometry(2003,NULL,NULL,
                                       mdsys.sdo_elem_info_array(1,1003,3),
                                       mdsys.sdo_ordinate_array(x1,y1,x2,y2)),
                         'querytype=WINDOW') = 'TRUE';The following example selects the GID values from the POLYGONS table where the GEOMETRY column object is likely to interact spatially with any GEOMETRY column object in the QUERY_POLYS table. In this example, the ORDERED optimizer hint is used and QUERY_POLYS (geometry2) table is specified first in the FROM clause, because multiple geometries from geometry2 are involved (see the Usage Notes)SELECT /*+ ORDERED */
      A.gid 
      FROM query_polys B, polygons A 
      WHERE SDO_FILTER(A.Geometry, B.Geometry, 'querytype = WINDOW') = 'TRUE';The following example selects the GID values from the POLYGONS table where the GEOMETRY column object is likely to interact spatially with any GEOMETRY column object in the QUERY_POLYS table. In this example, the QUERY_POLYS.GEOMETRY column must be spatially indexed.SELECT A.gid 
      FROM Polygons A, query_polys B 
      WHERE SDO_FILTER(A.Geometry, B.Geometry, 'querytype = JOIN') = 'TRUE';Related TopicsSDO_RELATE
      

  2.   

    以下是关于ORACLE SPATIAL 的User's Guide 
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96630/toc.htm楼上,本人请问SPATIAL作用用于哪方面?
      

  3.   

    ORACLE SPATIAL主要用于GIS的海量数据存储,即能把空间和属性数据都存放在ORACLE中,但现在应用中还在摸索。请你多帮忙拉?
      

  4.   

    问:
    从一张大范围的地图中,选择下载一个矩形范围内的所有对象的坐标该怎么写?select *(什么东东) from "SYSTEM"."BUILDING"(这里应该是所有的表吧) where mdsys.sdo_filter (BUILDING.GEOLOC, mdsys.sdo_geometry (3, null, null,  mdsys.sdo_elem_info_array (1,3,3), mdsys.sdo_ordinate_array (34880,27710,35380,28410)), 'querytype=WINDOW') = 'TRUE’怎么写呢?