CodePlexProject Hosting for Open Source Software

This summarizes the current contents of this package from an end-user perspective.

# Scripts

Several scripts are included in the *SQL Scripts* directory. These include scripts for registering and unregistering all of the following components, as well as several examples of their use.

# Functions

These static methods, implemented in the class *Functions*, can both be registered in SQL Server and used through T-SQL, as well as be used directly from the CLR:

__SqlGeography __**FilterArtifactsGeography**(SqlGeography geography, bool filterEmptyShapes, bool filterPoints, double lineStringTolerance, double ringTolerance)

Selectively filter unwanted, artifact, shapes from input geography, with the following arguments:

geography SQLGeography – Input geography object.

filterEmptyShapes boolean – A value of 1 will remove all empty shapes while a value of 0 will not remove any empty shapes.

filterPoints Boolean – A value of 1 will remove all point/multipoint shapes while a value of 0 will not remove any.

lineSTringTolerance double – Remove all linestring/multilinestring shapes shorter than the provided tolerance. A value of 0 will not remove any linestring/multilinestring shapes.

ringTolerance double – Remove all polygon rings thinner than provided tolerance (e.g. ring.STArea< ringTolerance * ring.STLength). A value of 0 will not remove any rings.

General behavior: Returned spatial objects will always be the simplest OGC construction possible.

__SqlGeography __**FilterArtifactsGeometry**(SqlGeometry geometry, bool filterEmptyShapes, bool filterPoints, double lineStringTolerance, double ringTolerance)

Selectively filter unwanted, artifact, shapes from input geometry, with the following arguments:

geometry SQLGeometry – Input geometry object.

filterEmptyShapes boolean – A value of 1 will remove all empty shapes while a value of 0 will not remove any empty shapes.

filterPoints Boolean – A value of 1 will remove all point/multipoint shapes while a value of 0 will not remove any.

lineSTringTolerance double – Remove all linestring/multilinestring shapes shorter than the provided tolerance. A value of 0 will not remove any linestring/multilinestring shapes.

ringTolerance double – Remove all polygon rings thinner than provided tolerance (e.g. ring.STArea< ringTolerance * ring.STLength). A value of 0 will not remove any rings.

General behavior: Returned spatial objects will always be the simplest OGC construction possible.

__bool __**IsValidGeographyFromGeometry**(SqlGeometry geometry)

Check if an input geometry can represent a valid geography without throwing an exception.

This function requires that the geometry be in longitude/latitude coordinates and that

those coordinates are in correct order in the geometry instance (i.e. latitude/longitude

not longitude/latitude). This function will return false (0) if the input geometry is not

in the correct latitude/longitude format, including a valid geography SRID.

__bool __**IsValidGeographyFromText**(string inputWKT, int srid)

Check if an input WKT can represent a valid geography. This function requires that

the WTK coordinate values are longitude/latitude values, in that order and that a valid

geography SRID value is supplied. This function will not throw an exception even in

edge conditions (i.e. longitude/latitude coordinates are reversed to latitude/longitude).

__SqlGeography __**MakeValidGeographyFromGeometry**(SqlGeometry geometry)

Convert an input geometry instance to a valid geography instance.

This function requires that the WKT coordinate values are longitude/latitude values,

in that order and that a valid geography SRID value is supplied.

__SqlGeography __**MakeValidGeographyFromText**(string inputWKT, int srid)

Convert an input WKT to a valid geography instance.

This function requires that the WKT coordinate values are longitude/latitude values,

in that order and that a valid geography SRID value is supplied.

__SqlGeography __**ConvexHullGeography**(SqlGeography geography)

Computes ConvexHull of input geography and returns a polygon (unless all input points are colinear).

__SqlGeography __**ConvexHullGeographyFromText**(string inputWKT, int srid)

Computes ConvexHull of input WKT and returns a polygon (unless all input points are colinear).

This function does not require its input to be a valid geography. This function does require

that the WKT coordinate values are longitude/latitude values, in that order and that a valid

geography SRID value is supplied.

__SqlGeography __**DensifyGeography**(SqlGeography g, double maxAngle)

Returns a*geography* instance equivalent to its input, but with no two consecutive points spaced more than
*maxAngle* apart.

__SqlGeography __**InterpolateBetweenGeog**(SqlGeography start, SqlGeography end, double distance)

Takes start and end*geography* points and returns a new point that is a given distance from the start toward the end.

__SqlGeometry __**InterpolateBetweenGeom**(SqlGeometry start, SqlGeometry end, double distance)

Takes start and end*geometry* points and returns a new point that is a given distance from the start toward the end.

__SqlGeography __**LocateAlongGeog**(SqlGeography g, double distance)

