More Related Content
Similar to Arcgis 10中的python
Similar to Arcgis 10中的python (20)
Arcgis 10中的python
- 1. Geoprocessing GIS Ð ×' Ñ Tools Modeling Python / " ü &Ó 5' /Ó /Ó 3 /" ArcGIS 10 ü / By diligentpig $UF*,6 3KRQ ' GeoVisualization Geoprocessing Ð > × 9.0 ,' ArcGIS þ 5' ü Python Ð ñ Ü Python ü ArcPy GeoData '
- 2. By diligentpig Python ArcGIS Ñ 9.2 ,' arcgisscripting module 9.3 ,' Python List ArcGIS 10 / ArcPy site-package arcgisscripting module Ñð ArcPy /" ÞÐ > % > ' / Python %# %#=# %# > ArcPy 800+ Ü/ Geoprocessing Tools , Python IDE Þ ! cursors geometry / classes % NumPy / NumPyArrayToRaster RasterToNumPyArray Ý DUFJLVVFULSWLQJ Ñ DUFS# 9.3 import arcgisscripting gp = arcgisscripting.create(9.3) array1 = gp.createobject("array") # 10.0 import arcpy array2 = arcpy.Array() Python Window
- 3. By diligentpig ArcGIS 10 Python Window ' Python Python ,' command line window Þ+ / ArcPy Þ Command ø%'" command line Python Window C & Python & ' > Python Window ArcPy Þ ü tools environments Ü/ Python 3ü ! 6 3 Python Window Þ IDE PythonWin ! ü Interactive Window > ! Python " Geoprocessing tools > Python & Python Window & Python Ð Python Window Ñ& Python IDE
- 4. By diligentpig & / Ù ÑE > ö Ý ÐÑ ArcPy Python Window ' à Ý / *HRSURFHVVLQJ WRROV >>> import arcpy >>> arcpy.env.workspace = r'C:serssrichinaesktopemo_arcgis10pythonataS A_Data.gdb' >>> arcpy.Buffer_analysis("Cities","Cities_buffer","5 Kilometer") <Result 'C:UsersesrichinaDesktopdemo_arcgis10pythondat aUSA_Data.gdbCities_buffer'> >>> E / Buffer Python Window >>> / 5 3 7LS $UF3!
- 5. By diligentpig 7LS > ArcGIS 10 Python Window & r'C:serssrichinaesktopemo_arcgis10pythonata SA_Data.gdb' Catalog FeatureClass Python Window / 7LS % " C & fcs & Python List u unicode Ý $XWRPDWLRQ
- 6. By diligentpig >>> import arcpy >>> arcpy.env.workspace = r'C:serssrichinaesktopemo_arcgis10pythonataS A_Data.gdb' >>> for feature in arcpy.SearchCursor("States","STATE_NAME = 'California'"): ... arcpy.Clip_analysis("States",feature.Shape,"California") ... >>> 'Ý / SearchCursor × States California Feature + States Clip × / California 7LS ø" ArcToolbox Clip Ó % Ð6& / Python 5' "Ù Clip % >>> fcs = arcpy.ListFeatureClasses() >>> fcs.remove("California") >>> for fc in fcs: ... arcpy.Clip_analysis(fc,"California",fc+"_clip") ... >>> Ñ' Ð for / / California FeatureClass " 7LS 3KRQ :LQGRZ / 3KRQ ü / remove ø% California D fcs & Python List 7LS %DFNJURXQG *HRSURFHVVLQJ
- 7. By diligentpig ArcGIS 10 Background Geoprocessing Geoprocessing ArcGIS Ü/ CPU Ð D &/ ArcGIS 3 ' Geoprocessing 'Ý Þ+ ArcMap Background Geoprocessing ' > + 'Ý Ü/ for ' ArcPy Modules D ' Ñø% ArcPy 3 /' Python 5' ü arcpy.mapping Mapping module .mxd .lyr /' " PDF arcpy.sa Spatial Analyst module /' / ArcGIS 10 ArcPy.Raster ë % arcpy.ga Geostatistical Analyst module /' Ô modules ' "' à ÑE× Mapping module Ý Ý / 0DSSLQJ 0RGXOH ü ã% >>> import arcpy, arcpy.mapping >>> mxd = arcpy.mapping.MapDocument("current") >>> df = arcpy.mapping.ListDataFrames(mxd)[0] >>> updatelyr = arcpy.mapping.ListLayers(mxd)[0] >>> sourcelyr = arcpy.mapping.Layer(r'C:eli.lyr') >>> arcpy.mapping.UpdateLayer(df,updatelyr,sourcelyr,True)
- 8. By diligentpig >>> / mapping module MapDocument mxd / Ü/ current C ArcMap " / ListDataFrames ø% List mxd DataFrame /Ó mxd Ð DataFrame " / Ð DataFrame updatelyr & Ð / &Ð sourcelyr â 1 3 UpdateLayer ø% lyr ã% True % ã% &" D % & ' " Ñ >>> arcpy.RefreshContents() >>> arcpy.RefreshGraphics() >>> "
- 9. By diligentpig 7LS arcpy.RefreshContents() / ' ArcMap TOC MapView " LayoutView arcpy.RefreshGraphics() /' Tip8 â / MapDocument save/saveACopy 'â mxd " ã% Ý "
- 10. By diligentpig 'Ý C:XDs % mxd Python " " Ð PDF mxd Ð 7LS 3KRQ :LQGRZ 6DYH /RDG â .py Python Window > C Load .py "" Python Window save .py + â Ü/ ArcGIS 10 Python 5' Geoprocessor ArcPy arcgisscripting % Ñ Python ü Python Module / % # 5' > Ñ Python 5' Ñ "Ù /' ArcGIS 10 ' Python