Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Using ArcGIS for Desktop 10.1 SP1, I just created a map package (.mpk) from a map (.mxd) which had a Python Add-In (.esriaddin) installed.

When I unpacked the .mpk the .esriaddin was neither installed nor present in the folder that was created in C:\Users\Graeme\Documents\ArcGIS\Packages.

Intuitively, I would expect it to be at least present in the package, so am wondering if it that capability has been omitted by accident or design?

share|improve this question
    
I've never tried it, but, assuming your python would work as a gp script, did you consider creating a gpk and choosing the option to Include Enterprise Geodatabase data instead of referencing the data? –  Kirk Kuykendall Jul 2 '13 at 1:48
    
In this case the Python needs to be an .esriaddin rather than a .gpk because I want it to install a toolbar related to what I call a Desktop Story Map and the raster data is a standalone file because a dependency would make it a very expensive solution for a hobby project. –  PolyGeo Jul 2 '13 at 3:42
    
It might be better to keep them separate and just provide a way for the user to configure the path to the data from the add-in. –  blah238 Jul 3 '13 at 6:19
    
If the add-in is an Additional File to the *.mpk then when unpacked it seems able to find the data with no configuration. –  PolyGeo Jul 3 '13 at 10:35
    
@blah238: Is there any example of data path configuration available online or can you provide a small sample? It would be very useful as I am interested in it and have no experience with config. –  Ibe Jul 3 '13 at 19:12
show 1 more comment

2 Answers

up vote 5 down vote accepted

No, you shouldn't expect Add-ins to be included in a Map Package. Here's the description from the documentation:

A map package contains a map document (.mxd) and the data referenced by the layers it contains, packaged into one convenient, portable file.

Python Add-ins, however, are not part of the map itself, but instead extensions to the ArcMap environment which add customizations. You may have multiple add-ins and extensions installed, and broadly speaking rendering a map isn't dependent on the extensions or add-ins currently installed into the map environment.

You can, however do the inverse if you want a map document to be distributed with your Add-in: anything included within the Install directory of the Python Add-in will be extracted onto the users system. You could potentially reference an .mpk file you'd included, so that users who had your add-in would automatically get a map document and its related data.

share|improve this answer
    
I've +1-ed your answer but when I added my 2Gb *.mpk (it includes a raster) into the Install subfolder in the folder with the makeaddin.py and then ran the latter the *.esriaddin was only 133Kb in size - shouldn't it have been at least 2Gb? –  PolyGeo Jul 2 '13 at 1:26
    
Have you customized your makeaddin.py file? Just after running it, you should be able to rename the .esriaddin file to .zip and inspect its contents. Are you also signing the add-in? I've had some issues around signing, and have a custom step in my build procedure to make sure the results are what I expect in the output .esriaddin file. I've uploaded the relevant test example here: gist.github.com/scw/5906271 –  scw Jul 2 '13 at 2:03
    
I've not done any signing of the add-in nor customised the makeaddin.py at this stage. I'm curious to lean more about the steps for including an MXD, GDB & TIF as part of a Python add-in. This does not seem to be a documented process so I'll do some trial and error, and if I don't figure it then I will post a new question. –  PolyGeo Jul 2 '13 at 4:38
1  
I now have a solution which works well for me. When map packaging, I choose to have my *.esriaddin included as an Additional File. That way as soon as I have unpacked the 2Gb map package, all I have to do is go to C:\Users\Graeme\Documents\ArcGIS\Packages\myPackage\commondata\userdata, double-click to install it and then turn on the toolbar. –  PolyGeo Jul 3 '13 at 2:06
    
Great! That seems like a good solution, I didn't realize that it'd take arbitrary additional files. If the map-inside-addin approach works, that'd save one step and let you reference relative paths from the add-in code, but that sounds like a great solution for what you need. –  scw Jul 3 '13 at 3:24
show 2 more comments

As an auxiliary answer to my own question I am writing up the outcome of the chat between @scw and I on the "map-inside-addin" vs "addin-inside-mpk" approaches.

"map-inside-addin"

His approach would involve me modifying the makeaddin.py to also include the *.mpk (or MXD, GDB & TIF it contains) as part of the *.esriaddin.

A double-click on the add-in, extracts the folder to a place within your settings, and it'll stay there, until you either remove the add-in or update it by installing an add-in with the same name but newer 'version'.

When the add-in is installed, its extracted results are placed into %HOMEPATH%\AppData\Local\ESRI\Desktop10.1\AssemblyCache (where %HOMEPATH% is a Windows variable that expands to the current users' home directory). In there, should be a number of directories represented by UUID, one of which should be the add-in. Note: The AssemblyCache folder is only visible if your folder options have hide "OS-protected" files/folders unchecked (which should only be done with care).

The advantage of this approach is that there is a single step install of both data and toolbar but some Python customisation of makeaddin.py is needed.

"addin-inside-mpk"

My approach requires me to choose to have my *.esriaddin included as an Additional File. That way as soon as I have unpacked the 2Gb map package, all I have to do is go to %HOMEPATH%\Documents\ArcGIS\Packages\myPackage\commondata\userdata, double-click to install it and then turn on the toolbar. In other words a three step process but with no customisation needed.

share|improve this answer
    
You may need to turn on hidden files/folders as well as "OS-protected" files/folders to be able to see the AssemblyCache folder. –  blah238 Jul 3 '13 at 5:41
    
Thanks @blah238 - it was the hide "OS-protected" files/folders that I needed to uncheck. –  PolyGeo Jul 3 '13 at 6:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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