Go to content Go to navigation and search


Current Oracle Spatial Blog Articles

    Using Oracle's ST_GEOMETRY type hierarchy with SDO_GEOMETRY: ST_PointN and ST_NumPoints
    Making Sdo Geometry Metadata
    SC4O Test log
    The Frontage Problem: Creating references from land parcel street frontage boundary to point in street
    Scheduling the Export of Spatial Data in Oracle to a Shapefile each night
    Oracle CENTROID package update
    Book: "Applying And Extending Oracle Spatial"
    Create Polygons and Linestrings From Bearings And Distances (COGO)
    Simple Implementation Of Travelling Salesman Problem
    ST_Densify for Object PLSQL
    PLSQL ST_AsEWKT and ST_FromWKT Functions For Oracle (any version)
    Useful Package of Wrapper Functions for Sdo_Util.AffineTransforms
    GeoRaptor 4.x Update 2 (Project has Stalled)
    Tip: Drop that Spatial Index!
    Convert Single Geometry to Multi-part Geometry in Oracle Spatial
    Optimized Rectangle to 5 Point Polygon
    Centroid Package now supports Y ordinate seeding
    Convert GeoJSON document to Sdo_Geometry objects
    Function That Returns a Compass Point From a Whole Circle Bearing
    Playing around with Centroids by using different seed values
    Simple Oracle C Sprintf or Java String.format
    Some Oriented Point Functions
    Extracting Inner Rings Changed Ordinate Ordering: A Trap For Players Who Don't Read Documentation!
    PLS-00306: wrong number or types of arguments in call to 'SDO_GEOMETRY'
    Converting Google Earth Formatted Longitude/Latitude points to decimal degrees
    Oracle Business Intelligence Warehousing and Analytics - Spatial Summit
    How far inside, is inside? Measuring actual distance.
    Noding and building a polygon from single, overlapping linestrings
    Analyzing Spatial Query Performance Improvements in Oracle Spatial and Graph 12c Through Cross-Vendor Comparison
    ST_VertexN / ST_PointN - Extracting a specific point from any geometry
    Convert Single Point stored in SDO_ORDINATES to SDO_POINT_TYPE
    Aggregate APPEND Islands and XOR polygons
    Circular Arcs in Geodetic Polygons
    Some SDO_GEOMETRY/DIMINFO handling functions
    Changing all DIMINFO sdo_tolerance values for all metadata records in one go.
    Building Polygons from Incomplete Linestrings using ST_PolygonBuilder
    Computing Cardinal Directions to nearby geometries
    Intersecting two aggregated polygon layers with SC4O
    Spatial and Oracle 12c
    Update Triggers and SDO_GEOMETRY Equality
    Duplicate Geometry data and Data Models
    CENTROID package update
    How to calculate cumulative length of a linestring
    Compute Location from known Lat/Long point using delta easting and northing in miles
    Sorting SDO_GEOMETRY data using the ORDER BY clause of a SELECT statement
    Creating linestrings from points
    Rounding Coordinates or Ordinates in SDO_GEOMETRY
    Effects of Sdo_Geometry Ordinate Precision on Performance
    Effects of Sdo_Geometry Ordinate Precision on Storage
    The Spatial filtering of geometries: The effect of tolerances on relationships
    Application of Delaunay Triangulation and Inverse Distance Weighting (IDW) in Oracle for Soils Interpolation
    Selecting all SDO_GTYPE values for all tables/sdo_geometry columns in a schema
    CENTROID package - Tips for Use
    Announcing the Spatial Companion For Oracle (SC4O)
    Filtering Rings (Oracle Spatial)
    Splitting a polygon using one or more linestrings
    isValid, isSimple, Dimension and CoordDim methods for SDO_Geometry
    Line Merging or Collecting lines together: ST_LineMerger
    ST_DeleteVertex for Oracle SDO_Geometry based on Jaspa/JTS
    3D/4D and SRID aware Conversion functions for SDO_Geometry: WKT and EWKT
    Topological vs Non-Topological Simplification/Generalization of Aggregated Area Geometies in Oracle
    Filtering very short linestrings via bitmap function index
    CENTROID For Oracle
    Gridding a sdo_geometry line/polygon object (Oracle)
    Finding centre and radius of a circular geometry
    Constraining geometry type for sdo_geometry column in a table.
    CASE Statements and SDO_GEOMETRY
    The Power of Constraints and Indexes for Spatial Constraints: stopping duplicate points
    Replacement for SDO_GEOM.RELATE - ST_Relate based on JTS
    Changing Oracle Spatial Index Parameters on existing index
    Writing Excel Spreadsheets files from within the Oracle database using Java and PL/SQL
    Writing xSV (eg csv) files from within the Oracle database using Java and PL/SQL
    A simple spike finder for Spatial/Locator
    JTS Java class compilation for 11g and above
    Random Spatial Search Procedure
    Geometry Snapping using JTS in Oracle
    Exposing JTS's MinimumBoundingCircle functionality
    Exposing JTS's Densifier functionality
    Using JTS's Comparison Functions - HausdorffSimilarityMeasure & AreaSimilarityMeasure with SDO_GEOMETRY
    Free JTS-based Area/Length Functions
    Handy way of systematically fixing polygon geometries with 13349 and other errors
    Standalone CENTROID package now available for download
    Free Union, Intersection, Xor and Difference Functions for Oracle Locator - Part 4 Processing Geodetic data
    Configurable Buffer: JTS and Oracle
    Free Union, Intersection, Xor and Difference Functions for Oracle Locator - Part 3
    Free Union, Intersection, Xor and Difference Functions for Oracle Locator - Part 2
    Free Union, Intersection, Xor and Difference Functions for Oracle Locator - Part 1
    Building Lines into Polygons in Oracle Locator / Spatial
    Finding Intersection Points between Line and Polygon
    Free version of sdo_length
    Alternative to my SQL based GetNumRings function
    External Tables and SDO_Geometry data.
    layer_gtype keyword issue when indexing linear data on 11g
    String Tokenizer for Oracle
    Free Aggregate Method for Concatenating 2D Lines in Oracle Locator 10g
    Reducing 5 Vertex Polygon to Optimized Rectangle
    Square Buffer
    Converting decimal seconds to string
    Valid conversion unit values for Oracle sdo_geom.sdo_length()
    Removing Steps in Gridded Vector Data - SmoothGrid for Oracle
    Oracle Spatial DISJOINT search/filtering
    Creating SDO_Geometry from geometric data recorded in the columns of a table
    Concave Hull Geometries in Oracle 11gR2
    Projecting SDO_GEOM_METADATA DIMINFO XY ordinates
    Instantiating MDSYS.VERTEX_TYPE
    New PL/SQL Packages - Rotate oriented point
    GeoRaptor Development Team
    Fast Refreshing Materialized View Containing SDO_GEOMETRY and SDO_GEOM.SDO_AREA function
    Performance of PL/SQL Functions using SQL vs Pure Code
    Implementing the BEST VicGrid Projection in Oracle 10gR2
    ORA-13011 errors when using SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT()
    Extract Polygons from Compound Polygon
    Detecting sdo_geometries with compound (3-point Arcs) segments
    GEOMETRY_COLUMNS for Oracle Spatial
    Convert GML to SDO_Geometry in Oracle 10gR2
    Spatial Sorting of Data via Morton Key
    Swapping Ordinates in an SDO_GEOMETRY object
    New To_3D Function
    Extend (Reduce/Contract/Skrink) Function for Oracle
    Loading and Processing GPX 1.1 files using Oracle XMLDB
    Loading Spatial Data from an external CSV file in Oracle
    Calling the Oracle Spatial shapefile loader from within the Oracle database itself
    Implementing SDO_VertexUpdate/ST_VertexUpdate for Oracle
    Implementing SDO_RemovePoint/ST_RemovePoint for Oracle
    Implementing SDO_AddPoint/ST_AddPoint for Oracle
    ESRI ArcSDE Exverted and Inverted Polygons and Oracle Spatial
    Funky Fix Ordinates By Formula
    Implementing a SetPoint/ST_SetPoint function in Oracle
    Implementing an ST_SnapToGrid (PostGIS) function for Oracle Spatial
    Generating random point data
    Implementing an Affine/ST_Affine function for Oracle Spatial
    Implementing a Scale/ST_Scale function for Oracle Spatial
    Implementing a Parallel/ST_Parallel function for linestring data for Oracle Spatial
    Implementing a Rotate/ST_Rotate function for Oracle Spatial
    Limiting table list returned when connecting to Oracle Database using ODBC
    ST_Azimuth for Oracle: AKA Cogo.Bearing
    Implementing a Translate/ST_Translate/Move function for Oracle Spatial
    Elem_Info_Array Processing: An alternative to SDO_UTIL.GetNumRings and querying SDO_ELEM_INFO itself
    Minumum Bounding Rectangle (MBR) Object Type for Oracle
    How to extract elements from the result of an sdo_intersection of two polygons.
    How to restart a database after failed parameter change
    Fixing failed spatial indexes after import using data pump
    generate_series: an Oracle implementation in light of SQL Design Patterns
    Multi-Centroid Shootout
    Oracle Spatial Centroid Shootout
    On the use of ROLLUP in Oracle SELECT statements
    Surrounding Parcels
    Spatial Pipelining
    Using Oracle's SDO_NN Operator - Some examples
    Converting distances and units of measure in Oracle Locator
    Split Sdo_Geometry Linestring at a known point
    Forcing an Sdo_Geometry object to contain only points, lines or areas
    Unpacking USER_SDO_GEOM_METADATA's DIMINFO structure using SQL
    Generating multi-points from single point records in Oracle Spatial
    Object Tables of Sdo_Geometry
    Oracle Locator vs Oracle Spatial: A Reflection on Oracle Licensing of the SDO_GEOM Package
    FAST REFRESHing of Oracle Materialized Views containing Sdo_Geometry columns
    Australian MGA/AMG Zone Calculation from geographic (longitude/latitude) data
    Loading Shapefiles (SHP) into Oracle Spatial
    Oracle Spatial Mapping and Map Rendering Performance Tips
    The significance of sdo_lb/sdo_ub in USER_SDO_GEOM_METDATA: Do I need it?
    Oracle Spatial Forum - Melbourne April 2007
    Layer_GTypes for spatial indexes
    Oracle's SQL/MM Compliant Types
    Tips and Tricks



