## Top 5 Recent Articles

##### ARTICLES CATEGORIES

- Algorithms (22)
- All (399)
- Biography (1)
- Blog (44)
- Business Requirements (1)
- Commentary (1)
- Conversion (2)
- Customers (2)
- Data Models (1)
- Education (2)
- GeoRaptor (13)
- GPS (1)
- Image Processing (2)
- Import Export (8)
- Licensing (2)
- LiDAR (1)
- Linear Referencing (4)
- Manifold GIS (3)
- Mapping (1)
- MySQL Spatial (7)
- Networking and Routing (including Optimization) (5)
- Open Source (18)
- Oracle Spatial and Locator (194)
- Partitioning (1)
- PostGIS (36)
- Projections (1)
- Published Articles (1)
- qGIS (1)
- Recommendations (1)
- Services (1)
- Software Change Log (1)
- Source Code (37)
- Space Curves (9)
- Spatial Database Functions (109)
- Spatial DB comparison (1)
- Spatial XML Processing (11)
- SQL Server Spatial (92)
- Standards (3)
- Stored Procedure (17)
- Tessellation or Gridding (10)
- Tools (2)
- Topological Relationships (1)
- Training (2)
- Triangulation (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 Functions
- Oracle LRS Objects
- Oracle Spatial Exporter (Java + pl/SQL)
- Oracle Spatial Object Functions
- Oracle Spatial Object Functions (Multi Page)
- PostGIS pl/pgSQL Functions
- SC4O Oracle Java Topology Suite (Java + pl/SQL)
- SQL Server Spatial General TSQL Functions
- SQL Server Spatial LRS TSQL Functions