HOW TO
The following script will display the spatial index grids of a DBTheme. Spatial indexes increase the selection speed of graphical queries on spatial features. It is much faster to first look up the index and then go to the appropriate record than to start at the first record and search through the entire table.
Warning:
Building a new spatial index for an ArcSDE feature class is a very server-intensive operation. It should not be done on very large feature classes when a large number of users are logged in to the server.
Code:
'-------------------
theview = av.getactivedoc
thetheme = theview.getactivethemes.get(0)
theqd = thetheme.getquerydef
thescol = thetheme.getscolumn
theglist = theview.getgraphics
theext = thetheme.returnextent
theo = theext.returnorigin
thes = theext.returnsize
thegrids = thescol.getgridsizes
thegridsize = msgbox.listasstring(thegrids,"Select Grid Size:","Grid Sizes")
x = theo.asstring.aslist.get(1).asnumber
y = theo.asstring.aslist.get(2).asnumber
maxx = x + thes.asstring.aslist.get(1).asnumber
maxy = y + thes.asstring.aslist.get(2).asnumber
xc = x.clone
xy = y.clone
while (x <= maxx)
thexline = polyline.make({{x@y, x@maxy}})
thegshapex = graphicshape.make(thexline)
thegshapex.getsymbol.setcolor(color.getblue)
theglist.add(thegshapex)
x = x + thegridsize
end
while (y <= maxy)
theyline = polyline.make({{xc@y, maxx@y}})
thegshapey = graphicshape.make(theyline)
thegshapey.getsymbol.setcolor(color.getblue)
theglist.add(thegshapey)
y = y + thegridsize
end
av.purgeobjects
'-------------
Note:
For more information on spatial index grid sizes, see the SDE Administrators Guide
Article ID:000005292
Get help from ArcGIS experts
Download the Esri Support App