combining Geography data

2019-08-31 05:42发布

问题:

Using something like this works:

DECLARE @Shape GEOGRAPHY  = 'POLYGON EMPTY'
SET @Shape.STSrid = 4326;

SELECT @Shape = @Shape.STUnion([PolygonData])
  FROM [Bla].[Polygon]

SELECT @Shape.STAsText();

on a table like this:

CREATE TABLE [Space].[Polygon](
    [Id] [UNIQUEIDENTIFIER] NOT NULL,
    [PolygonData] [GEOGRAPHY] NULL)

Unfortunately, it is very slow. I do not think I can index this so I wonder if there are alternative approaches that can be used to merge polygons to obtain just the outer points of the combined polygon. Thanks.