Desktop10.x,andarelookingtoupgradeyourskillstomakethemovetoArcGISPro,manyofthe
chaptersinthisbookwillcovermaterialyoualreadyknow.Youmaywanttofocusonchaptersthat
covermaterialsthathavechangedthemostrelativetothePythonScriptingforArcGISbookthatwas
writtenforArcGISDesktop10.x.Thesechaptersincludechapter2onworkingwithPythoneditors
andchapter11onmapscripting.
Severalchaptersarealsoexpandedandimprovedsubstantiallycomparedwiththepreviousbook.
Chapter4onPythonfundamentalsiscompletelyrevisedtoupdateallthesyntaxtoPython3,andnew
sectionsareaddedonworkingwithtuples,dictionaries,andsets;printformatting;Booleanlogic;
workingwithlonglinesofcode;andfilemanagement.Chapter8hasanewsectiononPython
expressionsforfieldcalculations.Chapter9isexpandedsubstantiallywithmoreexamplesonhowto
workwithgeometryobjects.Chapter10onrastershasnewsectionsontheexpandedfunctionalityof
theImageAnalystandSpatialAnalystextensions,aswellasworkingwiththeRasterCellIteratorand
usingrasterfunctions.
SeveralimportanttopicswithrespecttoPythonscriptingforArcGISProarenotincludedinthisbook
soastomaintainamanageablelength.ThesetopicsarecoveredinthebookAdvancedPythonScripting
forArcGISPro(EsriPress,2020).TopicsincludecreatingscripttoolsandPythontoolboxes;sharing
toolswithothers;managingpackagesusingconda;usingthird-partypackagesotherthanArcPy;
migratingscriptsandtoolsfromArcGISDesktop10.xtoArcGISPro;andusingtheArcGISAPIfor
PythonandJupyterNotebook.Thesetopicsfollowlogicallyonthetopicscoveredinthecurrentbook.
Therefore,ifyouhavemasteredallthetopicsinPythonScriptingforArcGISPro,thenextlogicalstepis
tocontinuewithAdvancedPythonScriptingforArcGISPro.
1.7ExploringhowPythonisused
ThissectionusesseveralexamplestoillustratehowPythonisusedtocreatescriptsforusewithArcGIS
Pro.Theseexamplesresemblethescriptsusedinlaterchaptersinthisbook.Oneofthereasonsfor
presentingtheseexamplesisforyoutobecomefamiliarwithlookingatPythoncode.Oneofthebest
waystolearnhowtowritecodeistoworkwithexistingexamples.Youarenotexpectedtofully
understandthecodeatthispoint,buttheexampleswillgiveyouaflavorofwhatistocome.
Example1:Copyingshapefilestoageodatabase
AcommontaskinArcGISProistocopydatasetsfromoneformattoanother.Forexample,consider
thescenarioinwhichyouhaveseveralshapefilesinafolder,andyoumustcopythoseshapefilestoa
newfeaturedatasetinsideafilegeodatabase.Inaddition,youwanttocopyonlythepolygonshapefiles.
Thefigureshowsatypicalfolderwithseveralshapefiles.