Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to find all featureclasses within SDE that fall within a spatial search e.g a user draws a rectangle on screen over a map of the world say. (I would like to do this progrmammatically, the native search tool in ArcCatalog is horrible).

I'm thinking you may be able to do something with ArcSDE system tables to find things out or maybe go down to the level of creating some custom code in C/Java SDE API.

So this is like doing a spatial search WITHIN a featureclass to find features - but a step further up in thinking.

Many thanks.

share|improve this question
up vote 3 down vote accepted

The GeoDatabase abstraction (not ArcSDE) keeps track of extent of each FeatureClass. Use the Extent property in GeoDataset. One thing to keep in mind, is that this Geometry grows out (increases) but does not shrink. So even if you clip half of the features, the GeoDataset Extent will always show it's biggest state. The only time it gets rebuild is if UpdateExtent gets called again.

Mind you, if every single time you loop through all datasets and have to test the every FC, it can get really slow; O(N) * C where the C is a non-trivial cost associated with loading the Metadata of the FC.

One thing that I did in the past to solve a similar problem as the one you describe was to create a small program that ran couple of hours. It would truncate and re-populate a Polygon FC (I called it GDBExtent). It would basically loop through all GeoDatabase FCs,get their extent and insert it as a feature in GdbExtent. That way, you can get super fast search complexity because it is index based and you do not have to pay the "N * C" price, except only the first C :)

share|improve this answer
+1 It would be nice if Esri provided a more generalized form of a RasterCatalog ... a Catalog that could store any arbitrary dataset, not just rasters. – Kirk Kuykendall Feb 3 '12 at 2:09
I'm slightly astonished that ESRI don't have something like this to offer developers, it seems crazy that we should have to roll out our own indexing of featureclasses. – Vidar Feb 3 '12 at 10:17
@Vidar: Well, I would have told you that one of the gdb metadata classes actually contained this information, in a non-spatial table (so you could query it using minx/maxy type of queries). After the 10x schema changes, I have not looked more into it, but I doubt it got added as a feature. If you put all your FCs in a FeatureDataset and ask the FD for the extent, it will give you the extent for all the FCs contained. Nevertheless it just calculates it on the fly, so it may not be optimal. – Ragi Yaser Burhum Feb 3 '12 at 16:54

The steps I would take to develop this functionality is:

  1. Use the ESRI libraries to connect to a Geodatabase (SDE/File/Personal), because the library will provide you with the abstraction between formats

  2. Use the ESRI libraries to produce a list of all the feature classes in the datasource.

  3. Use the Extents of each feature class to test if there is an intersection.

I'm suggesting to use existing libraries, because they will cover all the nuances that comes with digging behind the scenes of ESRI tech.

share|improve this answer
Makes sense to me - thing is will it be performant if you have thousands of featureclasses in a GDB? – Vidar Feb 2 '12 at 17:50
That's true, it could get slow. The best way to speed it up would be to use a tool like the Geometry Class in Microsoft (.NET) or Shapely (Python) to perform the intersection. You'll cut down significantly on the ESRI COM overhead. – OptimizePrime Feb 2 '12 at 22:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.