Macros in ArcGIS Pro?

4179
16
07-26-2016 03:59 PM
HectorBorro1
Occasional Contributor

Hi, Anyone knows how to run an automated process?

I need to to the following 280 times:

  1. select layer by attribute
  2. clip
  3. Label
  4. Change label field
  5. Symbology: Graduated Colors
  6. Change Field
  7. set Method: Quantiles
  8. set Clases: 5
  9. set Color Scheme

Many thanks for any guidance!

Tags (2)
0 Kudos
16 Replies
DanPatterson_Retired
MVP Emeritus

If you use tools in arctoolbox in PRO, then the process can be automated using modelbuilder

What is ModelBuilder?—ArcGIS Pro | ArcGIS for Desktop

If not, then your task is going to have to entail a different strategy.

Using tools in Python—Geoprocessing and Python | ArcGIS for Desktop

ArcGIS Pro SDK | ArcGIS for Desktop

HectorBorro1
Occasional Contributor

thanks!

It's time to learn Model Builder... I was a bit adamant about it. but the alternative is Phyton, which for the moment I don't know...

I'll let you know how it goes.

0 Kudos
HectorBorro1
Occasional Contributor

Ok, So I built my model... The old dog is learning new tricks...

now the task is to automate it...

3 questions:
1. How to set the attribute to a variable. my SQL query is STORE = '1234' or I could use FID in an incemental way?

2. The resulting layer name should be Income_1234. shp where 1234 is the store number

3. How to apply the symbology and labeling?

thanks!

0 Kudos
DanPatterson_Retired
MVP Emeritus

To make inputs changeable, they need to be specified as a parameter, so that there is a 'P' by the oval etc

have a read through that whole section

Creating model parameters—Help | ArcGIS for Desktop

LR
by
Occasional Contributor III

I threw something together real quick, it's not complete but should help I hope. You iterate through all features in your layer (found under Insert), get each feature's FID for example and use that to name your output layers (Variable enclosed in %). Mind the precondition here, which basically means "don't do the step, before the precondition has finished". This ensures you get the proper Val.

Afterwards you could apply the Symbology from another layer - just define one that covers everything you need to show in your seperate layers. IDK why I can't use this with the clipping output, you might need to make a second model and iterate through those afterwards. You can unfortunately only use one Iterator per model .

LeileiDuan1
New Contributor III

If I understand correctly, you were trying to loop through the attribute table and run analysis on each record right? If that's the case, Iterators in Model Builders can be quite helpful.

Iterators—ArcGIS Pro | ArcGIS for Desktop

Examples of using iterators in ModelBuilder—Tools | ArcGIS for Desktop

I haven't tried to apply symbology through ModelBuilder before, but it seems like this tool here could be a good start. The idea is to apply a symbology layer to your target layers. Just gave me something to try out this morning.

HectorBorro1
Occasional Contributor

Thanks Dan Patterson​, L R​, Leilei Duan
I managed to create the iteration and I'll run it in a bit.

One question comes to mind when using  Apply Symbology From Layer—Data Management toolbox | ArcGIS for Desktop as the same problem arises when trying to apply the Symbology...

How could I make the second iteration to apply the symbology and labels?

0 Kudos
HectorBorro1
Occasional Contributor

BTW.. I already have a Style created for this purpose, but can't use it in the ModelBuilder...

0 Kudos
HectorBorro1
Occasional Contributor

It looks like Aplly symbology can't be done on an iteration...

It is not allowing me to get the input working....

0 Kudos