RSS / Atom

Email me


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.

The Frontage Problem: Creating references from land parcel street frontage boundary to point in street

Thursday September 06 2018 at 10:07

Keywordsland parcel street frontage road bearing distance clockface direction PLSQL Oracle

Creating a Clockface Direction/Bearing from a Land Parcel’s Street Frontage to an object in the Street (Pl/Sql and Oracle)

Today I wish to describe a business requirement that I have implemented in at least 4 client sites over the years.

I call it the Frontage Problem.


The Frontage problem is similar to linear referencing in which references to objects within the street reserve are created not by reference to some imaginary point at the start of the street’s centeline linestring, but as either bearing and distance or clockface and distance references from the middle of the land parcel’s boundary that adjoins the street reserve.

Like all things spatial, a picture will show this more clearly than a few words.

In the above example, the reference from the centre of the boundary of land parcel 128780 to the object in the street reserve is 18 hours 2 minutes for 37.34 meters (see later).

Business Problem: Field Survey

The business problem that frontage processing implements is where field staff need to identify, service and examine objects in the street which may be difficult to identify. For example an old service pit which is flush to the ground and may even have been covered over by soil and grass. The original position is known but hard to find. Using traditional linear referencing may not inefficient if the starting measure for a road is hundreds of meters away. Finding the middle of a frontage boundary in the city may be relatively easy where a shop front is synonymous with the boundary; and in the country (where I live), a fenced property boundary is easy to identify.

