I found in ESRI .NET help:
Python
All ArcGIS Desktop applications include an embedded scripting language called Python. Many areas of ArcGIS—particularly geoprocessing—are accessible through simplified Python application programming interfaces (APIs), making it easy to author and automate common tasks. Python scripts are easily shared and can be produced without an external development environment. There are a variety of public domain Python modules focused on areas such as science, engineering, and mathematics. With all its strengths, Python is not suited for every programming task. Although coverage is improving, not all areas of ArcGIS are currently exposed to Python. In addition, the editing and debugging experience in Python is not as sophisticated or easy to use as those included with commercial development environments such as Visual Studio. Lastly, you cannot listen for and respond to ArcGIS events, implement a COM interface, or plug into ESRI’s many COM extensibility points using Python.
and in ArcGIS Desktop help:
ArcGIS 10.1 introduces Python to the list of languages for authoring Desktop add-ins, providing you with an easy solution to extend desktop functionality. To simplify the development of Python add-ins, you must download and use the Python Add-In Wizard to declare the type of customization. The wizard will generate all the required files necessary for the add-in to work.
If Python and .NET add-ins have the same functionality? Does that mean that I can do the same thing in Python as .NET ??
Answer
The answer to this question is yes and no. It is possible with some effort to do everything in Python that you could do in .Net, but easy and possible are two very different things. Following that, the simplest interpretation is no, Python Add-Ins cannot do as much as .Net Add-Ins. However, the tasks Python Add-Ins can accomplish are much easier and faster to implement and test.
From a purely technical point of view, the ArcGIS Desktop Add-In Framework offers the following functionality:
- A well-defined, XML-based schema for describing a series of common desktop integration points and components: Buttons, Toolbars, Menus, Tools, Multi-Item Menus and Extensions, as well as a way to easily connect these in a declarative way from your code to ArcGIS desktop
- A file format and file structure (
.esriaddin
) for distributing desktop customization code. - A mechanism for installing, verifying and caching installed
.esriaddins
, so if the injstalled Add-In's source file has changed, it will reload the changed file into the local desktop Add-In cache. - A set of security and authentication mechanisms for the code in Add-Ins: digital signing of
.esriaddin
files, administrative control over what level of authentication is required to permit installation of an Add-In.
What the Add-In framework here lacks is any formal contract of the behavior or functionality behind buttons, etc. When you install the .Net SDK for ArcGIS, you get Visual Studio integration in the form of Add-In Wizards in your project management dialogs, documentation, code snippets, ArcObjects bindings, etc. So once you're past the entry points the Add-In framework provides, a .Net Add-In lets you go the rest of the way with the ArcObjects APIs it also comes bundled with, as well as containing a library of code snippets of common tasks already there to use. There is no such Python Developer SDK in ArcGIS: all of Python's functionality with exposed through arcgisscripting/arcpy and is already bundled in the product. So, where the .Net SDK comes as a large download, the closest thing in Python is the relatively small Add-In Wizard download.
On the other hand, Python is capable of consuming/implementing COM interfaces, but using COM from Python is not bundled with any ArcGIS SDK or documented in the ArcGIS help system. If you're new to developing in ArcGIS, this should be enough of a barrier to entry to push you away unless you really know what you're doing. You can do COM in Python here, but it's close enough to a Turing Tarpit that it's be hard to justify the time spent unless you're an expert-level user already familiar with the ins and outs of COM and ArcObjects.
I'd recommend you look at what you can do with arcpy. You can automate a lot of tasks such as calling Geoprocessing tools and doing batch manipulation of map documents, and Python Add-Ins let you use certain well-defined event sinks and some dialog controls in addition to arcpy's base capabilities. If you can't think of a way to accomplish your task in Python based on what the documentation says (you need some complex user interface interaction or hook into events not exposed in the Python Add-In Wizard or use something only available in ArcObjects), then do your development in a .Net Add-In.
Sorry this is more nuanced than a hard-and-fast yes or no answer, but it should give you some bearing as to whether you should go the Python or the .Net route in your Add-In.
I suppose I should add this disclosure: I designed and developed much of the Python specific functionality to Add-Ins in ArcGIS.
No comments:
Post a Comment