Top 5 Recent Articles
ARTICLES CATEGORIES
- Algorithms (20)
- All (400)
- Biography (1)
- Blog (45)
- Business Requirements (1)
- Commentary (1)
- Customers (2)
- Data Models (1)
- Education (2)
- GeoRaptor (13)
- GPS (1)
- Image Processing (2)
- Import Export (8)
- Licensing (2)
- LiDAR (1)
- Linear Referencing (4)
- Manifold GIS (3)
- Mapping (1)
- MySQL Spatial (7)
- Networking and Routing (including Optimization) (4)
- Open Source (18)
- Oracle Spatial and Locator (193)
- Partitioning (1)
- PostGIS (34)
- Projections (1)
- Published Articles (1)
- qGIS (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (35)
- Space Curves (9)
- Spatial Database Functions (108)
- Spatial DB comparison (1)
- Spatial XML Processing (11)
- SQL Server Spatial (92)
- Standards (3)
- Stored Procedure (15)
- Tessellation or Gridding (10)
- Tools (2)
- Topological Relationships (1)
- Training (2)
- Triangulation (2)
isValid, isSimple, Dimension and CoordDim methods for SDO_Geometry
I have just added to my Java Spatial For Oracle (JS4O) project exposure of the JTS/Jaspa functions for:
- ST_IsValid
- ST_IsSimple
- ST_Dimension
- ST_CoordDim
Here are the type signatures in the JTS PL/SQL package.
FUNCTION ST_IsValid(p_geom IN mdsys.sdo_geometry ) RETURN NUMBER Deterministic; . FUNCTION ST_IsSimple(p_geom IN mdsys.sdo_geometry ) RETURN NUMBER Deterministic; . FUNCTION ST_Dimension(p_geom IN mdsys.sdo_geometry) RETURN NUMBER Deterministic; . FUNCTION ST_CoordDim(p_geom IN mdsys.sdo_geometry) RETURN NUMBER Deterministic;
Here is a test of these functions.
SELECT DISTINCT SC4O.ST_IsValid(a.geometry) AS ST_isValid, SC4O.ST_IsSimple(a.geometry) AS ST_isSimple, SC4O.ST_Dimension(a.geometry) AS ST_Dimension, SC4O.ST_CoordDim(a.geometry) AS ST_CoordDim, CASE WHEN a.geometry.get_gtype() IN (1) THEN 'Point' WHEN a.geometry.get_gtype() IN (5) THEN 'MultiPoint' WHEN a.geometry.get_gtype() IN (2) THEN 'Line' WHEN a.geometry.get_gtype() IN (6) THEN 'MultiLine' WHEN a.geometry.get_gtype() IN (3) AND geom.isRectangle(a.geometry.sdo_elem_info)>0 THEN 'Area(Rectangle)' WHEN a.geometry.get_gtype() IN (3) AND geom.isRectangle(a.geometry.sdo_elem_info)=0 THEN 'Area' WHEN a.geometry.get_gtype() IN (7) AND geom.isRectangle(a.geometry.sdo_elem_info)>0 THEN 'MultiArea(Rectangle)' WHEN a.geometry.get_gtype() IN (7) AND geom.isRectangle(a.geometry.sdo_elem_info)=0 THEN 'MultiArea' ELSE 'Not Supported' END geometryType FROM ORACLE_TEST_GEOMETRIES a WHERE a.geometry IS NOT NULL AND a.geometry.sdo_gtype IS NOT NULL AND a.geometry.get_dims() = 2 AND sdo_geom.validate_geometry(a.geometry, 0.0005) = 'TRUE' AND ( a.geometry.get_gtype() IN (1,5) OR ( a.geometry.sdo_elem_info IS NOT NULL AND geom.isCompound(a.geometry.sdo_elem_info) = 0 ) ) AND a.geometry.get_gtype() <> 4 ORDER BY 5,1,3; -- Results ST_ISVALID ST_ISSIMPLE ST_DIMENSION ST_COORDDIM GEOMETRYTYPE ---------- ----------- ------------ ----------- -------------------- 1 1 2 2 Area 1 1 2 2 Area(Rectangle) 1 0 1 2 Line 1 1 1 2 Line 1 1 2 2 MultiArea 1 1 2 2 MultiArea(Rectangle) 1 0 1 2 MultiLine 1 1 1 2 MultiLine 1 1 0 2 MultiPoint 1 1 0 2 Point . 10 ROWS selected
I hope this is helpful to someone.
Documentation
- MySQL Spatial General Function Documentation
- Oracle LRS Object Documentation
- Oracle Spatial Exporter Package Documentation
- Oracle Spatial Object Function Documentation
- Oracle Spatial Object Function Documentation (Multi Page Version)
- PostGIS pl/pgSQL Function Documentation
- SC4O Oracle Java Topology Suite (Stored Procedures) Package Documentation
- SQL Server Spatial General TSQL Function Documentation
- SQL Server Spatial LRS TSQL Function Documentation