This is my first attempt at doing real work with Oracle Spatial. I'm trying to validate all geometries within an envolope. So far I've cobbled together an SQL query which I believe is correct.
Will the below select statement return the rows inside a 2 km square window having an invalid geometry?
select
l.primary_key as primary_key,
sdo_geom.validate_geometry_with_context(l.shape, m.diminfo) as vgeom
from
topographic_line l,
ALL_SDO_GEOM_METADATA M
where
mdsys.sdo_filter(l.shape,
mdsys.sdo_geometry(
2003, --SDO_GTYPE: 2 dimensions, 0 = no linear ref, 03 = polygon
81989, --SDO_SRID: British National Grid
NULL, --SDO_POINT: only for optimal single point storage
mdsys.sdo_elem_info_array(
1, --SDO_STARTING_OFFSET, Ordinates begin at first entry
1003, --SDO_ETYPE: 1003 = exterior polygon ring (counter clockwise)
1 --SDO_INTERPRETATION: vertices are straight lines
),
MDSYS.SDO_ORDINATE_ARRAY( --2Km square over 416000 141000
:x-1000, :y-1000, --lower left
:x+1000, :y-1000, --lower right
:x+1000, :y+1000, --upper right
:x-1000, :y+1000, --upper left
:x-1000, :y-1000 --repetition of first
)
),
'querytype=window'
) = 'TRUE'
AND m.table_name = 'TOPOGRAPHIC_LINE'
AND m.column_name = 'SHAPE'
AND sdo_geom.validate_geometry_with_context(shape, m.diminfo) <> 'TRUE'
order by primary_key
With thanks
Alex
Background:
The purpose is to track down the cause of several dropped connections in ArcGIS whilst browsing & printing the data. ArcGIS 8.3 is connecting through ArcSDE 8.3 to an Oracle 9.2.0.6 instance.
The connection from ArcSDE to Oracle is dropping after some usage, although the sdemon tool continues to show the user's session. This corresponds to an entry, "load_buffer error -2028", in the sde.errlog. The following ESRI KB article suggests this is caused by features that are invalid by ArcSDE standards.
http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=22896
It suggests running validate_geometry. I do not wish to run the simpler validate_layer(_with_context), as the tables in question each contain tens-of-millions of rows.