Linear Referencing Update

Linear Referencing Summary

Linear referencing systems (LRS) allow users to map information from points and line segments onto networks. For example, a house location can be described with a unique coordinate, or it can be described by referencing another geometry, like a road: "40% of the way up the 400-block of Main Street". This is how geocoders and reverse-geocoders commonly work, by interpolating address points from road network. Highway authorities also use linear referencing for things like describing infrastructure locations: "mile 40 of Route 45".

The key to LRS is an extra dimension stored on the geometry, called the "measure". For some LRS data models – such as the geocoding example above – the measure is just the distance from the geometry start point. For others, the measure is some physical or notional variable not exactly expressed in the geometry, such as the distance upstream in a hydrological network, or the drive distance along a highway route.

The existing LRS support in PostGIS is a mish-mash of functions that use geometry length as an implicit measure (ST_Line_Interpolate_Point(), ST_Line_Locate_Point(), ST_Line_Substring()) and functions that use an actual measure (ST_Locate_Along_Measure(), ST_Locate_Between_Measures()).

None of the functions follow the ISO SQL function signatures for LRS support, and there are some extended functionality missing, such as the ability to find the measure of a point (reverse geocode use case), or to offset a generated point from a measured line (geocode use case).

The following functions should be added to complete proper ISO support, and to add extra functionality beyond the standard to support common use cases.

  • ST_LocateAlong(geometry GEOMETRY,double MEASURE), a renaming of the existing function to the SQL/MM standard and enhancement to deal with all geometry types, including curve-based types. For geometries with a measure, use the measure, for un-measured geometries, use the length and measure range 0-1.
  • ST_LocateBetween(geometry GEOMETRY, double MEASURE1, double MEASURE2), a renaming of the existing function to the SQL/MM standard and enhancement to deal with all geometry types, including curve-based types. For geometries with a measure, use the measure, for un-measured geometries, use the length and measure range 0-1.
  • ST_AddMeasure(geometry GEOMETRY, double MEASURE_START, double MEASURE_END), a new function to add measures to un-measured functions. Funded and completed in 1.5.0
  • ST_InterpolatePoint(geometry LINE, geometry POINT), return the measure of the projected location of the point relative to the line, or the length proportion up line, for un-measured geometries.
  • ST_LocateAlong(geometry GEOMETRY,double MEASURE, double OFFSET), an enhancement to the default function, to allow the generated point to be offset to the left (negative offset) or right (positive offset) of the base linear feature. For geometries with a measure, use the measure, for un-measured geometries, use the length and measure range 0-1.
  • ST_LocateBetween(geometry GEOMETRY, double MEASURE1, double MEASURE2, double OFFSET), an enhancement to the default function, to allow the generated point to be offset to the left (negative offset) or right (positive offset) of the base linear feature. For geometries with a measure, use the measure, for un-measured geometries, use the length and measure range 0-1.

Funding

This roadmap item is currently unfunded.

Get a quote now!

Get a quote or read more about core development to add your support to a road-map item.

Other Roadmap Items

Faster Geodetic Functions

The geodetic GEOGRAPHY operations are currently very CPU intensive, because they involved multiple trancendental math calls. Performance could be improved through caching of calculations, both at a low level (coordinates) and a high level (data structures).

Linear Referencing Update

The LRS functions in PostGIS are a mismatched combination of functions that operate on measures and functions that use length as a proxy to measure. A re-work to formalize the LRS handling is needed.

More Geodetic Functions

Support for ST_Union(), ST_Difference(), and true/false predicate tests calculated natively on the sphere for the GEOGRAPHY type introduced in PostGIS 1.5.

All roadmap items...