0

I have a model that creates a census tract segment layer by intersecting with a .5 mile buffer around every park in the city. It iterates through each park buffer individually on the GISPROPNUM field, and then appends the census tract segments onto a master shapefile. This model works great but I would like to turn it into a tool that can iterate through any layer and intersect it with any other selected layer in any mxd it opens in.

My problem is that after the first iteration, it stalls at the Append step because the schema does not match the target shapefile (because there is no target shapefile yet). Ideally, I would like the schema of the output to match the source (in this case, the park layer).

SO in a nutshell, at the append step it needs a target shapefile whose schema matches the source (the park buffer layer), but how can there be a target dataset if the tool has never been run within an mxd? How do I create a shapefile after the first iteration that can be used as a target dataset?model to be turned into tool

  • Not sure i understand you but how about: 1-Copy the source and 2-Truncate table (desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/…). It will give an empty copy of the source – BERA Jan 11 '18 at 15:00
  • but then it would copy the source for every iteration, right? If I could get this to happen only once and on the first iteration, that would be perfect. – cpbride Jan 11 '18 at 15:04
  • Not sure. Try adding it to the right above Park_CensusTract_Master2 (if that is your source you are appending features to) as a prerequisite to Iterate Feature. – BERA Jan 11 '18 at 15:10
  • Park_CensusTract_Master2 is the output. This model works fine. The problem lies where i try to apply this model to another mxd. I have to create a target dataset based on the schema of what layer would be where "ParksBufferCLIPPED" is. I am trying to automatically create this step within the tool. – cpbride Jan 11 '18 at 15:23
1

What you need to do is create a blank shapefile with the attribute fields you want in it. TempCopy2.shp should work for that, since the model should at least have gotten as far as creating that file. Set that blank file as the target for the Append. If you're still getting a schema error, go into the append operation in the model and set the schema_type variable to "NO_TEST".

  • 1
    That's close to what I ended up doing. I created a tool that makes the schema for the target layer by running an intersect and then deleting all of the records. This is now used as the target for the append. The problem is now that it is a two step process. I don't want to combine the two steps because the schema creation will run through the entire process...which would be a time suck. So a separate tool allows me to select one record, run the tool, and then viola! Schema, baby! – cpbride Jan 16 '18 at 19:33
0

tool to create schema for target layer

This is the tool to create schema for the target layer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.