I am selecting features based on attributes within an ArcGIS Add-In. The selections are pretty simple(e.g. "DESCRIPTION = left"). Is there a tool or method of doing this that doesn't require passing layers around? Is there a simple ArcObjects method I may have looked over?

After the selection I will need to pass the selected features into another geoprocessing step - so I need to get the output selection as a path (string).

Currently I am:

1) Creating a feature layer from a given file.

2) Selecting features from the layer.

3) Saving the layer using Copy Features to get the output as a new shapefile.

  • I don't think so, not with the geoprocessing tools. The geoprocessing selection tools require a layer as input as stated in the documentation.
    – Sean
    Sep 15 '11 at 19:38
  • How about using ArcObjects?
    – Radar
    Sep 15 '11 at 19:52

From the help topic 'Using geoprocessing to develop applications':

The following are some misstatements about geoprocessing:

Misstatement—Geoprocessing tools only take datasets on disk as input and only write datasets to disks. Another way this has been stated is that geoprocessing is "pathname to pathname" only. Only pathnames to datasets can be used as input and output parameters.

  • In fact, you can use equivalent ArcObjects anywhere features classes are expected. For example, you can do the following:

    • Pass an object with IFeatureClass or IDataset as input to a tool instead of a pathname string.

    • Create in-memory feature classes, manipulate them, and use them in geoprocessing tools.

    • Use the special in-memory FeatureSet and RecordSet objects instead of feature classes and tables. These two objects behave like their on-disk counterparts.

That said, a Layer is already a pretty lightweight representation of a subset of data so my guess is there is not going to be a big difference between using a FeatureSet vs. a Layer.


When you say "doesn't require passing layers", if you really mean doesn't require saving files to disk in order to run your next geoprocessing step, then yes.

As @blah mentioned, you can create "in memory" layers (instead of writing them to disk). In Python or ModelBuilder, simply include "in_memory\" in front of the output name (of your "Copy Features" geoprocessing command, such as "in_memory\tmp_copy_features"). This will send the output of your gp process into a memory worksapce and will not write it to disk.

Then you can simply pass that "in_memory" file to your other gp processes and it will automatically be deleted when it is no longer needed.

For more details see ArcGIS 9.3 help or ArcGIS 10 help .

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.