OK, now I can hear you all saying, but if you know the location (X,Y/Latitude,Longitude), why not just use GPS navigation. To which I reply: if you have an accurate GPS field device (not a smart phone), and the satellite constellation for the time the field visit occurs is excellent, then Yes, take it and use it. But remember, the readout from the GPS probably is not accurate enough to locate the object (certainly in the Southern Hemisphere, the GPS satellite constellation is far less optimal than the Northern Hemisphere).

Let’s not argue the toss as it is a “both / and” argument.
Use all methods available: take a map, an orthophoto (if available), a GPS, and the ClockFace Direction/Bearing and distance, as the cost to travel to the location is normally greater than the pre-field survey (and you don’t want to have to visit the site more than once)!


The implementation is one based entirely on database based data and processing.
And so the solution is a database stored procedure deployed inside the database (data tier).
Data tier solutions are flexible as they can be consumed by any web service or client that can connect to the database and call the stored procedure. Such a stored procedure looks like this:

  1.   /* ***********************************************************************
  2.    * ******************** Main Function ************************************
  3.    * ***********************************************************************
  4.    **/
  5.   FUNCTION Clockface(P_CAD_ID      IN varchar2,
  6.                      P_STREET_NAME IN varchar2,
  7.                      P_STREET_OBJ  IN MDSYS.SDO_GEOMETRY,
  8.                      p_dec_places  IN INTEGER DEFAULT 2,
  9.                      p_tolerance   IN NUMBER  DEFAULT 0.005)
  10.     RETURN t_clockface Deterministic;
  11. .
  12.   /* *******************************************
  13.    * ************* Overloads *******************
  14.    * *******************************************
  15.    **/
  16.   FUNCTION Clockface(P_CAD_ID       IN varchar2,
  17.                      P_STREET_NAME  IN varchar2,
  18.                      P_STREET_OBJ_X IN NUMBER,
  19.                      P_STREET_OBJ_Y IN NUMBER,
  20.                      P_SRID         IN NUMBER DEFAULT 3112,
  21.                      p_dec_places   IN INTEGER DEFAULT 2,
  22.                      p_tolerance    IN NUMBER  DEFAULT 0.005)
  23.     RETURN t_clockface Deterministic;
  24. ...
  25. -- Example
  26. --
  27. SELECT FRONTAGE.clockface(
  28.          P_CAD_ID      => '128780',
  29.          P_STREET_NAME => 'Cliff View Drive',
  30.          P_STREET_OBJ_X => cogo.dms2dd('14712''14.83"E'),
  31.          P_STREET_OBJ_Y => cogo.dms2dd('43 0''49.76"S'),
  32.          P_SRID         => 4283,
  33.          p_dec_places   => 6,
  34.          p_tolerance    => 0.05)
  35.         AS direction
  36.   FROM dual;
  38. -----------------------------------------------------------------------------------------------------------------------------------------
  40. /*clockface*/ '16hr 2min',
  41. /*distance */ 37.34,
  42. /*centroid */ SDO_GEOMETRY(2001,4283,SDO_POINT_TYPE(147.204125,-43.013822,NULL),NULL,NULL),
  43. /*vector   */ SDO_GEOMETRY(2002,4283,NULL,SDO_ELEM_INFO_ARRAY(1,2,1),SDO_ORDINATE_ARRAY(147.204125,-43.013822,147.20411944,-43.01415833))
  44. )


