I maintain an extension to ArcMap (currently at 10.2.2) for coworkers' internal use. Several people lately have been tripped up by un-set spatial grid settings when trying to export data into a file geodatabase from our non-SDE SQLServer database. My extension isn't involved in the export itself--rather that happens using standard Esri tools. Consequently I need to set the "Output Spatial Grid" size settings once universally. I'd like to include a check at startup that will look at these settings as they are stored on disk and change 0,0,0 to some useful values. No user involvement is needed or wanted. I've perused the ArcObjects doc, scoured my registry, and Googled for an entire afternoon and ended up having to ice my Googler . . . no luck. Can anyone provide information on either:

  • Where on disk the "Output Spatial Grid" settings are stored, and/or
  • ArcObjects references for how to change them

I've tried the following with no luck.

    var gp = new ESRI.ArcGIS.Geoprocessing.GeoProcessor();
    gp.SetEnvironmentValue("spatialGrid1", 50);
    gp.SetEnvironmentValue("spatialGrid2", 200);
    gp.SetEnvironmentValue("spatialGrid3", 800);

But even if that works, I believe it would only alter the settings for the current session. What I'd prefer is to write the values to disk as if the user had made the settings changes manually in ArcCatalog.


How about doing away with the user having to make a choice? You could call the Calculate Default Spatial Grid Index (Data Management) tool and according to the Help file the output of this can feed into the Add Spatial Index tool?

If you want to read from an existing FeatureClass the spatial grids then these can be accessed via the IGeometryDef Interface.

  • This solution seems to require knowledge of when the export happens, yes? My extension can't do that ... or at least I want to avoid setting an event listener. I've made an edit to my question explicating that requirement. Thanks! – id est laborum Jul 7 '16 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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