Bug: Spatial query fails when features are stored in SQL Server Geography storage type and the filter shape is larger than one hemisphere


Spatial queries of this type only fail with feature classes stored in a Microsoft SQL Server database using the native Geography spatial data type.

Spatial queries can fail when the filter shape spans more than half of the Earth's surface. The filter shape can be a polygon or a linestring.

For example, when attempting to view a feature class at global extent, or an extent that encompasses more than half of the Earth's surface, in ArcMap the feature class is not displayed.


This error is returned by SQL Server when a Geography instance, a shape, that is larger than half the Earth's surface is created. Depending on the application, the following error message may or may not be presented to the user.

Msg 6522, Level 16, State 1, Line 1 
A .NET Framework error occurred during execution of
user-defined routine or aggregate "geography":

Microsoft.SqlServer.Types.GLArgumentException: 24205:
The specified input does not represent a valid geography instance
because it exceeds a single hemisphere. Each geography instance
must fit inside a single hemisphere. A common reason for this
error is that a polygon has the wrong ring orientation.

The problem stems from a Microsoft limitation where no Geography instance,
including a spatial filter instance, can span more than half of the Earth's surface. This limitation is widely documented (see Related Information for relevant links).

This limitation affects ArcGIS users in several ways. Most importantly, any spatial query performed through an Esri API function that uses a filter shape larger than half the Earth's surface will cause this error.

• Large spatial filters are sometimes used when zooming to an area of interest.
• ArcGIS users cannot view feature classes when zooming to an area larger than half of the Earth's surface.
• Spatial filters are always used with ArcGIS, even with full-extent draws.

Microsoft plans to address this limitation of the Geography spatial type with the implementation of a full-globe data model in the next major release of SQL Server, currently referred to as Denali.


    Related Information