Union all geometry in a SQL Server table like GeomUnion in Postgres

后端 未结 3 1558
借酒劲吻你
借酒劲吻你 2021-01-11 13:14

Just to clarify up-front: I\'m talking about unioning geometry, not the SQL keyword UNION.

I\'m trying to move some spatial data from Postgres with Post

3条回答
  •  -上瘾入骨i
    2021-01-11 14:01

    The way I ended up doing this is with variables:

    DECLARE @Shape GEOMETRY
    SET @Shape = GEOMETRY::STGeomFromText('GEOMETRYCOLLECTION EMPTY', @MySrid)
    
    SELECT @Shape = @Shape.STUnion(Shape)
      FROM MyShapeTable
    

    It's not as nice, but it works.

提交回复
热议问题