Select to view content in your preferred language

Selecting Input Data Layers using Iteration Variables...

872
6
06-14-2011 08:52 AM
DanBihari
Regular Contributor
I've created a simple model that takes an ascii file, of xyz data, and spatial joins it with a vector lattice gid.

The problem that I run into is that I am unable to select my input ascii files or input polygon features (for the spatial join) using iteration variables.  The iteration style that I'm using is count and I assumed that I could select files by using %n% (for example, K:\Sensitivity_Analysis_Indentification\sample1.asc would be K:\Sensitivity_Analysis_Indentification\sample%n%.asc).

I could use "A Series of Values" but I have over 1300 records.

I'm using 9.3.1 and to be honest I'm not sure if this kind of functionality is even possible.

Any help or assistance would be greatly appreciated.

Thanks.

Model graphic attached.
0 Kudos
6 Replies
DuncanHornby
MVP Notable Contributor
Dan,

Why your model is failing (and I don't think it is to do with the %n%) is that the Make XY Event tool does not take asc files as input. For example sample1.asc won't work but sample1.txt will! I think it's a simple matter of changing the file extension. This is assuming your text files are comma separated and the first row is the header so something like:

ID,X,Y,Z
1,10,10,-9999
2,20,23,-9999
3,11,33,12.5

Duncan
0 Kudos
DanBihari
Regular Contributor
Thank you for you comments Duncan.

The first thing I did when creating this model was to make sure that it ran properly without any iteration.  Once I was satisfied, then I introduced the iteration.

I believe ArcGIS does consider ASCII to be a text file since the model did work the way I expected it to work.

When using %n% as a selection variable, not only does it not work for selecting text files (.asc or .txt), but it also doesn't work when used to select shapefiles, coverages, etc.

I believe the problem is still related to %n% and whether or not the count variable can be used to select files.

Thanks again for your suggestion Duncan.

Cheers!

~Dan
0 Kudos
DuncanHornby
MVP Notable Contributor
Dan,

I do not have 9.3.1 I have 9.3.  Can you confirm as it would be interesting to know that just running the Make XY Event Layer by itself (so not in a model) that you can actually navigate to a file with the file extension .asc? I can't do this, it does not show, but you can? ESRI must have been doing some tweaking behind the scenes if this is the case?

Duncan
0 Kudos
DanBihari
Regular Contributor
Hey Duncan,

I've attached two screen shots: one that shows mapping xy data from an ASCII file in ArcMap and the other that shows mapping xy data from an ASCII file in ArcToolbox.

I was able to map the xy data using both methods / tools, outside of my model.

~Dan
0 Kudos
DuncanHornby
MVP Notable Contributor
Dan,

Thanks for checking this one.

After much poking around in ArcCatalog I found how to make ArcMap aware of ASC files, as always it was a small checkbox in an out of the way part of options that I had to tick. This seems to affect all of ArcMap and the GeoProcessing tools so I can now at least see the file! 😉

So lets start with the obvious, %n% starts at zero, is your first asc file sample0.asc?

Duncan
0 Kudos
DanBihari
Regular Contributor
Hey Duncan,

Lets finish with the obvious.  As embarassed as I am to admit it, my first file started with a "1" not "0".

It works great now.

On the outside chance that my computer has a stroke or my network goes down, I need to figure out how I can restart my model after 0 (just in case).

Thanks again for your help Duncan.

~Dan
0 Kudos