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;

else

union = union.stunion(value);

}

public void merge(unionaggregate group)

{

if (union.isnull || union.stisempty())

union = group.union;

else

union = 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

Popular posts from this blog

Motherboard replacement

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state

Remote Desktop App - Error 0x207 or 0x607