Create Mobile Map from ArcObjects or Python

3623
21
10-06-2010 11:50 PM
AndersWallberg
New Contributor II
I would like to automate the Mobile map creation in ArcGIS 10 from ArcObjects or Python, but can not get any of them to work. As far as I can see there is't a GPTool available for Mobile Tools in ArcObjects or am I wrong?

When I did not find it possible to use ArcObjects for this I started to look at Python. I am new to Python so maybe I am doing some misstakes here. From the Python window in ArcMap I got this simple script to work after I disabled the Background Processing option i Geoprocessing options:
##################
import arcpy
arcpy.CreateMobileMap_mobile("c:/Temp/MyMxd.mxd", "c:/Temp", "","","","")
##################

But I cant get a similar code to work in a stand alone Python script:
##################
import arceditor
import arcpy
from arcpy import env

arcpy.SetProduct("ArcEditor")

arcpy.env.scratchWorkspace = r"C:\Documents and Settings\WMUser\My Documents\ArcGIS\Default.gdb"
arcpy.env.workspace = r"C:\Documents and Settings\WMUser\My Documents\ArcGIS\Default.gdb"

map_document = r"c:\Temp\MyMxd.mxd"
output_folder = r"c:\Temp"

arcpy.CreateMobileMap_mobile(map_document, output_folder,"#", "#", "#", "#")
##################

The script does not generate any errors and I can not se any errors in the C:\Documents and Settings\WMUser\Application Data\ESRI\Desktop10.0\ArcToolbox\History log either.

Any help would be appreciated.

Anders
21 Replies
ABEBEDEMEKE1
New Contributor
Dear All,

Have you had any news about this issue ?

Even after the SP1, when I run the "CreateMobileMap_mobile" geoprocessing from dotnet code, it returns successful and 3 temporary folders are created in C:\Windows\Temp. Each of them contains the same 3 files: "MapSchema.bin", "MobileCache.db" and "MobileCache.db-journal".

It seems it ignores the output folder parametter I set, and then generate an empty mapcache...

Is there any workarround or fix ?

Best regards,



Hi,

I was trying to use the CreateMobileMap Geoporcessing tool from my C# code as follows

but It is not producing any output in the output folder. There is no exception though. What do u think is the reason

   CreateMobileMapTool a = new CreateMobileMapTool();

             IArray parameters = new ESRI.ArcGIS.esriSystem.Array();
     
              parameters.Add(@"C:\check.mxd");
              parameters.Add(@"C:\OutPut");

             a.Execute(parameters, null, null, null);

Any help is greatly appriciated!!!
0 Kudos
JosephThirolf
New Contributor
Has anyone gotten this to work? Did ESRI ever come out with a Hotfix for the bug: NIM062051 reported in this thread?

Best Regards,
Joe
0 Kudos
AndersWallberg
New Contributor II
Unfourtunatly it does not seems like ESRI has come up with an official Hotfix for this: http://resources.arcgis.com/content/nimbus-bug?bugID=TklNMDYyMDUx

As my company is a partner with ESRI, they have helped us to get this to work, but it involved replacing a dll and a python script. I feel sorry for you guys that can not get this to work, I know it is very frustrating. But I can not share theese files I got from ESRI so I guess you have to wait for the official Hotfix.

My suggestion is that you contact ESRI and ask them when they plan to release this Hotfix.

Anders
0 Kudos
SimonGurner
New Contributor
wallan;65874 wrote:
Unfourtunatly it does not seems like ESRI has come up with an official Hotfix for this:
http://resources.arcgis.com/content/nimbus-bug?bugID=TklNMDYyMDUx

As my company is a partner with ESRI, they have helped us to get this to work, but it involved replacing a dll and a python script. I feel sorry for you guys that can not get this to work, I know it is very frustrating. But I can not share theese files I got from ESRI so I guess you have to wait for the official Hotfix.

My suggestion is that you contact ESRI and ask them when they plan to release this Hotfix.