Takes a*geography* linestring and finds the point a given distance along it.

__SqlGeometry __**LocateAlongGeom**(SqlGeometry g, double distance)

Takes a*geometry* linestring and finds the point a given distance along it.

__SqlGeometry __**ShiftGeometry**(SqlGeometry g, double xShift, double yShift)

Takes a*geometry* instance and shifts if by a given X and Y amount.

__SqlGeometry __**VacuousGeographyToGeometry**(SqlGeography toConvert, int targetSrid)

A special case of the equirectangular projection, taking each point (lat,long) --> (y, x).

__SqlGeography __**VacuousGeometryToGeography**(SqlGeometry toConvert, int targetSrid)

The inverse of the VacuousGeographyToGeometry projection.

# Types

These types can be registered in SQL Server or used directly through the CLR.

**SqlProjection**

This class provides an extensible access point to various projections and inverse projections. See the file*projection_example.sql* for a sample of its use. Currently supported projections are:

**AffineTransform**

This provides general affine transformations. See the example*transform_example.sql* for a sample of its use.

# Aggregates

While implemented as classes, aggregates are essentially functions that take a collection of inputs to a single result.

**GeographyUnionAggregate**

This aggregate computes the union of a set of*geographies*.

**GeometryEnvelopeAggregate**

This aggregate computes the envelope of a set of input*geometries*.

Selectively filter unwanted, artifact, shapes from input geography, with the following arguments:

geography SQLGeography – Input geography object.

filterEmptyShapes boolean – A value of 1 will remove all empty shapes while a value of 0 will not remove any empty shapes.

filterPoints Boolean – A value of 1 will remove all point/multipoint shapes while a value of 0 will not remove any.

lineSTringTolerance double – Remove all linestring/multilinestring shapes shorter than the provided tolerance. A value of 0 will not remove any linestring/multilinestring shapes.

ringTolerance double – Remove all polygon rings thinner than provided tolerance (e.g. ring.STArea< ringTolerance * ring.STLength). A value of 0 will not remove any rings.

General behavior: Returned spatial objects will always be the simplest OGC construction possible.

Selectively filter unwanted, artifact, shapes from input geometry, with the following arguments:

geometry SQLGeometry – Input geometry object.

filterEmptyShapes boolean – A value of 1 will remove all empty shapes while a value of 0 will not remove any empty shapes.

filterPoints Boolean – A value of 1 will remove all point/multipoint shapes while a value of 0 will not remove any.

lineSTringTolerance double – Remove all linestring/multilinestring shapes shorter than the provided tolerance. A value of 0 will not remove any linestring/multilinestring shapes.

ringTolerance double – Remove all polygon rings thinner than provided tolerance (e.g. ring.STArea< ringTolerance * ring.STLength). A value of 0 will not remove any rings.

General behavior: Returned spatial objects will always be the simplest OGC construction possible.

Check if an input geometry can represent a valid geography without throwing an exception.

This function requires that the geometry be in longitude/latitude coordinates and that

those coordinates are in correct order in the geometry instance (i.e. latitude/longitude

not longitude/latitude). This function will return false (0) if the input geometry is not

in the correct latitude/longitude format, including a valid geography SRID.

Check if an input WKT can represent a valid geography. This function requires that

the WTK coordinate values are longitude/latitude values, in that order and that a valid

geography SRID value is supplied. This function will not throw an exception even in

edge conditions (i.e. longitude/latitude coordinates are reversed to latitude/longitude).

Convert an input geometry instance to a valid geography instance.

This function requires that the WKT coordinate values are longitude/latitude values,

in that order and that a valid geography SRID value is supplied.

Convert an input WKT to a valid geography instance.

This function requires that the WKT coordinate values are longitude/latitude values,

in that order and that a valid geography SRID value is supplied.

Computes ConvexHull of input geography and returns a polygon (unless all input points are colinear).

Computes ConvexHull of input WKT and returns a polygon (unless all input points are colinear).

This function does not require its input to be a valid geography. This function does require

that the WKT coordinate values are longitude/latitude values, in that order and that a valid

geography SRID value is supplied.

Returns a

Takes start and end

Takes start and end

Takes a

Takes a

Takes a

A special case of the equirectangular projection, taking each point (lat,long) --> (y, x).

The inverse of the VacuousGeographyToGeometry projection.

This class provides an extensible access point to various projections and inverse projections. See the file

- Albers Equal Area
- Equirectangular
- Lambert Conformal Conic
- Mercator
- Oblique Mercator
- Tranverse Mercator
- Gnomonic

This provides general affine transformations. See the example

This aggregate computes the union of a set of

This aggregate computes the envelope of a set of input

Last edited Dec 29, 2010 at 5:02 PM by tintor, version 12