ST_Azimuth for Oracle: AKA Cogo.Bearing

Many years ago I wrote a Coordinate Geometry (COGO) package for Oracle Sdo_Geometry that contained a Bearing function that, given two points, would return the angle in radians from the horizontal of the vector defined by point A and B. PostGIS has a similar function called “ST_Azimuth”:http://postgis.refractions.net/documentation/manual-svn/ST_Azimuth.html. Here are the relevant declarations of the BearingRead More

Implementing a Translate/ST_Translate/Move function for Oracle Spatial

Many years ago I wrote a PL/SQL function to move any sdo_geometry when supplied a “delta” in terms of deltaX, deltaY and optionally deltaZ. This function also allowed a user to supply an envelope, box or minimum bounding rectangle (MBR) to the function so that only those vertices that lie within an sdo_geometry object wouldRead More

Elem_Info_Array Processing: An alternative to SDO_UTIL.GetNumRings and querying SDO_ELEM_INFO itself

This article is in two parts: 1) on SDO_UTIL.GetNumRings; 2) and an outline of a function to return the element info array in its normalised form. 1. SDO_UTIL.GETNUMRINGS Oracle Spatial, well at release 10g, has an undocumented function in the SDO_UTIL package called GetNumRings. This function takes a polygon geometry object and returns the numberRead More

Minumum Bounding Rectangle (MBR) Object Type for Oracle

Many years ago I wrote a “comprehensive” Minimum Bounding Rectangle (MBR) Object type for Oracle. This provides a lot fo the functionality of the BOX operators for PostGIS. Here is the public interface of the MBR type: Follow the link to download the full implementation of my MBR type for Oracle. An example of theRead More

How to extract elements from the result of an sdo_intersection of two polygons.

This article is about how three things: 1. The fact that the intersection between two polygon (area) can be a combination of points, lines and polygons (a Collection sdo_geometry object). 2. Shows you how to extract a particular object type, in this case a polygon, from a mixed collection that results from an geospatial intersection. 3.Read More

generate_series for SQL Server 2008

A few years ago I wrote an article about implementing the PostgreSQL function, generate_series, in Oracle. This function is really useful for when trying to write SQL/Functions that can be implemented across one or more databases with reasonable ease. Here is the function implemented in SQL Server 2008: Now, let’s test this function. I hopeRead More

How to restart a database after failed parameter change

I thought I would publish a simple set of steps that can be followed to restart an Oracle Database after a parameter change causes the database not to open. Here is an example (on Windows). Let’s assume my database (gisdb) currenly has its compatible parameter set to 10.2.0.4. Because I want to test performance atRead More

Fixing failed spatial indexes after import using data pump

Data pump is a great utility, more flexible and compatible than the old imp/exp utility. One area where it is useful is in the remapping of tablespaces. I often get data from customers in data pump format in which references to tablespaces that I do not have in my Oracle database exist. But this isRead More

Boarder and District Spatial Information Group Presentation on Spatial Datbases

On Tuesday November 11th 2008 I gave a 1 hour presentation on spatial databases entitled An Introduction to Spatial Databases to the Boader and District Spatial Information Group (BADSIG) at Albury NSW. The presentation was rather long as, generally, GIS practitioners are usually unfamiliar with database technology (no fault of their own) and so IRead More

generate_series: an Oracle implementation in light of SQL Design Patterns

There is a very useful function in PostgreSQL called generate_series that can be used to generate a series of integer numbers from some start value to an end value with an optional step value. Here is the function and its description from the PostgreSQL help. Function Argument Type Return Type Description generate_series(start, stop) int orRead More