Tuesday, 8 May 2018

arcgis desktop - ModelBuilder continually overwrites instead of creating new file?



I am working on building a model that uses this tool to convert Points into GPX files for use in my GPS units.


I've built a simple model that seems to work, except that the final output is constantly overwriting with the same instead of iterating to the next Name entry.


The model looks like this


enter image description here


Geodatabase holding file is a parameter that lets me select the GDB with all the various point layers. Name of File is basically R:\FilePath\GPX\%Name%_GPX.gpx


When I run the model, it will iterate down the line of files inside the GDB, but they all just get the name of one of the files.


The results window looks like this, repeated.


Executing (Features to GPX): FeaturesToGPX "R:\FilePath\2016ST_AllPoints.gdb\ST2016IA131" R:\FilePath\GPX\test1\ST2016IA201_GPX.gpx # # Start Time: Tue Oct 25 10:35:20 2016 Running script FeaturesToGPX... Completed script FeaturesToGPX... Succeeded at Tue Oct 25 10:35:21 2016 (Elapsed Time: 0.76 seconds) Executing (Iterate Feature Classes): IterateFeatureClasses "R:\FilePath\2016ST_AllPoints.gdb" # POINT NOT_RECURSIVE Start Time: Tue Oct 25 10:35:21 2016 Succeeded at Tue Oct 25 10:35:21 2016 (Elapsed Time: 0.27 seconds) Executing (Features to GPX): FeaturesToGPX "R:\FilePath\2016ST_AllPoints.gdb\ST2016IA156" R:\FilePath\GPX\test1\ST2016IA201_GPX.gpx # # Start Time: Tue Oct 25 10:35:21 2016


Anyone have an idea why my model is overwriting and not moving on?



Answer




There are several ways to deal with naming in model builder. ArcGIS has a help section on this: A quick tour of using inline variable substitution.


Based on your issue, this example seems to best suit your needs.


enter image description here


Alternatively you could call the %i% or %n% system variables, which output files in the following form: file1, file2, file3, file4... The %i% system variable references the current list position, while the %n% system variable references the current model iteration.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...