2011

Table Of Contents
Using Expressions to Find Invalid Geometry
SQL Server provides a function called STIsValid() that returns 1 for valid
geometries and 0 for invalid geometries. FDO exposes access to that function
using a function called IsValid(geometry) at the FDO level. You can use this
function in AutoCAD Map 3D and MapGuide when you create an expression
to filter or select data. If you select data using no filter or using just the
EnvelopeIntersects filter, you can create a calculated property in the Data
Table using the IsValid function to see which geometries are valid or invalid.
Correcting Invalid Geometry
SQL Server Spatial also provides a function you can use to correct invalid
geometries on the server. You cannot use this function from within AutoCAD
Map 3D and MapGuide, but you can use it directly against SQL Server, for
instance, using Management Studio. Here is an example of this method:
update dbo.road set geom = geom.MakeValid() where geom.STIsValid()
= 0;
This operation makes the geometry valid by modifying its invalid parts. You
may prefer to edit the geometry yourself, rather than use a default correction
with uncertain results.
For more information on the STIsValid() and MakeValid() functions, as well
as other aspects of SQL Server Spatial, consult the SQL Server Spatial online
documentation.
See also:
Working with SQL Server Spatial Data (page 561)
Bringing In Features from SQL Server (page 323)
Creating FDO-Enabled SQL Server Spatial Data Stores (page 590)
Migrating Data (page 615)
Styling Features (page 639)
To create a map with styled feature layers (page 641)
To edit a feature using feature editing commands (page 705)
To bring in features from SQL Server Spatial
1 In
Display Manager (page 2060), click Data Connect To Data.
328 | Chapter 3 Bringing In Data