GIS的积累
It is never to late to learn

导航

 

Mark Cederholm has a presentation on accessing arcobjects from python. It requires Visual Studio (Express is ok) and the Windows SDK in addition to arcgis and python.

Recipe

  1. Download and install WinSDk and Visual Studio.
  2. Unpack Mark's package somewhere
  3. Edit DemoTool.idl if necessary (e.g. path to esriSystemUI.olb)
  4. Open the WinSDK CMD shell and run midl DemoTool.idl (creates DemoTool.tbl needed for registering COM objects)
  5. Register the com objects with python DemoTool.py -regserver

You are now ready to access arcobjects with python:

from Snippets import GetLibPath, InitStandalone 
from comtypes.client import GetModule, CreateObject 
m = GetModule(GetLibPath() + "esriGeometry.olb") 
InitStandalone() 
p = CreateObject(m.Point, interface=m.IPoint) 
p.PutCoords(2,3) 
print p.X, p.
posted on 2010-11-01 16:35  GIS的学习  阅读(202)  评论(0编辑  收藏  举报