Go to content Go to navigation and search

Home

Current Oracle Spatial Blog Articles


Search

Browse

RSS / Atom

Email me

textpattern

Creative Commons License
All Blog Articles, Data Models and Free Source Code by Simon Greener, The SpatialDB Advisor is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

isValid, isSimple, Dimension and CoordDim methods for SDO_Geometry

Tuesday January 31 2012 at 20:00

KeywordsST_IsValid ST_IsSimple,ST_Dimension ST_CoordDim
Summary

This article describes the exposure of the IsValid, IsSimple, Dimension and CoordDim Jts and Jaspa methods for use with Oracle 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 sigatures in the JTS PL/SQL package.

  1.   FUNCTION ST_IsValid(p_geom IN mdsys.sdo_geometry )
  2.     RETURN NUMBER Deterministic;
  3. .
  4.   FUNCTION ST_IsSimple(p_geom IN mdsys.sdo_geometry )
  5.     RETURN NUMBER Deterministic;
  6. .
  7.   FUNCTION ST_Dimension(p_geom IN mdsys.sdo_geometry)
  8.     RETURN NUMBER Deterministic;
  9. .
  10.   FUNCTION ST_CoordDim(p_geom IN mdsys.sdo_geometry)
  11.     RETURN NUMBER Deterministic;

Here is a test of these functions.

  1. SELECT DISTINCT
  2.        JTS.ST_IsValid(a.geometry) AS ST_isValid,
  3.        JTS.ST_IsSimple(a.geometry) AS ST_isSimple,
  4.        JTS.ST_Dimension(a.geometry) AS ST_Dimension,
  5.        JTS.ST_CoordDim(a.geometry) AS ST_CoordDim,
  6.        CASE WHEN a.geometry.get_gtype() IN (1) THEN 'Point'
  7.             WHEN a.geometry.get_gtype() IN (5) THEN 'MultiPoint'
  8.             WHEN a.geometry.get_gtype() IN (2) THEN 'Line'
  9.             WHEN a.geometry.get_gtype() IN (6) THEN 'MultiLine'
  10.             WHEN a.geometry.get_gtype() IN (3) AND geom.isRectangle(a.geometry.sdo_elem_info)>0 THEN 'Area(Rectangle)'
  11.             WHEN a.geometry.get_gtype() IN (3) AND geom.isRectangle(a.geometry.sdo_elem_info)=0 THEN 'Area'
  12.             WHEN a.geometry.get_gtype() IN (7) AND geom.isRectangle(a.geometry.sdo_elem_info)>0 THEN 'MultiArea(Rectangle)'
  13.             WHEN a.geometry.get_gtype() IN (7) AND geom.isRectangle(a.geometry.sdo_elem_info)=0 THEN 'MultiArea'
  14.             ELSE 'Not Supported'
  15.         END geometryType
  16.   FROM ORACLE_TEST_GEOMETRIES a
  17.  WHERE a.geometry IS NOT NULL
  18.    AND a.geometry.sdo_gtype IS NOT NULL
  19.    AND a.geometry.get_dims() = 2
  20.    AND sdo_geom.validate_geometry(a.geometry, 0.0005) = 'TRUE'
  21.    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 ) )
  22.    AND a.geometry.get_gtype() <> 4
  23.   ORDER BY 5,1,3;
  24. -- Results
  25. ST_ISVALID ST_ISSIMPLE ST_DIMENSION ST_COORDDIM GEOMETRYTYPE
  26. ---------- ----------- ------------ ----------- --------------------
  27. 1          1           2            2           Area
  28. 1          1           2            2           Area(Rectangle)
  29. 1          0           1            2           Line
  30. 1          1           1            2           Line
  31. 1          1           2            2           MultiArea
  32. 1          1           2            2           MultiArea(Rectangle)
  33. 1          0           1            2           MultiLine
  34. 1          1           1            2           MultiLine
  35. 1          1           0            2           MultiPoint
  36. 1          1           0            2           Point
  37. .
  38.  10 ROWS selected

I hope this is helpful to somone.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 sigatures in the JTS PL/SQL package.

Creative Commons License

post this at del.icio.uspost this at Diggpost this at Technoratipost this at Redditpost this at Farkpost this at Yahoo! my webpost this at Windows Livepost this at Google Bookmarkspost this to Twitter

Comment