2011

Table Of Contents
NOTE You can customize the SQL Server Spatial FDO provider (page 2063). The
API has custom commands to support schema read/write and geospatial and
non-geospatial data read/write. For more information, refer to the FDO API Reference
and the FDO Provider for SQL Server API Reference.
Dealing With Invalid Geometry
SQL Server Spatial validates geometry objects that are added to the database.
It validates the values of geometry columns after they are added. As a result,
some geometries are flagged as invalid, even though they are saved. This
usually affects polygons (for example, polygons that are not closed) and spikes
in geometry. Validation is based on OGC rules.
Querying invalid geometries using a spatial filter (for example, using an
expression) generates an error and the query fails. This affects SQL Server
geometry (but not SQL Server geography).
NOTE The FDO Provider for SQL Server Spatial uses the geography data type for
latitude/longitude coordinate systems and the geometry data type for all others.
The geography data type does not retain invalid geometry values and rejects them
right away. It does not support the STIsValid() or IsValid(geometry) functions
described below.
How Invalid Geometry is Handled
The FDO Provider for SQL Server Spatial recognizes that invalid geometries
may exist in a table that is being processed. The provider includes code to
avoid having queries fail, using the following strategies:
A query with no spatial filter returns all data.
A query with a spatial filter skips invalid geometries so that the query does
not fail altogether. Valid geometries matching the spatial filter are returned.
A query using the FDO EnvelopeIntersects filter does not skip invalid
geometries if a spatial index is included on the geometry column. In this
special-case combination, SQL Server Spatial does not fail on the query
because it doesnt process the details of the geometry. MapGuide uses this
type of filter as its default selection filter.
AutoCAD Map 3D and MapGuide can draw these invalid geometries without
a problem.
Bringing In Features from SQL Server Spatial | 327