Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I use in_memory workspaces to speed up some Python script tools that get published as Geoprocessing Services significantly.

The tools open MXDs and perform, among other things, an ExportToPDF.

In the MXD there is a layer that references a dataset stored on disk.

At runtime a new dataset gets created with the same schema as that above, so that it can replace it as the data source but, given a choice, I would like that new dataset to ONLY be written to the in_memory workspace.

My testing suggests that using in_memory workspaces like this is not supported by either Layer.replaceDataSource or Layer.findAndReplaceWorkspacePath.

Is there a way to replace the data source of a layer with a feature class stored in the in_memory workspace so that it can be displayed in a map that gets exported to PDF before the in_memory workspace is deleted?

It looks like this would possible using ArcObjects and an InMemoryWorkspaceFactory but here I need an ArcPy solution.

If there is no way to do this using ArcPy at ArcGIS 10.0 (and nothing coming at 10.1) then what I will do is to propose as an ArcGIS Idea that Layer.replaceDataSource be enhanced to support a workspace_type=INMEMORY_WORKSPACE option.

Note: I have also posted this to the ArcGIS Discussion Forums but have had no replies there so far.

An ArcGIS Idea has also been submitted for this to be enhanced.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

This is now the subject of an ArcGIS Idea that can be voted for by anyone else that has the same requirement.

It seems strange that an InMemory Feature Class can be displayed in ArcMap and has a Location on the Source tab of its Layer Properties of GPInMemoryWorkspace that cannot be browsed to or used with replaceDataSource.

Data Type:  InMemory Feature Class 
Location:             GPInMemoryWorkspace
Feature Class:  SearchArea
share|improve this answer
add comment

Your Answer

 
discard

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.