I am trying to build a model that iterates through feature classes in a .gdb
and uses the name of feature class
(they are named by state abbreviations) to make a new layer from a second feature class
based on that name.
enter image description here
The second feature class, osm_bing_diff_uniqueid
has a field called st_abbr
that identifies a feature by state abbreviation. What I want to do is parse the Name
output of the first feature class into the expression for the Make Feature Layer
of the second feature class. For example, if the Name = AL_Bldg_FP_Parcels
, I to make a feature class of all the features in osm_bing_diff_uniqueid
where the st_abbr
field value is AL
. I am a little confused as to how to use the Name as an input and parse it into the expression.
Any suggestions? Fe
-
2Are you iterating through the features in a single feature class, or through a number of feature classes in the .gdb? The first sentence isn't clear.Bjorn– Bjorn2020年02月07日 21:32:04 +00:00Commented Feb 7, 2020 at 21:32
-
Through feature classes in a .gdb.gwydion93– gwydion932020年02月07日 22:26:25 +00:00Commented Feb 7, 2020 at 22:26
1 Answer 1
You can use Calculate Value (from model only tools) to get this value. If you put this python expression in Expression argument, %Name%[:2]
, it should give the first two letters of the Name
in-line variable in a new variable, output_value
by default. Then you can introduce this into your query builder as in-line variable, for example, "st_abbrv" = '%output_value%'
.
UPDATE
You should introduce Calculate Value both preconditioned to the Name iterator output and as a precondition to the Make Feature Layer.
-
Do I need to use code block somehow in connecting
Name
as an input toCalculate Value
? When I add "Name%[:2] " (or anything other than justName
), the connection arrow disappears. Should I just useName
as a precondition to running Calculate Value? Everytime I iterate through the.gdb
, I want it to get a newName
and calculate a newoutput_value
to input in myMake Feature Layer
process.gwydion93– gwydion932020年02月10日 14:08:00 +00:00Commented Feb 10, 2020 at 14:08 -
1Sorry, I missed that detail, you should introduce
Calculate Value
both preconditioned to theName
iterator output and as a precondition to the Make Feature Layer.fatih_dur– fatih_dur2020年02月11日 01:45:47 +00:00Commented Feb 11, 2020 at 1:45
Explore related questions
See similar questions with these tags.