# How to determine if two geometries when unioned exceed a single hemisphere?

• ### Question

• Hi

Is there a way to determine if two geometries when unioned together will exceed the single hemisphere limitation?

I read about EnvelopeCenter and EnvelopeAngle and know the angle should be less than 90 degrees but these methods only work on existing geography instances so can't be used as a pre-test.

Here is an example of what I am trying to do. I would like to avoid using TRY/CATCH blocks since I need to use this test in a SELECT statement.

```declare @x geography = 'MULTIPOINT ((0 1), (90 1), (180 1), (270 1))';
declare @y geography = 'POINT (45 1)';

/* some test with @x and @y here that  */

select @x.STUnion(@y)

/* This returns NULL because @x union @y > hemisphere */```

Thanks
Blair
Friday, June 12, 2009 3:48 PM

### All replies

```declare @x geography = 'MULTIPOINT ((0 1), (90 1), (180 1))';
declare @y geography = 'POINT (270 1)';

/* some test with @x and @y here that  */
DECLARE @test geography = @x.STUnion(@y)
IF @test IS NULL PRINT 'Could not create union' ELSE PRINT @x.STAsText();```

Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
Saturday, June 13, 2009 1:36 PM
• Perhaps but in the previous thread in which you also replied it could not be determined if this was the best method since STUnion might return NULL on other non-trivial inputs.

Hopefully someone else might have a better idea.

Saturday, June 13, 2009 5:08 PM
• Can you tell me when  STUnion returns null except when union of input objects exceeds a single hemisphere?