What are the inputs to this problem?

In all cases the base spatial data were two tables containing:

  • Land Parcel Polygon objects (as individual objects, not in a topological structure); In this situation all polygons that share boundaries eg 127907 and 128780 in the image above duplicate the shared boundary as it is a segment within the polygon exterior ring. The land parcel polygon data should be of high quality so that shared boundary segments are truly shared (the data released in the PSMA’s CADLite product is of such quality). Additionally, those two segments have different direction which needs to be handled in the processing (see my article on flipping vectors in SQL Server Spatial – available for Oracle as well). In a topological data structure (Oracle SDO_TOPO or PostGIS Topology) that shared boundary would exist as a single linestring.
  • Named Street Centreline linestring objects. In the implementations no street reserve polygon exists.

The point object defining the object in the street reserve is dynamic.
It could be a user click on a map, an existing asset eg telecommunications pit, a lamp post, etc.

The user inputs are:

  1. The land parcel reference eg id = 128780
  2. The name (or id) of the street that contains the object eg “Cliff View Drive” (id = 62544)

The approach my solution takes is as follows:

1. Select the desired land parcel;
2. Determine its frontage boundary linestring(s);
3. If more than one boundary linestring is returned, query the street centreline data and select the nearest boundary;
4. Compute the middle (midpoint) of the street frontage linestring;
5. Compute and return the bearing/clockface and distance to object.


