Top 5 Recent Articles
ARTICLES CATEGORIES
- Algorithms (22)
- All (399)
- Biography (1)
- Blog (44)
- Business Requirements (1)
- Commentary (1)
- Conversion (2)
- 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) (5)
- Open Source (18)
- Oracle Spatial and Locator (194)
- Partitioning (1)
- PostGIS (36)
- Projections (1)
- Published Articles (1)
- qGIS (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (37)
- Space Curves (9)
- Spatial Database Functions (109)
- Spatial DB comparison (1)
- Spatial XML Processing (11)
- SQL Server Spatial (92)
- Standards (3)
- Stored Procedure (17)
- Tessellation or Gridding (10)
- Tools (2)
- Topological Relationships (1)
- Training (2)
- Triangulation (2)
Free JTS-based Area/Length Functions
One way of providing an area and length capability for Oracle 10g that is free from licensing issues is to use Java Topology Suite’s (JTS) GetArea() and GetLength() functions.
Being as I have already created the framework with the Spatial Companion For Oracle (SC4O) package and installer I have added access to JTS Area and Length to this package.
Here is an example of their use:
SELECT DISTINCT round(SC4O.ST_Area(a.geometry,3),3) AS area, round(sdo_geom.sdo_area(a.geometry,0.0005),3) AS areaSDO, round(SC4O.ST_Length(a.geometry,3),3) AS len, round(sdo_geom.sdo_length(a.geometry,0.0005),3) AS lenSDO, 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... AREA AREASDO LEN LENSDO GEOMETRYTYPE ---------------------- ---------------------- ---------------------- ---------------------- -------------------- 37.5 37.5 27.071 27.071 Area 175 175 84.142 84.142 Area 10959.69 10959.69 558.094 558.094 Area 489449.547 489449.547 4462.934 4462.934 Area 26 26 52 52 Area(Rectangle) 50 50 30 30 Area(Rectangle) 160000 160000 1600 1600 Area(Rectangle) 910000 910000 5200 5200 Area(Rectangle) 0 0 10 10 Line 0 0 25.322 25.322 Line 0 0 27.071 27.071 Line 0 0 32.361 32.361 Line 0 0 1131.371 1131.371 Line 27 27 54.828 54.828 MultiArea 41 41 42.944 42.944 MultiArea 31 31 30 30 MultiArea(Rectangle) 49.5 49.5 41.071 41.071 MultiArea(Rectangle) 320000 320000 3200 3200 MultiArea(Rectangle) 0 0 10 10 MultiLine 0 0 15 15 MultiLine 0 0 30.688 30.688 MultiLine 0 0 0 0 MultiPoint 0 0 0 0 Point . 23 ROWS selected
See my JTS package header description for the call signatures for these functions.
Documentation
- MySQL Spatial General Functions
- Oracle LRS Objects
- Oracle Spatial Exporter (Java + pl/SQL)
- Oracle Spatial Object Functions
- Oracle Spatial Object Functions (Multi Page)
- PostGIS pl/pgSQL Functions
- SC4O Oracle Java Topology Suite (Java + pl/SQL)
- SQL Server Spatial General TSQL Functions
- SQL Server Spatial LRS TSQL Functions