Select to view content in your preferred language

Can a in_memory and a inline varible be combined as an output?

2257
10
Jump to solution
05-25-2017 12:54 PM
BrianWade
Frequent Contributor

In ModelBuilder I’m iterating multiple shapefiles to intersect against a single point layer, then write out using feature Class to Feature Class tool (I only want 2 columns in the output file).

 

I would like to have the Intersection output "in_memory" for quicker processing.

I also need to have the input polygon filename in the final output.

 

This works without the "in_memory"

 

Seeing the error message below is leading me to believe my issue is that I can't combine "in_memory" with a %name% inline variable as output of my intersect tool?

 

Also if I can accomplish this, won't I need to change my Feature Class to Feature Class tools input to in_memory also?

 

Any Help is appreciated

 

Thanks

Brian

0 Kudos
1 Solution

Accepted Solutions
NobbirAhmed
Esri Regular Contributor

In memory data is stored in a in_memory geodatabase - I see you are trying to send your in_memory output to a folder - that's why your execution is failing. Just take the .shp off from your output name and try again.

View solution in original post

0 Kudos
10 Replies
NobbirAhmed
Esri Regular Contributor

In memory data is stored in a in_memory geodatabase - I see you are trying to send your in_memory output to a folder - that's why your execution is failing. Just take the .shp off from your output name and try again.

0 Kudos
BrianWade
Frequent Contributor

yep, tried it

"ERROR 000354: The name contains invalid characters
Failed to execute (Intersect)."

what do you thinks invalid? the "%" or maybe the "_" in my polygon shapefile polynames?

Thanks

0 Kudos
NobbirAhmed
Esri Regular Contributor

Your output should look like this:

in_memory\Int%Name%

And take off the .shp from name as output goes to a geodatabase, an extension of *.shp is invalid.

0 Kudos
BrianWade
Frequent Contributor

Yep x2

Ive taken .shp off, still no Joy

it's got to be simple, maybe something in my naming? but I don't see it..............

my layer names within my geodatabase are:

D_MDCL01_p_2010

D_MDMEDAA_p_2010

they seem normal to me?

I wish the error codes were more helpful

Thanks

0 Kudos
curtvprice
MVP Esteemed Contributor

The Intersect output name should not be constructed using the pathname output from the iterator because that includes the ".shp".

 I usually name intermediate data something simple and obviously temporary like "in_memory\xxint001" because it's clearly throw away. I notice You have your Intersect output set to be a parameter, I don't see a reason to do this as it will prevent it from being automatically deleted by "Remove Intermediate data".  

The output of feature class to feature class can be defined however you want, I'd use %Name%  as part of the name and not make it parameter if you want the iterator to name it. However, I would expose the output workspace parameter of  FCtoFC as an parameter. (Right click the tool, make parameter from...)

0 Kudos
curtvprice
MVP Esteemed Contributor

One more thing, Dissolve may be a little easier to use than FCtoFC.

0 Kudos
BrianWade
Frequent Contributor

ok, I removed the feature Class to Feature Class portion of the Model and the Intersection portion, writing to in_memory worked.

I then re-added the Feature class to feature class tool from scratch and viola it worked!!!!!

perfect!

is there a way to delete the in_memory after each intersection process or do I have to wait until the whole process has completed, I have to run this for 25+ point files and will have a couple of multi million record counts.

and I still dont know why since we installed 10.5, I get the warning message (in yellow)but it keeps churning along.

Thanks everyone for the help.

Brian

0 Kudos
curtvprice
MVP Esteemed Contributor

I have to run this for 25+ point files and will have a couple of multi million record counts.

I really think you should take my advice and use a temporary dataset (xxint01) that will be overwritten on each iteration. Otherwise you are in danger of filling up in_memory and hanging your computer. In fact, using in_memory with big datasets like this is really risky, you would be much safer to write to %scratchGDB%\xxint01 instead of in_memory\xxint01.

0 Kudos
BrianWade
Frequent Contributor

Cool, but isn’t there a processing speed advantage to writing to memory vs writing to a scratch gdb which to my limited understanding, is still writing to the HD? I’ve never utilized the scratch GDB option.

 

I assumed that writing to memory then cleansing or Deleting each time would be quicker?

 

My initial model had after intersection, writing to a shapefile and then writing just the 2 fields I wanted out to my final processed file.

Thanks

0 Kudos