Anders[

Is there any fix / workaround on this? I have tried to generate an automatic means of creating a mobile cache. In my mind this should be very simple. I have generated both an ArcObjects button and a Python script to try to do this - similar to other posts on this thread. Neither seems to work. ESRI can you propose a solution. Surely many users of ArcGIS mobile need to automate their cache creation???

Here is my arcObjects code:

                //Create the Geoprocessor
                IGeoProcessor pGp = new GeoProcessor();

                //Set Overwriteoutput to True
                pGp.OverwriteOutput = true;                

                    IVariantArray pParamArray = new VarArray();
                    pParamArray.Add(@"D:\FES_Data\FES_MobileMap.mxd");
                    pParamArray.Add(@"D:\FES_Data\OutputTest");
                    pParamArray.Add("#");
                    pParamArray.Add("333942.000 6251349.000 334015.000 6251433.000");
                    pParamArray.Add("Establishment;Building;Site;SpaceUnits");
                    IGeoProcessorResult pResult =
                        pGp.Execute("CreateMobileMap_mobile",
                        pParamArray,
                        null);
                    
It runs and does not give an error, but does not return any output (similar to other posts). My Python script also hits the same error as previous posts.

ESRI please tell me there is a solution! Any help appreciated.

Regards,

Simon
]
0 Kudos
AkashJain
New Contributor
Did anyone figure this out yet? I am still kind of stuck on this. Last week, SP2 was released I installed it on my machine but still same results. Cannot create mobile cache programmatically. Take a look at few lines of code below and please advise.


   ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);

   ESRI.ArcGIS.Mobile.GP.CreateMobileMapTool createMobileMap = new   
 ESRI.ArcGIS.Mobile.GP.CreateMobileMapTool();

    IArray mobileParams = new ESRI.ArcGIS.esriSystem.Array();
    mobileParams.Add("C:\\projects\\czPitDemo.mxd");
    mobileParams.Add("C:\\projects\\testfolder");

    ITrackCancel tc = new CancelTracker();
    tc.CancelOnClick = true;
  
    createMobileMap.Execute(mobileParams, tc, null, null);


This code does not gives any error and doesn�??t create the MobileCache either.
0 Kudos
nev
by
New Contributor III
I STILL can't get this working either.  This http://support.esri.com/en/bugs/nimbus/TklNMDYyMDUx  says Status: Resolved.  Can ESRI tell us how to make it work if it is resolved?
Its actually the SynchronizeMobileCache that I would like to use but that just throws errors no matter what I try in Python or in .NET program.  I tried the CreateMobileCache python script and as pointed out above it runs through but creates nothing.
Has anyone got anything automated working at all??  The whole thing is useless to me with this not working.
0 Kudos
JohnGravois
Frequent Contributor
ArcGIS Mobile 10.0 Build 2500 is now available on the Customer Care portal for download.  The build appears to resolve a previous software defect in which automated map cache creation using both Python and ArcObjects executed without error, but failed to create content.

During my testing, a Windows console application which instantiated an ArcGIS Desktop license generated the appropriate content when using C#.  I noticed however that checking out an Engine license instead causes a COM error in the same code.  This issue was logged as [#NIM068816  Initializing an Engine license is not sufficient to execute Create Mobile Cache programmatically. ]

If you have questions or concerns related to this issue, please don't hesitate to contact Esri Technical Support.  If someone else could confirm that they can use ArcObjects to create map caches, it would be appreciated.
0 Kudos
AkashJain
New Contributor
John,
Can you please share a code sample/example, where Mobile Tools (geoprocessing) are used in C# code?
I installed build 2500 and followed all instructions but still not able to create mapcache, due to COM error.
Thanks a lot!
Akash

ArcGIS Mobile 10.0 Build 2500 is now available on the Customer Care portal for download.  The build appears to resolve a previous software defect in which automated map cache creation using both Python and ArcObjects executed without error, but failed to create content.

During my testing, a Windows console application which instantiated an ArcGIS Desktop license generated the appropriate content when using C#.  I noticed however that checking out an Engine license instead causes a COM error in the same code.  This issue was logged as [#NIM068816  Initializing an Engine license is not sufficient to execute Create Mobile Cache programmatically. ]

If you have questions or concerns related to this issue, please don't hesitate to contact Esri Technical Support.  If someone else could confirm that they can use ArcObjects to create map caches, it would be appreciated.
0 Kudos
EricSwartling
New Contributor
John,
any final resolution to this problem and Akash's request "Can you please share a code sample/example, where Mobile Tools (geoprocessing) are used in C# code?"?? Thanks.
Eric
0 Kudos
DuaneWhistle
New Contributor
It seems like a lot of people are not selecting any layers for the createMobileMap tool, after the extent parameter there should be a layer or layers selected.

Example:
arcpy.CreateMobileMap_mobile(v_mobile_mxd, v_output_imagery, "", "-3731425.75005917 -1755480.88317348 1797218.25001261 2855364.50819073", InputDistrict, "")

If anyone has .Net Code please post.
0 Kudos