SQL Spatial Merge Polygons

Andrew Ingall 80 Reputation points
2023-03-31T17:51:35.6533333+00:00

Hello

I have the following code to buffer two polygons held in a spatial table, but what i am trying to do is merge them both into one polygon and write out the result to a new view.

Can this be done and if so how?

Andy

SELECT [Admin_Unit_ID]
      ,[GEOM].STBuffer (5000) as Geom
  FROM [Mapping].[dbo].[OS_BDL_district_borough_unitary2]
  WHERE [Admin_Unit_ID] IN ('17653','17486');
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,492 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 120.8K Reputation points
    2023-03-31T18:18:58.6933333+00:00

    Try something like this:

    SELECT geometry::UnionAggregate([GEOM].STBuffer(5000)) as Geom
    FROM [Mapping].[dbo].[OS_BDL_district_borough_unitary2]
    WHERE [Admin_Unit_ID] IN ('17653','17486');
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.