Wechat: yu389741| Email: gisdqy@163.com

Shop:https://www.giserdqy.com/shop

Arcpy基础方法之Tools&Toolboxes


http://blog.csdn.net/gisinfo/article/details/6659794

 

1.引入自定义的工具箱

  1. c:\python 
  2.  
  3. >>>import arcpy 
  4. >>>arcpy.ImportToolbox(“c:/PCovertL.tbx”
c:\python

>>>import arcpy
>>>arcpy.ImportToolbox("c:/PCovertL.tbx")

2.List工具箱中访问工具的方法

1)列出所有工具箱,查看别名

  1. c:\python 
  2.  
  3. >>>import arcpy 
  4.  
  5. >>> toolboxList=arcpy.ListToolboxes() 
  6. >>> for toolbox in toolboxList: 
  7. …  print toolbox 
  8. … 
c:\python

>>>import arcpy

>>> toolboxList=arcpy.ListToolboxes()
>>> for toolbox in toolboxList:
...  print toolbox
...

  1. 3D Analyst Tools(3d
  2.  
  3. Analysis Tools(analysis) 
  4. Cartography Tools(cartography) 
  5. Conversion Tools(conversion) 
  6. Data Interoperability Tools(interop) 
  7. Data Management Tools(management) 
  8. Editing Tools(edit) 
  9. Geocoding Tools(geocoding) 
  10. Geostatistical Analyst Tools(ga) 
  11. Linear Referencing Tools(lr) 
  12. Multidimension Tools(md) 
  13. Network Analyst Tools(na) 
  14. Parcel Fabric Tools(fabric) 
  15. Samples(samples) 
  16. Schematics Tools(schematics) 
  17. Server Tools(server) 
  18. Spatial Analyst Tools(sa) 
  19. Spatial Statistics Tools(stats) 
  20. Tracking Analyst Tools(ta) 
  21. Coverage Tools(arc) 
  22. P_Covert_L(PTL) 
3D Analyst Tools(3d)

Analysis Tools(analysis)
Cartography Tools(cartography)
Conversion Tools(conversion)
Data Interoperability Tools(interop)
Data Management Tools(management)
Editing Tools(edit)
Geocoding Tools(geocoding)
Geostatistical Analyst Tools(ga)
Linear Referencing Tools(lr)
Multidimension Tools(md)
Network Analyst Tools(na)
Parcel Fabric Tools(fabric)
Samples(samples)
Schematics Tools(schematics)
Server Tools(server)
Spatial Analyst Tools(sa)
Spatial Statistics Tools(stats)
Tracking Analyst Tools(ta)
Coverage Tools(arc)
P_Covert_L(PTL)

(自定义工具箱,最后在工具箱建立之初建立别名

作用:方便查出import自定义工具箱的工具访问方法,arcpy.ListTools(“*_PTL”))

2)列出某类工具箱下工具的访问方法

  1. >>> arcpy.ListTools(“*_ta”
  2. [u‘ConcatenateDateAndTimeFields_ta’, u‘MakeTrackingLayer_ta’
>>> arcpy.ListTools("*_ta")
[u'ConcatenateDateAndTimeFields_ta', u'MakeTrackingLayer_ta']

3)列出所有工具箱下工具的访问方法与参数

  1. >>>toolList=arcpy.ListTools() 
  2.  
  3. >>>for tool in toolList: 
  4.  
  5. >>>  print tool 
  6.  
  7. >>>  print arcpy.Usage(tool) 
  8.  
  9. Script(加{}表示为非必填项) 
  10. Script(Input_Features, Output_Feature_Class, {Line_Field}, {Sort_Field}, {Close_Line}) 
  11.  

 

转载自:https://blog.csdn.net/sophiasy/article/details/29588423