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)
Exposing JTS’s Densifier functionality
I created a densify function within my GEOM package in pure PL/SQL many years ago. Today I decided to expose the Java Topology Suite’s (JTS) Densifier functionality via the Spatial Companion For oracle (SC4O) installer and package.
The Densify PL/SQL wrappers I have created are:
/** * Densify * Densifies a geometry using a given distance tolerance, * and respecting the input geometry's PrecisionModel * @param p_geom : sdo_geometry : first geometry subject to MBC calculation * @param p_precision : int : number of decimal places of precision * @param p_distanceTolerance : the distance tolerance to densify * @return SDO_GEOMETRY : The densified geometry * @author Martin Davis, JTS 1.12 * @history Simon Greener, September 2011, Original Coding of wrapper * @copyright : Licensed under a Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Densify(p_geom IN mdsys.sdo_geometry, p_precision IN NUMBER, p_distanceTolerance IN NUMBER) RETURN mdsys.sdo_geometry deterministic; . /** * Densify * Densifies a geometry using a given distance tolerance, * and respecting the input geometry's PrecisionModel * Computations occur in projected space described by p_srid parameter. * @param p_geom : sdo_geometry : first geometry subject to MBC calculation * @param p_precision : int : number of decimal places of precision * @param p_distanceTolerance : double : the distance tolerance to densify * @param p_srid : int : SRID of projected space in which actual overlay occurs before * being projected back to p_geom1.sdo_srid. * @return SDO_GEOMETRY : The densified geometry * @author Martin Davis, JTS 1.12 * @history Simon Greener, September 2011, Original Coding of wrapper * @copyright : Licensed under a Creative Commons Attribution-Share Alike 2.5 Australia License. * http://creativecommons.org/licenses/by-sa/2.5/au/ **/ FUNCTION ST_Densify(p_geom IN mdsys.sdo_geometry, p_precision IN NUMBER, p_distanceTolerance IN NUMBER, p_srid IN NUMBER) RETURN mdsys.sdo_geometry deterministic;
Here is an example using a 3 point line.
SELECT SC4O.ST_Densify(sdo_geometry('LINESTRING(0 0, 10 10, 10 0, 20 10)',0),2,3) AS dGeom FROM dual; -- Results DGEOM ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- MDSYS.SDO_GEOMETRY(2002,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(0,0,2,2,4,4,6,6,8,8,10,10,10,7.5,10,5,10,2.5,10,0,12,2,14,4,16,6,18,8,20,10))
Which looks like …
Here is an example using an optimized rectangle.
SELECT SC4O.ST_Densify(sdo_geometry(2003,NULL,NULL,sdo_elem_info_array(1,1003,3),sdo_ordinate_array(1,1,10,10)),2,3) AS dGeom FROM dual; -- Results DGEOM -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- MDSYS.SDO_GEOMETRY(2003,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(1,1,3.25,1,5.5,1,7.75,1,10,1,10,3.25,10,5.5,10,7.75,10,10,7.75,10,5.5,10,3.25,10,1,10,1,7.75,1,5.5,1,3.25,1,1))
Which looks like ….
I hope this is of interest to someone.
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