. MXD=mapping. The MapDocument (" current ") 2
. Df=mapping ListDataFrames (MXD, "Crime") 3
. Reflayer=mapping. ListLayers (MXD, "Bu *," df) 4
. Insertlayer=mapping Layer (r 'C: \ ArcpyBook \ data \ CityOfSanAntonio GDB \ Crimes2009') 5
. Mapping. InsertLayer (MXD InsertLayer, df, "AFTER") 6
This is my "Python programming based on ArcGIS techniques (second edition)" see instances of "2.9 insert layer to the map document"
Two problems
The first three or four lines of zhongyuan instance:
Df=mapping ListDataFrames (MXD, "Crime") [0]
RefLayer=mapping. ListLayers (MXD, Burglaries "*", df) [0]
Why do you want to add list [0]
The second problem
I run an error in arcgis python
the Runtime error
Traceback (the most recent call last) :
The File "& lt; string>" , line 4, the in & lt; module>
The File "c: \ program files \ arcgis (x86) \ desktop10.2 \ arcpy \ arcpy \ utils py", line 181, in fn_
Return fn (* args, * * kw)
The File "c: \ program files \ arcgis (x86) \ desktop10.2 \ arcpy \ arcpy \ mapping py", line 1500, in ListLayers
Result=mixins. MapDocumentMixin (map_document_or_layer). ListLayers (wildcard, data_frame)
The File "c: \ program files \ arcgis (x86) \ desktop10.2 \ arcpy \ arcpy \ arcobjects \ mixins py", line 820, in listLayers
Raise TypeError (STR (type (dataframe)))
TypeError: & lt; The type 'list' & gt;
Begged god to help me disambiguation, I QQ319131785 sprouting new a beginner Python hope you don't laugh at me
CodePudding user response:
Bosses? I'm looking forward to you contact me give me,,,,