Model builder iterations problem (Txt files to .lyr files)

3427
9
Jump to solution
11-12-2014 04:07 AM
SprumontFrancois
New Contributor

Hello everybody,

 

I have a folder with multiple text files containing X Y data. I would like to transform each of these txt files into a .lyr file.

 

I thought I could work with Model Builder but I think I have problem using "Files iterator".

 

For each txt file, I would like to obtain one .lyr file but by running the below model I obtain a single file (and not several one).

 

Could you please help me ?

 

Model builder iteration problem.png

0 Kudos
1 Solution

Accepted Solutions
Pieter_Geertvan_den_Beukel
Esri Contributor

The Iterate Files tool has an output format (file) that can not be connected to the Make XY Event Layer tool. Use the Iterate Tables tool instead.

See NewModel in attached toolbox.

View solution in original post

0 Kudos
9 Replies
RaymondHuang1
New Contributor III
Looking at your model, your make xy event tool will only run once. Your make xy event tool should take in the output of the iterator as an input(solid arrow) instead of a precondition (dotted arrow) like what it is now. Can you try to change this and let me know if it works for you? 
0 Kudos
SprumontFrancois
New Contributor

Hello,

Thank you for your reply.

I don't know why but when I try to connect the green box "File.txt" and the tool "make xy event layer" it is always a dashed line (precondition) and not a solid one.

perhaps I have to fix something with the name of the Input / output...I don't know what's going wrong

0 Kudos
RaymondHuang1
New Contributor III
Attach a screenshot of your textfile content format please? 
0 Kudos
ChrisDonohue__GISP
MVP Alum

The naming may become an issue if the resulting layers are being placed in a File Geodatabase.

Additional rules

Chris Donohue, GISP

0 Kudos
SprumontFrancois
New Contributor

More precision on the data ? Ok !

The text files I want to transform in .lyr files (or shapefiles...) are composed of 3 columns: X,Y and time.

Here is an overview:

Y,X,TIME

51.21646,5.08759,1900-01-01 10:37:27

51.21643,5.08798,1900-01-01 10:37:32

51.21653,5.0882,1900-01-01 10:37:37

51.2166,5.08844,1900-01-01 10:37:42

51.21664,5.0886,1900-01-01 10:37:47

51.21664,5.0886,1900-01-01 10:37:52

What I don't understand is that when I develop a model for one single text file, it works. Thus, I think my issue is related to the "File iterator tool".

0 Kudos
RaymondHuang1
New Contributor III
I tried to quickly create a similar model and it works on my side.

​Can you share your toolbox containing your model please? 
0 Kudos
SprumontFrancois
New Contributor

Ok, no problem.

In the attached file, the toolbox related to the picture I posted previously.

Let me be clearer: In a folder called Folder1, I have multiple text files structured like this:

Y,X,TIME

51.21646,5.08759,1900-01-01 10:37:27

51.21643,5.08798,1900-01-01 10:37:32

51.21653,5.0882,1900-01-01 10:37:37

51.2166,5.08844,1900-01-01 10:37:42

I would like to use model builder to automate the process of "Make XY event layer" and "save to layer file".

I thought I could use the file iterator tool to run the model on all the text files in folder 1.

Thanks for your help !  I appreciate a lot...

0 Kudos
Pieter_Geertvan_den_Beukel
Esri Contributor

The Iterate Files tool has an output format (file) that can not be connected to the Make XY Event Layer tool. Use the Iterate Tables tool instead.

See NewModel in attached toolbox.

0 Kudos
SprumontFrancois
New Contributor

Great, Thank you !

I thought I had to use the "File iterator"...I don't know why I never tried this "Table iterator"...

Thank you for your help !

0 Kudos