SQL Server Spatial TSQL Stored Procedures

(1 customer review)

$29.99 (inc. GST Australia)

This product is a collection of powerful TSQL functions for use with SQL Server Spatial.


Spatial Companion For SQL Server Spatial is a complete collection of TSQL functions and procedures for a developer using SQL Server Spatial (various editions).

The TSQL functions include the all the base functions and a full set of Linear Referencing System (LRS) functions.

The documentation for these functions is hosted on this website at the following two locations:

SQL Server Spatial Code Documentation
SQL Server Spatial LRS Code Documentation

Here is a summary of the number of functions in the package.

select SUBSTRING(f.routine_schema,1,10) as routine_schema,
       f.routine_type, ISNULL(f.data_type,'TOTAL:') as data_type, f.count_by_type
  from (select r.routine_schema,
               case when r.data_type = 'TABLE'    then 'TABLE' else 'SCALAR'  end as data_type, 
               count(*) as count_by_type
          from [INFORMATION_SCHEMA].[ROUTINES] as r
         where r.routine_schema in ('dbo','lrs','cogo')
           and r.specific_name not like 'sp%'
           and r.specific_name not like 'fn%'
        group by ROLLUP(
                   case when r.data_type = 'TABLE' then 'TABLE' else 'SCALAR' end
        ) as f
 where f.routine_schema is null 
    or (  f.routine_schema is not null 
      and f.data_type is not null
order by f.routine_schema desc,f.routine_type, f.count_by_type;

A donation of $45 for my effort can be viewed as being $29.99/ 232 = 13 cents per function!

A description of each of the available functions is available in the online help (see above).

If a request for new function is received, and implemented, the function will be provided for the original purchaser and any future persons who download the package.

The license under which this code is distributed is the MIT license. However, there are other requirements that are outline in the page on Software Philosophy.

1 review for SQL Server Spatial TSQL Stored Procedures

  1. Rayner (verified owner)

    I’ve been using Simon Greener’s spatial functions for close to a year now. They are powerful, reliable, well documented and Simon is always working to make them more useful. Plus, he’s written about most of them in his blog over the last 10 years. These spatial functions form the backbone of a web app I’ve been working on. Good stuff, highly recommended.

Add a review

Your email address will not be published. Required fields are marked *