11

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 ??

  • Where does it say that "Python and .NET have the same features to create add-in"? – PolyGeo Jul 29 '13 at 12:47
  • sorry, I bad express what I mean.(I update post) – user7172 Jul 29 '13 at 12:57
  • 1
    implement a COM interface, or plug into ESRI’s many COM extensibility points using Python That is strange. Python can work fine with COM. – Nathan W Jul 29 '13 at 13:19
  • Indeed, I have created (trivial) Python add-ins which use ArcObjects through comtypes. However I have not tried implementing COM interfaces in Python. I'm not sure if that is possible or how difficult it would be compared to with .NET. Also neither type of add-in allows for automatic registration with COM so some of the more advanced stuff is better served with a traditional COM component that can be registered by its installer or (ESRI)RegAsm. – blah238 Jul 29 '13 at 14:38
  • 1
    This isn't ArcGIS but this is how I made a implemented a COM interface using Python for MapInfo nathanw.net/2011/04/07/using-python-and-mapinfo-with-callbacks I would say it's easier then .NET :) – Nathan W Jul 29 '13 at 22:51
24
+25

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.

1

You're looking at the desktop environment so .NET is certainly an option. However, you'll be limited on what you can do with .NET now that much of the ArcGIS Server is available to run on multiple platforms.

My two cents: If you're doing deep UI work I'd suggest .NET as you can whip a UI up pretty easily. If you are really just scripting and are using the deeper analysis parts of ArcGIS Python will allow you to move to Server (or the "cloud") much, much easier.

1

One of the disadvantages of developing Add-Ins in .NET is that each new version of ArcGIS uses a different incompatible version of ArcObjects and a different incompatible version of Visual Studio. The binaries generated by the .NET Add-Ins generally ARE compatible with later versions of ArcGIS, but only if you don't want to make any changes to your Add-In in a version of ArcGIS later than the one in which it was originally developed.

I developed a .NET Add-In for loading Census Bureau TIGER/Line Data layers to a map in ArcGIS 10.0, and the binary Add-In still works in ArcGIS 10.4. Unfortunately, when I wanted to make modifications to the Add-In, I tried bringing the solution into the version of Visual Studio compatible with ArcGIS 10.4, and I was flooded with a huge number of error messages due to incompatible calls to ArcObjects and features of Visual Studio.

Developing Add-Ins in Python involves using ArcPy instead of ArcObjects, so the documentation is more accessible and the process of revising the code for a new version of ArcGIS should be much easier.

The major disadvantage of using Python instead of .NET is that building a GUI interface in Python is much more difficult. Packages such as wxPython can be used, but there are a lot of difficulties in making them work in ArcGIS. The Toolbox user interface is much more limited than the dialog boxes that can be built in .NET.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.