Geometry validation is provided by the ST_Geometry type through the st_shapelib (Oracle) and st_geometry libraries in PostgreSQL, IBM DB2, and Informix. Once a table is created, data is validated when records are inserted or updated.
There are two main ways to insert data into spatial tables:
- Using constructor functions and applications built using these functions
- Using ArcGIS API and applications built using these API
Constructor functions are defined by each spatial type implementation and may use different methods to validate geometry data. Esri and IBM ST_Geometry constructor functions and ArcGIS API use the Esri shape library to validate geometry data when the feature is created. Other spatial types, such as SDO_Geometry, PostGIS geometry or geography, and Microsoft SQL Server geometry or geography, have their own constructor functions and use their own shape verification rules. Therefore, you should read the Oracle, PostGIS, or SQL Server documentation respectively for verification rules applied when features are inserted or updated to those types outside ArcGIS.
ArcGIS also validates geometry when the data is read. Invalid geometries cannot be rendered in ArcGIS.
The following geometry validation rules apply to Esri API, ST_Geometry constructor functions, and when ArcGIS reads geometry:
Validation rules for point shapes
The area and length of points are 0.0.
A single point's envelope is equal to the point's x,y values.
- The envelope of a multipart point shape is the minimum bounding box.
Validation rules for simple lines or linestrings
- Sequential duplicate points are deleted.
- Each part must have at least two distinct points.
- Each part may not intersect itself. The start and end points can be the same, but the resulting ring is not treated as an area shape.
- Parts may touch each other at the end points.
- The length is the sum of all the parts.
Validation rules for lines or spaghetti strings
- Lines can intersect themselves.
- Each part must have at least two distinct points.
- Sequential duplicate points are deleted.
- The length is the sum of all the parts.
Validation rules and operations for area shapes
- Duplicate sequential occurrences of a coordinate point are deleted.
- Dangles are deleted.
- Line segments are verified to be closed (z-coordinates at start and end points must also be the same) and don't cross.
- For area shapes with holes, holes must reside wholly inside the outer boundary. ArcGIS eliminates any holes that are outside the outer boundary.
- A hole that touches an outer boundary at a single common point is converted into an inversion of the area shape.
- Multiple holes that touch at common points are combined into a single hole.
- Multipart area shapes cannot overlap. However, two parts may touch at a point.
- Multipart area shapes cannot share a common boundary. Common boundaries are dissolved.
- If two rings have a common boundary, they are merged into one ring.
- The total geometry perimeter, including the boundaries of all holes in donut polygons, is calculated and stored as the length of the geometry.
- The area is calculated.
- The envelope is calculated.
- The points of an area shape are stored
counterclockwise although ArcGIS clients can return points in
either direction. If you generate an area shape that contains
clockwise coordinates, ArcGIS changes the rotation to ensure that
the coordinate list follows a counterclockwise
direction.
In this example, the starting point is a and the correct coordinate description is a,b,c,d,a.
- An area shape can have inversions, which are empty spaces inside the area shape that touch the outer boundary.
- Inverted area shapes have an interior ring that touches the outer boundary. These are not considered donut polygons.
- When an area shape has a donut hole, the outer boundary is listed first. The points of the holes are stored in opposite direction of the outer boundary.
In the following figure, the outer boundary is described as a,b,c,d,a, and the hole is described as e,f,g,h,e. In the coordinate list, the area shape is stored as a,b,c,d,a,e,f,g,h,e.
- If two holes touch at one point, they are treated as one hole, not two.
In this example, the two inner areas are a single hole because they share a common point, g.
- The combination of area shapes and area shapes with holes can become fairly complex as shown in the next graphic. The outer boundary is a lake with an island. There is a small lake on the island.
It is possible to represent these features as one, two, or three shapes. You could store each feature separately. The larger lake is a donut polygon. The boundary of the large lake is the outer boundary while the island is the boundary of the single donut hole. The island is also a donut polygon. The boundary of the island is the outer boundary while the small lake is the hole. The small lake is a single area shape.
If the lakes are the important features, one shape with a hole represents the big lake, while a second shape represents the small lake. You could also use a multipart area shape to represent the feature. The first shape part is the big lake with a donut hole representing the island. The second part is the small lake.
- Nil shapes act as placeholders; a way to have an attribute row without a corresponding geometry. One example that would result in a nil shape is a request for the intersection of two nonintersecting areas.
Because areas A and B do not touch, the result of an intersection query produces an empty geometry.
- Shapes have dimensions. A shape with only x,y-coordinates is considered two-dimensional. A shape that has z-coordinates or measures is three-dimensional. A shape can also have a nil measure.
Spatial reference ID
For feature classes using the ST_Geometry type, if you try to insert a value that has coordinates that are outside the bounds of the spatial reference ID (SRID) provided and with which the table was created, the INSERT statement fails with a message similar to the ones listed here:
DBMS | Error message |
---|---|
Oracle | ERROR at line 1: ORA-20004: Error generating shape from text (-112) ORA-06512: at "SDE.ST_GEOMETRY_SHAPELIB_PKG", line 42 ORA-06512: at "SDE.ST_POLYGON", line 69 ORA-06512: at line 1 |
PostgreSQL | ERROR: ESRI: error generating shape [-112]: |
Informix | SQL Error (-937): Coordinates out of bounds in ST_PolyFromText. |
DB2 | GSE3416N Coordinate out of bounds |
SQLite | Error: ST_Geometry failed with SDE error -139: 'The specified coordinate exceeds the valid coordinate range':[4] |