The process for determining the frontage of a parcel is:

1. Select all neighbouring land parcels to the desired parcel;
2. Segmentize the polygons into 2 point linestrings;
3. Execute segment flipping and keep only those segments for which there is only one of them. This removes all shared boundaries.
4. For each frontage segment select the nearest road centreline that has the desired name and is within a maximum distance. For example, many roads in Australia are placed in land parcels that are 1 Chain wide or 20.115 m. This can help discard single segments that are a part of a boundary with a lake.
5. Then join the selected segments to create a single linestring that represents the land parcel’s street frontage. This involves some extra processing that is not described here.
6. Once a linestring has been formed, generate a centroid in the middle using Linear Reference processing. One customer wanted the centroid to be in the middle of the frontage but 5m inside the land parcel.
7. Once the centroid is created a Bearing or ClockFace Direction and distance to a supplied point can be calculated.

An example of a function to create a Clockface Direction from a bearing is as follows:

  2.                    p_24_hour IN INTEGER DEFAULT 0)
  3.     RETURN VarChar2
  4.   IS
  5.     v_dDecDeg NUMBER := Round((p_dDecDeg/360)*12,2);
  6.     v_iDeg    INTEGER;
  7.     v_iMin    INTEGER;
  8.   BEGIN
  9.     v_iDeg := TRUNC(v_dDecDeg);
  10.     v_iMin := (v_dDecDeg - v_iDeg) * 60;
  11.     RETURN TO_CHAR(CASE WHEN NVL(p_24_hour,0)=0 THEN v_iDeg ELSE 12 + v_iDeg END) || 'Hr ' || TO_CHAR(v_iMin) ||'min';
  12.   END DD2TIME;
  13. .
  14. -- Let's "Rock around the Clock"
  15. --
  16.  SELECT COGO.DD2TIME(t.IntValue,t12.IntValue) AS clockface
  17.    FROM TABLE(TOOLS.generate_series(0,360,45)) t,
  18.         TABLE(TOOLS.generate_series(0,1,1)) t12
  19.   ORDER BY t12.IntValue, t.intValue;
  20. .
  22.  ----------
  23.  0Hr 0min
  24.  1Hr 30min
  25.  3Hr 0min
  26.  4Hr 30min
  27.  6Hr 0min
  28.  7Hr 30min
  29.  9Hr 0min
  30.  10Hr 30min
  31.  12Hr 0min
  32.  12Hr 0min
  33.  13Hr 30min
  34.  15Hr 0min
  35.  16Hr 30min
  36.  18Hr 0min
  37.  19Hr 30min
  38.  21Hr 0min
  39.  22Hr 30min
  40.  24Hr 0min
  41. .
  42. 18 ROWS selected

An example of a block of land parcels that have had ALL their frontages defined in one process is shown in the following image.

Result of processing a whole city block to determine all frontage centroids.

There is a lot of processing involved so speed can be an issue, but this is a question of scale. That is, how many land parcels to process at any one time. At one site the speed to process a single land parcel and produce a result was considered acceptable for dynamic access.

This type of processing is

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