Errors with parameters when exposing Model as GPK in BETA 2

1744
6
01-05-2012 06:51 AM
Labels (1)
BKuiper
Occasional Contributor III
Hi,

We are experiencing problems creating GPK from Models (not python scripts) in BETA 2. We are not running BETA 1 anymore, but are pretty sure that this was still working in that version (BETA 1).

The problem is that the parameters on the GPK of the model are not converted to String so the Runtime Server is not able to expose the parameter and allow input.

A simple example, we made a model based on "Package Map" which is located in "Data Management - Package". It takes a .mxd (ArcMap document) as input and creates an .mpk (Map Package) as output.

The model works fine in ArcMap, but as soon as you convert the result into a GPK you are not able to set the parameters (input, output) on the object.

If your browse to the endpoint you will see it won't accept any parameters:

http://localhost.:50000/XXXX/arcgis/rest/services/model/GPServer/Model/submitJob

It will work if I convert the Model to a Python script and convert the parameters to string and create a GPK of that.

Attached is a zip which contains the toolbox, an example code and the GPK (as model)
0 Kudos
6 Replies
KerrieScholefield
Occasional Contributor
Hi,

Many thanks for posting this issue and example reproducer. We are able to reproduce this and will investigate the issue further and get back to you.

Kerrie
0 Kudos
KerrieScholefield
Occasional Contributor
Hi,

The Package Map GP tool was removed from the ArcGIS Runtime at Beta 2. 

The list of supported GP tools can be found in the following concept help doc: http://resourcesbeta.arcgis.com/en/help/runtime-wpf/concepts/#/Supported_geoprocessing_tools/0170000...

If you can provide an outline of your workflow using the Package Map GP tool that would be great.

Thanks,

Kerrie
0 Kudos
BKuiper
Occasional Contributor III
Hi Kerrie,

We are using Package Map to dynamically consume layers in our WPF application. This workflow was, as far as i understand, confirmed by Mike in this previous forum post:

http://forums.arcgis.com/threads/46471-Exposing-Feature-Class-from-(file)-GDB-into-WPF-app-as-Featur...

What other way is there to dynamically display a Feature layer from a (file) GDB within your WPF application?

ps: the link you provided doesn't work, but I assume it has to be this: http://resourcesbeta.arcgis.com/en/help/runtime-wpf/concepts/index.html#/Supported_geoprocessing_too...


EDIT:

Btw running the Model as a python script works. The only problem then is that the MPK is saved within ScratchWorkspace and therefore not really accessible for the app. I hope to hear from you how we should go about and dynamically consume feature layers from a GDB into a WPF application.

thank you!
0 Kudos
KerrieScholefield
Occasional Contributor
Hi,

Instead of using Package Map GP Tool to create the .mpk another workflow would be be the following:

> Open up the .mxd containing your File Geodatabase or a reference to your File Geodatabase in ArcMap.
> Navigate to File > Share As > Map Package and make sure "Support ArcGIS Runtime" is checked
> Check on "Reference all data" if you want to create a map package that points to the data needed rather than copying the data.
> The .mpk can then be consumed in your WPF application.

http://resourcesbeta.arcgis.com/en/help/runtime-wpf/concepts/#/How_to_create_a_map_package/017000000...

Thanks,

Kerrie
0 Kudos
BKuiper
Occasional Contributor III
Hi,

Instead of using Package Map GP Tool to create the .mpk another workflow would be be the following:

> Open up the .mxd containing your File Geodatabase or a reference to your File Geodatabase in ArcMap.
> Navigate to File > Share As > Map Package and make sure "Support ArcGIS Runtime" is checked
> Check on "Reference all data" if you want to create a map package that points to the data needed rather than copying the data.
> The .mpk can then be consumed in your WPF application.

http://resourcesbeta.arcgis.com/en/help/runtime-wpf/concepts/#/How_to_create_a_map_package/017000000...

Thanks,

Kerrie


Hi Kerrie, this workflow involves user handling. I want to automatically create a map package.

Let me explain what i'm trying to do.

My application generates data. This data needs to be visualized to the user in the WPF application on the Map Control. The way to achieve this, as confirmed by Mike in the other thread, automatically, without user involvement, is:
1. Generate layer file (or Feature class)
2. Add layer file (or feature class) to empty Map document (.mxd)
3. Generate Map Package (.mpk) from Map document (.mxd)
4. Consume Map package (.mpk) in WPF application as service.
5. Consume Layer from Map package and display on the Map control.

Could you explain me how would you go about and achieve these steps (or something similar) in code, without using ArcObjects or User involvement (starting ArcMap, or something similar) ? I'm think the MapPackage Tool is needed for this.

Thanks
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Apologies for the misunderstanding in the original answer. When responding to the question in that post (http://forums.arcgis.com/threads/46471-Exposing-Feature-Class-from-(file)-GDB-into-WPF-app-as-Featur......

what would be the best way to expose a feature class which is stored in a (file) geodatabase in a WPF ESRI Map Control as a Feature Layer using ArcGIS Runtime. Currently we are using a empty map file (.mxd), add a reference to the feature class and save it as a new map file (.mxd), convert the .mxd to a map package with runtime support (.mpk) and then consume it as a LocalArcGISFeatureLayer. Would you agree that this is the best and preferred ESRI way?


... I did not realize that you were referring to an automated process. The process you outline is correct if undertaken as a manual process in ArcGIS for Desktop. Currently, the Package Map GP tool is not supported in the ArcGIS Runtime because it is considered an authoring tool. The process could be automated within ArcGIS for Desktop via .NET or Python.

However, I believe the new ArcGIS Runtime Beta 2 dynamic layers functionality may allow you to achieve your goal. This enables you to entirely change the contents of an ArcGISLocalDynamicMapServiceLayer or ArcGISDynamicMapServiceLayer at runtime without the need for republishing an MPK. When using the ArcGIS Runtime local server with an MPK, you would register a Geodatabase or folder workspace with the LocalMapService and set the EnableDynamicLayers property to true prior to starting the service. Then, following the code example in http://forums.arcgis.com/threads/46471-Exposing-Feature-Class-from-(file)-GDB-into-WPF-app-as-Featur..., you can add/remove featureclasses as required as if you were modifying the underlying MPK. However, this is all managed by the client API and so in reality the MPK remains unchanged. This functionality gives you enormous flexibility when working with local map services.

Please let us know if the dynamic layers functionality will not enable you to achieve your desired workflow and we'll do some further investigation on this.

Cheers

Mike
0 Kudos