20 cap libro

Embed Size (px)

Citation preview

  • 7/27/2019 20 cap libro

    1/36

    Section 8 : Mod e l ing

    C hapter 20C reating m odeis

    S t a r ti n g a m o d e lB u i ld i n g a m o d e lE n h a n c i n g a m o d e l

  • 7/27/2019 20 cap libro

    2/36

    538 t i ctrnrr 8 : i t i l n d c r l i r tGIS is often defined as a computerized system for the creation, management, query,analysis, and display of spatial data. The organization of this book refects that task-orienteddefinition. But GIS is also defined as a decision support system, in which computer softwareis used to model spatial processes and to solve problems analytically. This process-orienteddefinition applies to the book's final chapter.In chapters 11 and 12, during the tree-harvesting analysis, you learned how to use some ofthe geoprocessing tools in ArcToolbox, such as Dissolve, Clip, Buffer, and Union. Individu-ally, these tools are useful for completing particular tasks, but their real power, as you saw,lies in their being used together to solve a complex problem.The tools in a real toolbox (hammers, saws, screwdrivers) have their own special uses, too.But again, if you want to accomplish something significant-like building a house-youhave to use these tools together in a carefully planned sequence of steps.Carpenters build a house from a blueprint or scale model. In ArcGIS, you can use ModelBuilderto make a blueprint of your analysis. Like a good carpenter, ArcGIS will then carry out theindividual procedures in order according to your plan.

    ModelBuilder is a graphical interface for diagramming solutions to spatial analysis problems.The diagrams you make are called models. Bclow, a very simple model shows a Bufferoperation being applied to an input datases to creare a new output dataset.

    -oXModal Edo View W~ H Hp

    HWter otNestsF

    A complete model is an interconnected set of such processes, each consisting of input data,a tool, and the resulting output data. The next model consists of three processes: two buf-fers and a union. Notice ruar rhe outputs of the buffer processes become the inputs ro theunion process.The eletnents of a process are distinguished by their symbology. By default, input data isrepresented by a blue oval. Tools are represented by yellow rectangles. Output data isrepresented by a green oval. The representative shapes can be switched if you wish.

  • 7/27/2019 20 cap libro

    3/36

    Creating m ori'r ' 539

    Bu f fe r ( 2 )

    Buf f e r

    Once you have diagrammed a model, you can run it with a single click. ModelBuilder runseach of the processes in turn, passing the output of one process on to the next process until afinal dataset is produced.Suppose ,vou were asked to re-creare the analysis you did in chapters 11 and 12, but with aslight variation, such as a different goshawk nest buffer? Or suppose you were asked to doexactly the lame analysis, but for a different lease arca?You could do it, of course, by reworking the chapter exercises. You would open the tools inArcToolbox, set their parameters, and run them-and it would take you just as long (or al-most as long) as it did the first time. In fact, whenever you wanted to calculare harvest standvalues, assuming this was a regular part of your job, you would have to go through the samelengthy process.Now imagine that you have already modeled the analysis in ModelBuilder. When a newpiece of information comes in-rhe protected zone around goshawk nests has been changedfrom 800 to 1,000 meters-you don't have to reconstruct your entire workflow. Instead, youjust open the model, change a parameter in the nest buffer process, and rerun the model.That's all it cakes. When the time comes to bid en a different lease, you can copy the modeland change the data sources used as the inicial inputs.ModelBuilder can save you huge amounts of time if you perform repetitive spatial analyses.It also lets you evaluate the changing conditions and what-if scenarios that arise in decision-making situations.Furthermore, models are a good way to evaluate the soundness of your methodology, todocument this methodology for others, and to develop and refine it over time. Sharing mod-els with colleagues helps to standardize decision-making processes. Of course, your timbercompany might not want to share its successful model with competitors, but if you workedfor a government agency, you could use models to exchange knowledge and to establishuniform practices.For more information about spatial modeling and ModelBuilder, click the Contents tab inArcGIS Desktop Help and navigate to Geoprocess ing > Autom at ingy our work wi th m odels >Using ModelBui lder.

  • 7/27/2019 20 cap libro

    4/36

    540 tiectioii 8: Modeliiig

    S t a r t i n g a m o d e lModelBuilder is not a free-standing software application like ArcMap or ArcCatalog, but it'smore than just a geoprocessing tool: it's a design environment for creating workflow dia-grams called models. Like tools, however, models are stored in a toolbox. In earlier chapters,you used some of the tools and toolboxes that come with ArcMap. In Chis exercise, you willlearn how to creare a new toolbox and put a model inside it.A new toolbox can be created in ArcToolbox, or in an ordinary file folder, or in ageodatabase. Since models are stored in toolboxes, these are also the three locations in whichmodeis can be created.

    ArtToolbox% Analysis Toolshl Exudar] Ovaday1 P,ovrty

    b Statisths15 Cartography bolo

    ':+ Conve'sbn Tools15 Data Management Todo

    lb Geocoding Tods- Harvest Modelo 4

    Harvest Profltabity -ot l ne ar R e f e re nc i ng T oo l s+ Moblle Tools+ a Murtidorrension Toas+ Sarnples

    S ch e r r o f lo s Ta a l s+ Server bolo. : Spat ia l Stat ist ics bolo

    b Mulbple Ring Bfer

    I n d ex s em c h f9 es u M oM o d e l :,i Harvest ProliaL a j e : r z a a n , Y dal ,,rir.d

    The ModelBuilder window has its own menu and toolbar. Many of the controls have thesame icons and functions as ArcMap controls.M a i n ' M o d a lmenu M o t l e l Edl View Window He lp

    j, i ilnl%liB k1,91 >j --o

    Dspay >B u f f e r o fNestsF

    G e o d a t a b a s e _,,1orestlands.mdbU s e r - c r e a t e d t o o l b o x H a r v e s I M o d e l sM o d e l 1 , t H a r v e s t P r o f i t a b i l i ty

    U s e r - c r e a t e d t o o l b o xM o t l e l

    F o l d e r

    ' , u J C h a p f e r 0 7t i ] Cha pte108+ 1 Chapte r09+ J Chaplerlo+ J Chapterl1J Chapterl2* J Chaplerl3

    Chaplerlo J Chaplerl5+ J Chaplerl6+ J Chaplerl7J Chaplerl8I L J C h a p le r l9

    l=; IJ Chaple,20J DataJ MyDalaJ MyToolboxeU s e r - c r e a t e d toolbox -1 lo 4

    T o n l h a r

  • 7/27/2019 20 cap libro

    5/36

    Creating modeL 541

    E x e r c is e 2 0 aIn the next three exercises, you will create a model of the harvest profitability analysisfrom chapter 12. (The data preparation you did in chapter 11 is assumed to be complete,although you could include those operations in your model as well.)'Ihe logic of the analysis is not repeated in detail here. If you feel unsure about the orderof the steps or the reasons behind them, you can refer back to chapter 12. The focus ofthis chapter is mainly on how to diagram the analysis in ModelBuilder.In this exercise, you'Il make a new toolbox to store your model. Then you'll create amodel and add one process to it.

    1 Sta r t A rcCa ta log . In the ca ta log t ree, nav iga te to C:\ESRIPres s \GTKArcGIS \Chapter2O\MyToolboxes . Right- click MyToolboxes , point to New, and c l ick Toolbox .

    Fie Edt ybw yo Tools window Nelpb Qx s s E' Vl $ O R? i Qd

    C \ E S R I R e s s \ G T F . A i e G I S \ C h a p t e r 2 O \ M y T o o b o x e s

    i?: J Chapterl0J Chapterll

    i. ;J Chapterl2s J Chapt,,13

    J ChaptalaF J Chapte 15[^ J Chapterl61 J Chepter17

    F +,_] Chaptd18;J Chepterl9J Chapter2D

    J DataJ MyData

    + _y yodo. ex20arnsdj ex2Cb -d

    . J Gistutona

    . J Gistutona te s te d.J hpJ 3%

    . J MSCDEX23

    C;ZMI i Review 1 Met dM.NeTvP+oobo * o 1

    A new toolbox is added with its default name highlighted.

    20

  • 7/27/2019 20 cap libro

    6/36

    542 Srr tiOfl .'lln e li^rg

    2 In the catalog display, change the new toolbox narre to H a rvest Mo d e is and press Enter .In the cata log t ree, expand the MyT oolboxes fo lder i f necessary,+ J Chapter07J Chapt er0r08 J Chapt9

    J Chapterl 0+ J Chapterl1J Chapterl2J Chepterl3J Chapte,14J Chepte15J Chape19J Chapterl?tl J Chapterl8J Chaplerl9

    Chapler20+ 1 Dala3 J MyData. J M y T o o b o x e s

    b H a r v e s t M o d e l s 4J *+20a mxdJJ ex20bmxda-J

    You have created a roolbox in an ordinary file folder. If ,vou look at the toolbox with afile browser, such as Windows Explorer, it appears with a tbx extension.

    Now you will create a model within the toolbox.3 In the cata log t ree, r ight-c l ick the Harvest Mo deis toolb ox, point to New, and c l ick Model.

    M + dd E 6 1 V ia w W inda w H e I pJJ ^t% +, :elal: l::l a"*u R J

    The model window opens. You'll change the name in the title bar to sornethingmore meaningful.

  • 7/27/2019 20 cap libro

    7/36

    Crea t ing model1 543

    4 In ModelBui lder , c lick the Mod el m enu a nd c l ick Mode l Proper ties. In the Mod elPropert ies d ia log box, the General tab is s e lected. In the Nam e box, replace Mod elwith Harv estPro f i tabil i ty ( the m odel nam e cannot contain any spaces). In the Label box,replace Model with Ha rvest Pro f i tabil i ty ( the m ode l l abe l m ay conta in spaces ) . Makesure the dia log box m atches the fo l lowing gra phic, then c l ick OK.5--1 ierem)Emvan 4. 1--1

    Led

    7 1J

    r 5faa 5100 cdh ramr ,S. do l e b ,dle ae^sl

    r7aThe title bar is updated with the new name. Now you will save and close the model soyou can work with it in ArcMap.

    5 On the M odelBui lder too lba r , c l ick the Sa ve but ton.k1 --l 0+, :: D I . :l : Q e Ok -0 R .-Y it

    6 Click the Model menu and click Close.7 In the ca ta log t ree, c l ick the p lus s ign ne x t to the Harvest Mod els too lbox.

    J Chapler07J Chapter08. J Chapter09J Chapterl0t J Chapterl 1J Chapterl 2

    {_J Chapter13I1 J Chapter141 J Chapterl5C J Chapteil6L_. _ 1 Chapter17[+] ;_ J Cheptn18t ;J Chapte,l9f {^ Chapte,20t~ J Data[ J MyData

    C1 J MyToo oxes

    20

    e u 2 0 a m r dE!1 ex^nrm^d ^

  • 7/27/2019 20 cap libro

    8/36

    544 ^eitio7, s : Modeling

    The new toolbox is not automatically added to new ArcMap documents. To work withthe Harvest Profitability model, you must first add the Harvesr Models toolbox toArcToolbox from within ArcMap.

    8 In the catalog t ree, double- cl ick ex2 0a . mxd to l aunch A rcMa p and open the m apdocum ent. (If ArcMa p is a l read y running, c lick the Fi le menu a nd c l ick Open. Navigateto \GTKArcGIS \Chapter20. Cl ick ex20a .mxd and c l ick Open.)@& re 4 @o*, rks Ineert eann l.., lylndaw neb

    u d12+11835-

    0 , . oQ r a w i

    sm^e, seuon a c-R u - A r

    w1 :2 o, Ob o ) - R?

    J36 H! QA- tM. _i - _

    98]]9].35 zaaffe 928 eters

    1he map contains layers for lease F, goshawk nests, and streams. It should look familiaras it has the same data and symbology as exl2a.mxd.Now you will open the ArcToolbox window and add the Harvest Models toolbox to it.

    9 On the Standa rd too lba r , c l ick the Show/Hide A rcToolbox Window b ut ton to openArcToolbox.10 Pos it ion A rcMa p and A rcC ata log so tha t the A rcToo lbox window a nd the ca ta log t reedon' t over lap. Make A rcC ata log the act ive appl icat ion. In the cata log t ree, c l ick theHarves t Mode ls too lbox a nd d rag i t to the bo t tom o f the A rcToo lbox window.

  • 7/27/2019 20 cap libro

    9/36

    Creating moc lel5 545

    L7 Chapte07[ti tj CJupteioer4] Chaptc09.1 Chaptert 0rl Chapter11J Chapteri 2

    ,_] Chapterl3. J Chapter14+ J Chapterl5_J Chapter16J Chapterl7. J Chapter18

    . . _ . l C h a pt e r l9J Chepter20J Dalelil J M9DataL9 .,J MyT odboees1 m

    JHarvest ProlitaJ13 ex20ad

    .a1 x?flhmvrl

    o n d r s i s T o a s 9 cdrographv Tools+ 9 ConversiOf ToohD a t a M g V g a m e n t T o a s

    GeO+odlrg Tools. Lmear ReferenM Toas

    M ob l l e T ooh>] Mu tldnw lon Toas+ 4 s a m g e s

    4chametks Tooh. SeroMToolsS pa t w 5 t a t l sh cs r o a b

    ` ^ S - S y a r s T o a bc a r t o a r a p h r T o p b9Onoersgn ToaSD a t a Ma n a g e m e n t To a s

    + 9e oc odng T oo l s9 Harvest Modelo 49 Llnear Rererend g T o n o

    3 Mobhe Too5 3 Mutfdransion Toab

    5a haSchematlcs Toohs e rve . T oasspa t e l 5 t e t 1 st k s To d :

    The Harvest Models toolbox is automatically put in alphabetical order with theother toolhoxes.

    11 Make A rcC ata log the act ive appl icat ion. C l ick the File m enu and c l ick Exi t .

    12 In ArcM ap, in the A rcToolb ox window , c lick the plus s igr i next to Harvest Mod elsto expa nd i t. Right-c lick the Harvest Prof i tab i l ity m odel a nd c l ick Edit . When theModelBui lder window opens, m ove i t so that i t doesn' t over lap ei ther the ArcT oolboxwindow or the ArcM ap tab le of contents.lomw~

    F i e E d 4 y e w g o o k m a r k s [nsert &lectoon Toas Wso ora Heb11239.224

    NestoFArcTOdbox

    .: A.nehsis Todo

    - S t r e a r n s F4 Cartogaphy bocio

    Canversion TocaData Management Toas

    .. Geocodhg Todo7 L e a s a F 4 H a r v e s t M o d a s

    .Harvest Prof6abRy

    Lmear Rekare oorg Tocha+

    Mobie Tools4 Multldxnsio r Todo+

    lb SamplesSchematics Toas

    +Server Todo9patla 50516805 Todo

    pySoce Salecli n Fav , lrrde>t S-ch Restws@ a w y t < J . R u - A 10Ana

    HaCVest Prafitah v

    _ 1 1 X J

    20

  • 7/27/2019 20 cap libro

    10/36

    546 1ection 8: Moa/eling

    Now you will creare a process to buffer the goshawk nests . You will drag and drop theBuffer tool from ArcToolbox and the NestsF layer from the ArcMap table of contents.

    13 In the A rcTo olbox window, c l ick the plus sign nex t to A na lysis tools, then c l ick the plussign next to Prox im ity.14 Click the Buffer tool and drag it to ModelBuilder. Drop it in the center of the

    ModelBuilder window.. b . .

    n r d ya s i o o ke.ni- RoKYn1Y

    a Mukgb PMeRatlslxs

    c . l oc raonr rootccr n a d o n r o o cD .. Me n e pm.ni 7 . MGmcodnq tods

    : rvvest PrcNtaryror 0.Merenap To

    Md4b T dss MWHwswn iods

    mgksiOn mlks tods x. r roon

    Soetitl eMSks rack

    McM Ede Vt, Winduv+ HeI

    The Buffer tool, represented by a rectangle, is added to the model. An arrow connectsthe tool to its output data, represented by an oval. Blue selection handles indicate thatthe elements are currently selected. The fact that they are not colored in means that theyare incomplete-they are waiting for input data ro be atrached.

    15 In the Ar cMa p table of contents, c l ick the Nests F ayer. Drag i t to the Mod elBui lderwindow a nd d rop i t d i rect ly on top of the Buffer tool rectang le.; . Ha rves t P ro f i ta bs i tyModei Edt View Wndow Help

    The NestsF layer, represented by an oval, is autotnatically conne cted to the tool it wasdropped onto.

  • 7/27/2019 20 cap libro

    11/36

    Creativ rrrn (Ph 547Now you will change the tool and output data settings.

    16 In the m odel , doub le-c lick the Buf fer tool rectangle.x

    I n p u t F e a t u r e sNestsF a

    O u t p u t F ea t u r e C l a s sC:^ESRIRress^GTKArcG151Chapter20^Data^Tongass.mdb'{NestsF_Buffer

    Distance [value or field]Lineen ur i t MesF i e l d

    Side T ype o ionalE n d T Vpc t o n a lDissolve T tionalNNE

    DissoWe F ie ld (s ) (opcional )Cancel Apph ShowHeI

    The Buffer dialog box opens-exactly as if you had double-clicked the Buffer tool inArcToolbox. You will fill in the tool's parameters just as you did in chapter 12.By default, the output feature class is set to the Tongass.mdb file in the chapter 20 Datafolder. To keep the model data separare from the book's exercise data, you will changethe output location to the MyData folder.

    17 Cl ick the Browse button next to the Output Feature C lass box . In the Output FeatureClass d ia log box, navigate to \GTKArcGIS \Chapter20\MyData and doub le -c li ckMyTongass.mdb.

    18 In the Nam e box , type Nest B uf , then cl ick Save.The output feature class information is updated in the Buffer dialog box.

    19 For the buffer d istance, m ake s ure the Linear unit opt ion is selected. In the Linear u nitbox, type 800.The distance units are correctly set to meters. Trees cannot be harvested within 800meters of a goshawk nest.

    20 C l ick the Dissolve Type drop-d own arrow a nd c l ick AI I.Overlapping buffer polygons will be dissolved to make a single feature.

    20

  • 7/27/2019 20 cap libro

    12/36

    548 section 8: I4oeieling

    21 Ma ke sure the dialog box m atches the fol lowing g raphic, then cl ick OK to close the tool.I n p u t F e a t , e sINesLFOutput F.~ e ClassG . l E S R I P r e s z I G T R J . reGiSp_hapter20lMyDatalMyTOngass m d E l N e s t B U l

    0 i s t a n c e [ v a r e p r f i a d ]L ie a u nt

    Cancel yv1y

    Clicking OK here does not run the tool, it just closes the dialog box. In ModelBuilder,you can double-click a tool whenever you like to view or change its parameters.

    The elements are colored in now, which means the process is ready to run.When you run the process, a new feature class will be created and saved to disk. Theoutput data is not automatically added as a layer to ArcMap, however. If you want thedata added to the map, you have to set a property on the output data element.

    22 In the model, right-click the NestBuf oval and click Add To Display to check it on.23 On the ModelBuilder toolbar, click the Run button to run the model.j j+

    As a model runs, each of its tools turns red. Your model has only one tool, so if youweren't watching closely (or if the progress report covered the model), you may not haveseen it. When the tool is finished, it turnsyellow again.

    1 0 1 R c c e , e e s , A e d

    cu~1

    f- amen.doy ,awnco .de,edaur9^ tnct Time: Wetl 1 1 09 15:33:302000Execvted (BUtr su 3tu19.

    c :leed J 1 09 15nd Ti e : 15:33:32 2008(Elapsed Ti-: 2.00 sconde)

    1

  • 7/27/2019 20 cap libro

    13/36

    Crea t ing m odel s 549

    24 Click Close to close the progress report.

    nui la a . +,,zr -2a s ^ r m K

    I ,vr^c^wmiaru n o ^ r c y

    ^ 4b nnq BlFe

    NW?I Ea Hew - tubJ J .% RMIla J

    -1 :2 r-i3m.- R'

    The NestBuf layer is added to ArcMap. (You may need to move the ModelBuilderwindow to see it.)In ModelBuilder, drop shadows behind the tool and output data elements indicare thatthe process has been run. Once a process has been run, it does not run again unless youchange a parameter, or choose Run Entire Model or Validate Entire Model from theModel menu.

    25 On the Mod elBui lder toolba r, c lick the Save bu tton to sa ve the mod el .2 6 C li ck t h e M o d e l m e n u a n d c li ck C l o s e t o c l o s e t h e m o d e l . In A r c M a p , close the

    ArcToolbox window.The model and all its settings are stored in the Harvest M odels .tbx file you created atthe beginning of this exe rcise . There is no need to save changes to the map document.

    2 7 I f y ou a re cont inu ing w i th th e ne xt e xe rc is e , l e av e A rcM ap o pe n. O t h e rw is e , exit theapplication . C l ick No i f p ro m p ted to sa ve y o ur cha n g es . 20

  • 7/27/2019 20 cap libro

    14/36

    55 0 vction 8: A 'odel ing

    B u i l d i n g a m o d e lMost models consist of several connected processes. To connect processes-that is, to definethe output of one process as the input to another-you draw connector lines between themwith the Add Connection tool.

    Exe rc ise 20bIn this exercise, you will add a second buffer process for streams. Then you will add aUnion process that overlays the stream and nest buffers to define the arca where treescannot be harvested (the "no-cut" zone). Finally, you will union the no-cut zone withthe original layer of forest stands. The output of this union will be a dataset in whichforest stands are split wherever they cross the no-cut zone-in other words, harvestableland will be geometrically separate from unharvestable land.

    1 In ArcMap, open e x2 0b .mxd f rom the C:\ESRIPress \G TK A rc G I S\Chapter2O folder.Fle [dk jeo @010514 p, sert 5&00bor jod Nyxbw HelpDp61 a h + [17 5 ,091

    LayersN.,W

    1 -1 :A*. ibu R ?

    _ B1qA582816.66 6296408 . 63 Meters

    In the map you see the nests, streams, and stands of lease F.2 C l ick the Show/Hide ArcT oolbox W indow but ton to open ArcT oolbox.

    In the last exercise, you dragged the Harvest Models toolbox from ArcCatalog toArcToolbox. You can also add roolboxes from within ArcMap.

  • 7/27/2019 20 cap libro

    15/36

    Cr eating n aoc! 551

    3 In the A r c T o o l b o x window, right-click a bla nk area a nd click Add Toolbox. In the AddToolbox d ia log box, navigate to \GTKArcGIS \Chapter20\MyToolboxes . Click Harves tMode i s and c l ick Open.

    4 In A rcT oolbo x, c l ick the plus sign nex t to Harves t Models to ex pand i t. Right-c lickHarvest Prof i tab i l ity and c l ick Edi t to open the m odel . Move the Mod elBui lder w indowso that i t doesn' t over lap the ArcMa p tab le of contents or the A rcToolbox window.5 In A rcT oolbo x, c l ick the plus s ign nex t to A na lysis tools, then c l ick the plus s ign nex tto Proxim ity. C l ick the Buffer tool , then drag and drop i t a t the top center of theModelBui lder window, as shown in the fol lowing g raphic.

    Baveat Pmfi bdIM o d a l Edit View Wn Help

    J

    Don't worry about its exact position. In a few steps, you will have ModelBuilder tidy up.6 In the ArcMap table of contents, click the StreamsF ayer. Drag and drop it directly on

    top of the Buffer (2) tool.

    Buffer (2) FeatureOutput

    Model Ede Vvew Wi,dow i*la ffi j 6 I + :: J C27 Rt 1 J

    eamsF }--.

    NestsF )--.

    Buffer (2)

    Buffer

    OutputFeature

  • 7/27/2019 20 cap libro

    16/36

    552 Seetion 8: Modeling

    When you drop the layer, the input data is automatically connected to the tool. Beforethe model is ready to run, however, you need to change the tool's settings.

    7 Double-click the Buffer (2) tool.8 C l ick the Browse b ut ton nex t to the Output Fea ture C lass box . In the Output Fea tureClass d ia log box, navigate to \GTKArcGIS \Chapter2O\MyData and doub le-c l ickM y T o n g a s s .mdb . In the Nam e box , type StreamBuf , then cl ick Save.

    You may recall from chapter 12 that logging is prohibited within 50 meters of streams,and within 100 meters of streams where salmon spawn. The StreamsF layer attributeCable has a field called Distance, which contains values of either 50 or 100 for cachstream feature. You want the buffer size for each stream feature to be determined by thevalues in this field.

    9 For the buffer distance, click the Field option. Click the Field drop-down arrow andclick Distance. Make sure that your dialog box matches the following graphic, thenclick OK.

    1 0

    I n p u t F e a t u r e s4reau sF 51

    O u t p u t F ea t u r e C l a s sC: ESRIPress \GTKArcGIS\Chapter2O\MyData)MyTcngass mdb'15treamBuf [GikD i s t a n t e [ v a l u e o r f i e ld ]

    Linear unir

    --Feldd^Side T e o ional

    E _ n d T y p e o T o n a lDissolve T ype o t i o n a lNONE

    Dissolve F ie ld ( s ) < o n o n a l )OK Cance Appy ShowHep

    Your model now has two processes and will soon have more. Aligning elements tokeep the model looking neat could be a very time-consuming business. Fortunately,ModelBuilder has an Auto Layout button that takes care of this for you.In ModelBuilder, click the Auto Layout button, then click the Fui Extent button.

    11

  • 7/27/2019 20 cap libro

    17/36

    Creating rnodels 553

    The processes are moved and aligned.Harvet Pldaah RYMorid Edd View WIMow Heip

    Before adding a third process , you will zoom out and pan the model.11 Click the Fixed Zoom Out button once, then click the Pan tool.j+ 11 r12 M ove the two processes to the left s ide of the Mod eIBuilder window , as s hown in the

    fol lowing graphic.Haiv.d P,aliabib _M xM o d e l E d i t V e w Wndow Hdp!J Ras J::E3:::: an"2 RNJ

    Bu f

    NestBuf and StreamBuf together define the arca in which trees cannot be harvested. Tomake a single no-cut zone, you will add a Union process to overlay these two buffer layers.

    20

  • 7/27/2019 20 cap libro

    18/36

    55 4 ^ e c t io n 8 : Afode1in

    13 In the ArcT oolbox w indow, c l ick the plus s ig n next to Over lay ( in the An alys is T oolstoolbox). C l ick the Union tool. Drag an d dr op i t on the r ight s ide of the mo del, betweenNestBuf and S tream Buf, as s hown in the fo llowing gra phic.SNavest RdilaiitsM o d & Ed,t V- wmd.. HeipJJ x 9 + Q F9 ^ J1-1

    J

    PBWi , (2)

    N-18u1

    1

    Don't worry that the outpur dataset is only partly visible. You'll fix this later with theAuto Layout tool.The Union tool is not ,yet colored in because it has no input data. To define the twobuffer datasets as the inputs, you will add connector lines. (Previously, you droppedinput data directly en the buffer tools and ModelBuilder made the connections for you.)

    14 Cl ick the Ad d C onnect ion teol .

    115 In the ModelBuilder window, click the Breen NestBuf oval, then click the Union tool.

  • 7/27/2019 20 cap libro

    19/36

    Creatinc m odela. 555

    + 'N e r v e P N k pM o d e& E d i l V iew Window HMP

    _ex611j ' l lJCu"t aRJ

    WJ

    J-A cyan connector line points from NestBuf to Union, and the process is technicallyready to run. A Union overlay on a single dataset would be pointless, however, since theoutput would be identical to the input.

    16 Click the green StreamBuf oval, then click the Union tool to add a second connector fine.Morid Edil Vi- Wndow Hdpi i Y.Ible .+, :: a . -l: Qe R ^ 1

    B u;

    o>- JIhe new connector line is c y a n , and the one you added before turns black. Now youwill arrange the model and zoom out to see all its elements.

    U n i o n

    U n i o n

  • 7/27/2019 20 cap libro

    20/36

    556 Sect ion 8: Modeling

    17 Click the A uto Layout b utton, then cl ick the Fui Extent button.21 al xj%jlm C2si%a R.,3 /jIIYou see the entire model, although you may not be able to read the labels. Enlarge

    the ModelBuilder window if you like, and again click the Auto Layout and FullExtent buttons.!-~P~

    J l1

    M o d e l Edt V- Window Help

    JJ1119 + ::o:::: ateta R Y ^ J

    J

    1 8 D o u b l e -cl ick the Union tool.

    _ u x

    >s

    In the Union dialog box, NestBuf and StreamBuf are the input features (as youspecified). You will change the name of the output feature class.

    19 Cl ick the Browse b ut ton next to the Output Feature C lass box . In the Output FeatureClass d ia log box, navigate, i f necessary , to \GTKArcGIS \Chapter20 \MyData and doub le-c li ck M y Tonga s s .md b. In the Nam e box, type NoCutArea . Click Save.I r , o F e a t u r e sr -

    4 N es t B u fA St reamBUl

    j < jO u t p u t P e a t u r e C l a s sC : ^ E S R IP re s sl GT t ^ A r c G I S ^ C h a p[ e r20 ^MyDa t a ^M yTo n g a s s, mdb\ N o C u t A re t

    loi.AttrNxesunalAL L

    Of

    L a ;

    X

    GW

    1 - 1 - r iCancel Apply Show Hele

  • 7/27/2019 20 cap libro

    21/36

    Creating modela 557

    20 C l ick OK to c lose the tool .The NoCutArea layer marks the territory that is off-limits to tree harvesting. But theNoCutArea polygons are simply zones drawn around nest and stream features-theydon't tell you which forest stands can or cannot be harvested. To find out, you mustoverlay the no-cut arca with a layer of forest stands for Lease F.This overlay will split forest stand polygons wherever they cross NoCutArea polygons.In the output dataset, every polygon will lie either completely inside the no-cut arca orcompletely outside it. (Stands that do not cross the no-cut arca don't have to be split.)

    After the overlay, you will have a layer of forest stands in which every polygon has anattribute that identifies it as harvestable or not. You will then go on to recalculate thevalues of the harvestable stands in the next exercise.

    21 In the ArcToolb ox window , c lick the Union tool. Drag a nd d rop i t underne ath theexist ing Union tool , as s hown in the fo l lowing gra phic.;. Hatyest Pro~ ,d ty - u xMiel Eda V ew Vedo. Help

    L(-

  • 7/27/2019 20 cap libro

    22/36

    558 t ieert ion 8 : Modlfelirrg

    22 In the ArcM ap tab le of contents, cl ick the Stands F ayer. Drag a nd d rop it on top of theUnion (2) tool.Modd Ed+ View Wm4 HelpJ @I x e 1: ::I I l lb I f k j. -j J

    < I If

    ModelBuilder connects the process automatically. Like the previous Union process, thisone is now ready to run even though it has only a single input. To complete the overlay,you will connect the NoCutArea oval to the Union (2) tool.

    2 3 M a k e s u r e the Add C onnect ion tool is st i ll act ive. (The curs or looks l ike a m ag ic wandwhen you m ove i t over the ModelBui lder window.) Cl ick the Breen NoC utArea oval , thencl ick the Union (2) tool to add a conn ector f ine.M a d e l Edd Vbw Wndow Heq

    4 1

    NoCutArea

    U n i o n ( 2 )

  • 7/27/2019 20 cap libro

    23/36

    Creating fru,del 55924 On the ModelBuilder toolbar, click Auto Layout, then click Full Extent.

    "Ihe model is rearranged.

    25 Doub le-c l ick the Union (2) tool .26 In the Union (2) d ia log box , c lick the Browse but ton next to the Output Feature Clas sbox . In the Output Feature C lass d ia log box , navigate, i f necessa ry, to \GTKArcGIS\Chapter20 \MyData and doub le- c li ck M y Tonga s s . mdb . In t h e N am e box , typeNoCutAndStands , then cl ick Save.

    L kI n p u t F e a t u r e sr

    Featuresd b 5 t a n d s Fn N o C u t A r e a

    141O u t p u t F e a t u r e C l a s s

    ER a nk s

    J ^ J

    21

    1 O\ESRIPresstGTKArcGIS\Chapter2o\MyData^MyTongass,mdb\NoCutAnd` QJoinAttributes TonalAL L

    OK Cance Appy Sho w He lp 7>

    20

    27 C l ick OK to c lose the tool .

    560 Section 8: Mode ling

  • 7/27/2019 20 cap libro

    24/36

    28 In the m odel, r ight-cl ick the Breen NoCutAnd Stands oval (the element farthest to theright in the mod el) and cl ick Add To Display.The model now has four processes-two buffers and two overlays-and is ready to run.The nest buffer process, which tan in the last exercise, will not run again. (It still hasdrop shadows under the tool and output data elements.)

    29 C l ick the Run but ton to run the mod el .611 & 1 :: arRry a J-1 d tw Look vl+wfm^ 7ep71 : ^k ib O )- R?dGa^

    le NeusF

    a s t , e , ^ s F

    ri ^+, ..235,322

    a r c i o o l b o xa e i y s i s o o sE 4 , a s t

    p :nt,nectp so-d k, ,A x +o

    6J1 si JI^^i i -1Ir:i "I a ' i i!^

    In the ModelBuilder window, all processes are drop-shadowed. In ArcMap, theNoCutAndStands layer is added to the map.

  • 7/27/2019 20 cap libro

    25/36

    Crearing m odels 561

    31 On the Mod elBuilder toolba r, cl ick the Save b utton.al Si X ia +, :: E TR :y CQ i ^ !.2 R ,3 /f

    3 2 C l o s e t h e m o d e l .3 3 C l o s e t he ArcToolbox window.

    Your edits to the model are saved to the model's toolbox file when you click the Savebutton in ModelBuilder. You don' t need to save changes to the ma p document.

    34 I f you are cont inuing w ith the next ex erc ise, leave ArcM ap open. Otherwise, ex i t theappl icat ion. Cl ick No i f prompted to sa ve your changes .

    20

    562 t i , e t i o r r 8: MLlodeling

  • 7/27/2019 20 cap libro

    26/36

    E n h a n c i n g a m o d e lSo far, your model has made use of two analysis tools, Buffer and Union. ModelBuilderlets you use many other kinds of tools as well. The Data Management toolbox contains theMake Feature Layer tool, which creates an ArcMap selection layer from a query, and cheCalculate Field tool, which uses a logical or mathematical expression to change record valuesfor a field in a table.

    Exerc ise 20cIn this exercise, you will complete the Harvest P rofitability model. First, you will usethe Make New Layer tool to query for harvestable stands and to create a selection layerfrom them.You may recall from chapter 12 that when two layers are overlaid, the output Layer hasthe attributes of both input layers, including their FID fields. If an output feature spa-tially corresponds to an input feature from Layer X, it gets that feature's identifier in itsFID_Layer X field. Otherwise, it gets the value -1 in this field instead.'Ihe last output from your model was the NoCutAndStands Layer. Ir has FID attributesfrom che two layers it unioned: NoCutArea and StandsF. The important attribute foryour analysis is FID_NoCutArea. If a NoCurAndStands polvgon has the value -1 inthis field, it means that the polvgon does not spatially correspond to a feature fromNoCutArea; in other words, the polygon is harvestable. This is the vital piece ofinformation you need to construct your query.

    233 - NoCutAndStands polygons withFID_NoCutArea > D are inside the- no-cut area a nd cannot be harvested.

    233a 4 NoC u tAndStands po lygons w i th

    FID NoCutArea = -1 ar e outside theno-cut area and can be harvested.

  • 7/27/2019 20 cap libro

    27/36

    Creatin ,Z rmuit 5 6 3After selecting harvestable stands, you will use the Calculare Field tool to recalculatetheir values. Many of these stands are new polygons that were split during the union ofthe StandsF and NoCutArea layers in the last exercise. These new polygons have correctarea values, because ArcMap updated rheir Shape_Area attribute automatically. Theyhave incorrect StandValue attributes, however. StandValue is calculated by multiplyingShape_Area and ValuePerMeter, but ArcMap does not update calculated fields on its own.

    1 In ArcMap, open e x2 0c .mxd f rom the C:\ESRIPress \GTKArcGIS \Chapter2O folder.[# g k V. 5o* . [r t $abUpn Ioak w-ndow Hep

    a0. b 1]u - A - oA,.

    1 J WJ- -7 B, u 2- N - .--

    In the map you see the nests, streams, and stands of lease F.Once again , you will add the Harvest M odeis toolbox to A rcToolbox.

    2 C l ick the Show/Hide A rcTo olbox W indow but ton. In ArcT oolbox , r ight-c lick a b la nka rea and c l ick Add Too lbox. In the Add Too lbox d ia log b ox, nav iga te to \GTKArcGIS\Chapter20\MyToolboxes . Click Harvest Models and c l ick Open.3 In A rcT oolbo x, c l ick the plus s ign nex t to Harves t Models to ex pand i t. Right-c lick theHarvest Prof i tab i l ity m odel a nd c l ick Edi t .

    K k -

    564 Secrion 8: Modeling

  • 7/27/2019 20 cap libro

    28/36

    The model looks as it did at the end of the previous exercise,' f H a r ve t P r e Rt a bMode l Edd Vew Wrdow Help

    4 Posi tion the mod el so tha t i t doesn ' t over lap A rcToolbox or the ArcM ap tab le of contents .You'l1 start by adding the Make Feature Layer tool.

    5 In A rcToolb ox, c l ick the plus s ign nex t to the Da ta Mana gem ent Too ls too lbox. C l ickthe plus s ign nex t to the Layers and Ta b le Views tools. Cl ick the Make Feature Layertoo l , then d rag and d rop i t to the upper r ight corner o f the m odel , as s hown in thefo l lowing graphic.

    D~:: Featree CIasS

    ib Feat,,eSFcdS

    4h Fe reoddtailaSCGeneralG eabaat wn,: h w-,

    7 mksi '. Layers and TaNe Vews

    P Appky S er ,o6gy Frajl Maya Pesare Leve.

    Malea Image 5 e e v e e LxMake Q u e r y T a e

    j0% Make Rastee Catalog% Make Restar Layen%y Make Table Rete

    Make WC5 LayarMake RY Event Layen

    % 5ave To Layen FileA Soect Layen By Attrbj 5ek:ct Layen "Y,- t,P o e,de, s and T to

    Faw,es IndeH Seach RevJl:

    M o d e l Edk View Wndow Help

    1 -,-

    Creuting modo 565

  • 7/27/2019 20 cap libro

    29/36

    6 On the ModelBuilder toolbar, click the Add Connection tool.611 da l XIEble j+,1 (Ill j

    7 Cl ick the NoC utAnd Stands green ova l , then c l ick the Make Feature Layer tool toconnect them .?'Hv.*t P sMibiMbM o o d ^ d ^

    g E d i lJ_

    W n d o w H c l p51 +-

    M a k e F e a t u re L a y e r

    N o C u t A n d S t a n d s

    8 Click the Auto Layout button, then click the Full Extent button.I G O 8 .+ : : E a.:: Q r l l k 1 , 3 1 /1

    1The model is rearranged.

    M o d a l E d a V r e w Wmdow Hete

    _f Q F"7 t u k IO1 J

    566 ^eetiort 8 : hfnclelt;

  • 7/27/2019 20 cap libro

    30/36

    9 Double-click the Make Feature Layer tool. (It is now the yellow rectangle farthest tothe r ight.)

    M a k e F e a t u r e La y e rI n p u t F e a t u r e sNoCutAnd5tandsOut La erN o C u t k nd" r a nd s _L ay er

    Expression ( o p t i o n a l )

    W o r k s p a c e o r F e a t u r e D a t a s e t (opt iona l )

    Field Info o ional)FieldName NewFieldName V... Use Ra..,FIO StandsF FID_Star,dsF vLeaselD LeaselDStandValue StandValueV a l u e P e r M e t e i V a l u e P e r M e t e rStandDStandDvFID_NoCutArea FID NoCulArea v 'in NPCrRni Fin NP

  • 7/27/2019 20 cap libro

    31/36

    13 Make sure that your expression matches the following graphic, then click OK.

    GelUrrweValues U T. 1

    ( F l D _ N o c d A r e e ] - . 1

    1^ I Variy Hele Load.. Save...UKCance

    14 Cl ick OK on the Make Feature Layer d ia log b ox.Next, you will recalculate the stand value of the harvestable stands. Some of thesestands (the ones that weren't split during the last overlay) still have correct stand values,but many do not.

    15 In the ArcToolbox window, underneath Data Management Tools, click the plus signnext to Fields. Click the Calculate Field tool. Drag and drop the tool in the upper rightcorner of the model, as shown in the following graphic.M cT OOhox

    . Analysis TodsCartograp,y TodsC o m e , : e > < , T o o l"d Management Todslb Date Compansm

    DdeaseDamosFeatae CiassFeatuesF i N d sA A d d % M

    % s A s s i g , D e fa u k T o F i e b. n C e l c u l e te E n d D a t e

    ,b Ddete FbeldT,anspone T FmldsG e o d a t e h a s ee

    GeneralGanera4zatunb Indexes

    ]anLLayers and T e m e Yerxs !1FavaAe: Ir , d m r Sem^ Resuts

    +Hmvest PIO ahiitpM o d a l Edil View W o He4,

    4 1

    _ u x

    t20

    N568

  • 7/27/2019 20 cap libro

    32/36

    1 6 M a k e s u r e the Ad d C onnect ion tool is s t i ll ac t ive. Cl ick the Breen Harves t Stands oval ,then c l ick the Ca lcula te Field tool to add a conne ctor f ine b etween them .Model Edd Vi- Wmdow Helo

    i Calculate Field

    H a r v e s t S t a n d s

    17 Cl ick the A uto Layou t but ton, then c l ick the Ful l Extent but ton."Ihe Calculate Field tool is not ready to run because the tool does not yet have anexpression. You will add that next.

    M o r i d E d ; t V i e w W dow Hebp e+l (III ORIUk1,91 >

  • 7/27/2019 20 cap libro

    33/36

    Creat ing mod ls 569

    18 Doub le-c l ick the C alculate Fie ld tool ( the white rectangle) to open the C alculate Fie lddia log box.

    X^Input TableHarvest Stands Lj i FIeld Neme

    9 E x p r es s i o n{

    E res~ , TV B

    Code Block 0 tonal

    lJCancel Apply Show Help

    The input table is set to Harvest Stands. (This is the connection you just drew y ourself .)19 Click the Field Name drop - down arrow and click StandValue.20 N ext to the Expres s ion box, cl ick the Calculator button to open the F ie ld Calculator.21 In the Fields scrol l ing box, doub le-c l ick Shape_ A rea to add i t to the expressionbox . C l ick the m ul t ipl icat ion (* ) but ton. In the Fields s crol l ing b ox, doub le-c l ick

    ValuePerMeter.

    LeaseIDStandValuevduepeMeter5tandlDFID NoCutAreeFD NestBufFID 5treeeBUfDistanHasSpawrngBUF F D I S Tn h a pe te n g t h5hape Area

    RandVa4e

    TY pe : FweUe eAbs ( )N-b., A tn5ncas ( )e=p( )Dae Fi, ( )nt( )ag()

    51n( )Su(1

    20

    This expression will give you the updated stand values in dollars. In the table, however,the stand values are expressed in millions of dollars.

    570 'retiona 8: A 'lodeling

  • 7/27/2019 20 cap libro

    34/36

    22 C l ick a t the beg inn ing of the express ion a nd type an o pen pa renthes is " ( " fo l lowedby a s pace. Cl ick at the end of the expression and type a s pace fo l lowed by a c las eparenthesis ")". Click the division (/) button, then type a space and type 1000000.Ma ke sure your ex pression m atches the one in the fo l lowing graphic, then c l ick OK onthe Field C a lcula tor .

    5 t a n d V a l u e=r Advanced( [5hape_A r e a ] * [ V a l u e P e r M e t e r ] ) 1000000

    1

    The Calculase Ficid dialog box is updated with the expression.

    1 H a r v e s t S t a n d sField Name5tandValue

    E x p r e s s i o ^ n1 ([5hape _ Area ]* [ ValuePerMeter ]1000000Exp re ssi_gn T^pe_(ptinal)

    FCode Block (opt ional )

    C a n c e l

    23 C l ick OK to c lase the tool ,

    IJApply ShowHelp

    Now that che expression has been entered, the process is colored in. You are ready torun the model. (Again, only processes that haven't run before will run.)

    24 C l ick the Run but ton to run the mod el .6 1 1 1 5 1 X1101 + , 1 H I E D I - -1 - - - ' (IIIn141119 kjfff f l j >j1

    Creatin rnorr 1 571

  • 7/27/2019 20 cap libro

    35/36

    25 When the m odel is f in ished running, c lose the progres s report.You w ill add the H arvest Stands (2) layer to ArcMap and check the results of your calculation.

    26 In the model, right-click the Breen Harvest Stands (2) oval and click Add To Display.

    H a r v e s t S t a n d s ( 2 )

    Although Harvest Stands and Harvest Stands ( 2) are separate elements in the model,they represent the same selection layer. 'Ihis layer is added to ArcMap.

    27 In the ArcMap table of contents, right-click the Harvest Stands ayer and click OpenAttribute Table. Right-click the StandValue field name and click Statistics.

    SIMUtcs:M, 372M ni m u m 0. 013 003Ma r a m w n 1 1 1 1 1 36Mean: 2828164St andmd DeMabon 2 0 1 8345.Ud

    The sum of the recalculated values is 1,052.07698. Since the values are in millions, thisis slightly over a billion dollars.Note: You may have noticed ModelBuilder has given a slightly different sum than whenyou performed each step separately in chapter 12. This is due to rounding techniques,and che effect is negligible.

    5 72 Section 8: Modeling

  • 7/27/2019 20 cap libro

    36/36

    28 Clase the statistics window. Clase the Attr ibutes of H arvest Stands table.2 9 O n t he ModelBuilder toolbar, click the Save button to save the model.

    f i30 Cl ick the Model menu and c l ick Close. In ArcMap, c lose the ArcToolbox window.31 Cl ick the Fi le menu a nd c l ick Exit . C l ick No when prom pted to save your change s.

    The model that you have created in this chapter is really just a part of a completeHarvest Profitability model. The model could be expanded to include che data prepa-r a t io n o p e r a t io n s , l ik e D i s s o lv e a n d C l ip , th a t y o u u s e d i n c h a p t e r 1 1 . A n o t h e r p i e c ecould analyze the costs of harvesting: crews have to be brought in to cut down the trees,load them on trucks, and remove them from the forest. Some of the analysis rnight begeospatial and some might be purely computational-you have seen that ModelBuildercan do both.

    11

    At the end of this exercise , you got the total harvestable stand vahee the old-fashionedway: by opening the tab le, right-clicking the field , and opening the Statistics window.With a little programming knowledge , you could w rite a script to do this using the Py thonprogramming language that comes with ArcGIS. (Scripts can be addcd to a model astools. ) When the model tan, the script would access the table, sum the stand values, andreport the total in a pop-up window. Your mod el would then be fully automated.As mentioned in the chapter introduction , ModelBuilder makes it easy to repeat ananalysis on different project data. In this chapter, you calculated the harvest value forlease F, hut you might be asked to do the same for another lease. The Data folder forchapter 20 contains a geodatabase called LeaseB . mdb with feature classes for the stands,nesis, and streams of lease B. On your own, you might want to try adapting the HarvestProfitability model to work with this data.If you decide to do that, you have a little more modeling ahead of you. If not, yourwork is done. You have come to the end of Getting to Know ArcGIS Desktop.