## Top 5 Recent Articles

##### ARTICLES CATEGORIES

- Algorithms (13)
- All (401)
- Biography (1)
- Blog (44)
- Business Requirements (1)
- Commentary (1)
- Customers (2)
- Data Models (1)
- Education (2)
- GeoRaptor (12)
- Image Processing (2)
- Import Export (8)
- Licensing (2)
- Linear Referencing (3)
- Manifold GIS (3)
- Mapping (1)
- MySQL Spatial (7)
- Networking and Routing (including Optimization) (3)
- Open Source (18)
- Oracle Spatial and Locator (187)
- PostGIS (33)
- Published Articles (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (35)
- Space Curves (9)
- Spatial Database Functions (102)
- Spatial DB comparison (1)
- Spatial XML Processing (10)
- SQL Server Spatial (General) (83)
- SQL Server Spatial (LRS) (38)
- Standards (1)
- Stored Procedure (15)
- Tessellation or Gridding (9)
- Tools (2)
- Training (2)

# CheckRadii: Identifying Tight Radius Curves sections within LineString geometry data

Sometimes it is a data quality requirement for linear data (roads, pipelines, transmission lines) that curves within the lines must have a radius greater than a particular amount.

Recently a customer asked me to write some TSQL functions to help them run data quality checks over linear data loaded into a SQL Server 2008 geometry column directly from a CAD package.

The function I created is called **CheckRadii** and is as follows:

CREATE FUNCTION [CheckRadii]( @p_geom geometry, @p_min_radius FLOAT, @p_precision INT ) RETURNS geometry AS BEGIN -- Implementation END;

**Description**

Function that checks vertices in a linestring/multilinestring to see if the circular arc they describe

have radius less than the provided amount. Each set of three vertices (which could be overlapping)

that fail the test are written to a single MultiPoint object. If no circular arcs in the linestring

describe a circle with radius less than the required amount a NULL geometry is returned.

If another other than a (Multi)linestring is provided it is returned as is.

The parameter p_min_radius is a not null value that describes the minimum radiue of any arc within the linestring.

The function returns a projected 2D MultiPoint geometry.

The function only works for projected data and does not honour dimensions over 2.

**Example**

And can be called as follows:

SELECT [CheckRadii](geometry::STGeomFromText('MULTILINESTRING( (0.0 0.0,10.0 0.0,10.0 10.0), (20.0 0.0,30.0 0.0,30.0 10.0))',0), 15.0,3).STAsText();

Some examples of running this against test road data with a 15.0 meter radius and precision of 3 (ie 1 mm) are as follows.

If anyone wants a copy of this function, or wishes for a similar function to be written for them, please contact me.

## Documentation

- MySQL Spatial General Function Documentation
- Oracle Spatial Exporter Package Documentation
- Oracle Spatial Object Function Documentation
- Oracle Spatial Object Function Documentation (Multi Page Version)
- PostGIS pl/pgSQL Function Documentation
- SC4O Oracle Java Topology Suite (Stored Procedures) Package Documentation
- SQL Server Spatial General TSQL Function Documentation
- SQL Server Spatial LRS TSQL Function Documentation