Building Lines into Polygons in Oracle Locator / Spatial

The Spatial Companion For Oracle (SC4O) package uses the JTS Topology Suite’s (JTS) geoprocessing/overlay functions to implement free union, intersection, difference and XOR functions for Oracle Locator. SC4O also includes a function called: This function is a wrapper over the JTS’s Polygonizer() class. In essence, this function takes a collection of linestrings/multilinestrings and tries toRead More

Free Union, Intersection, Xor and Difference Functions for Oracle Locator – Part 1

Both the OGC and SQL3/MM Spatial standards for Simple Features include four standard geoprocessing operations as part of the basic type. Here is an extract from the OpenGIS’s Simple Features Specification for SQL, Revision1.1: 2.1.1.3 Methods that support Spatial Analysis … Intersection(anotherGeometry:Geometry):Geometry – Returns a geometry that represents the point set intersection of this GeometryRead More

Finding Intersection Points between Line and Polygon

Today, someone emailed me and asked: I’m using sql developer and oracle spatial to develop my prototype database (I’m really a beginner in SQL), one of my task now is to query parcels (polygon) which crossed by utility pipeline (line) [… and …] to query the intersection point between polygon and line… Can you giveRead More

Free version of sdo_length

For users of 10gR2 Locator not licensed for Spatial, the use of sdo_geom.sdo_length is forbidden. So is use of sdo_geom.sdo_length. However, use of sdo_geom.sdo_distance is allowed for Locator users. The sdo_geom.sdo_distance function can be used to construct an sdo_length alternative function that is fully licensed. Here is one such attempt: A quick and simple test.Read More

Alternative to my SQL based GetNumRings function

When creating a new PL/SQL procedure or function, where possible, I write the algorithm in SQL first. Once the SQL is done, it then becomes comparatively easy to encapsulate the SQL in a PL/SQL procedure or function for generic use. This declarative approach is wonderful as the SQL statement can be developed independently of anyRead More

layer_gtype keyword issue when indexing linear data on 11g

I always recommend the setting of the layer_gtype property in the parameters of an mdsys.spatial_index. I have entered some details on this in a previous blog article. There has been a change to the supported layer_gtype keywords in 11g with the keywords… LINESTRING MULTILINESTRING … no longer being supported. Now, for linestrings and multi-linestrings (xx02,Read More

String Tokenizer for Oracle

UPDATED FUNCTION AT END OF ARTICLE RETURNS SEPARATORS We often have need of string tokenizers in applications. Here is one for Oracle based on work by Pawel Barut. Here are my, simple, tests. Result. token LineString MultiLineString MultiPoint MultiPolygon Point Polygon Result. token The rain in spain stays mainly on the plain Updated Function SometimesRead More

Free Aggregate Method for Concatenating 2D Lines in Oracle Locator 10g

The SDO_AGGR_CONCAT_LINES function in Oracle 10g and above allows for linestrings to be concatenated via GROUP BY SQL clauses. However, this function is only available for Spatial users on Enterprise Edition of the Oracle database 10g (it can be used on 11g). Locator users can, however, use the mdsys.sdo_util.concat_lines function to append two linestrings together.Read More

Reducing 5 Vertex Polygon to Optimized Rectangle

I had occasion to convert a set of 5 vertex polygons that defined grid squares to their optimized rectangle equivalent. To do this I created a simple function as follows. Which can then used as follows: Update On the basis of the excellent comments made by Farid Cheraghi, I have included his rectangle check (whichRead More