Geometry Aggregates
are there spatial aggregates, i.e. select geometry:: stunion(geom) geodata unioned geometry of geometries.
the union aggregate simpler implement bounding box:
code block
using
system;using
system.io;using
microsoft.sqlserver.server;using
microsoft.sqlserver.types;[
serializable][microsoft.sqlserver.server.sqluserdefinedaggregate(format.userdefined, maxbytesize = -1)]
public
struct unionaggregate : ibinaryserialize{
public sqlgeometry union; public void init(){
union =
new sqlgeometry();}
public void accumulate(sqlgeometry value){
if (union.isnull || union.stisempty())union = value;
elseunion = union.stunion(value);
}
public void merge(unionaggregate group){
if (union.isnull || union.stisempty())union = group.union;
elseunion = union.stunion(group.union);
}
public sqlgeometry terminate(){
return union;}
public void read(binaryreader r){
union =
new sqlgeometry();union.read(r);
}
public void write(binarywriter w){
union.write(w);
}
}
SQL Server > SQL Server Spatial
Comments
Post a Comment