Select to view content in your preferred language

Local feature service with copied package files uses the same unpacked folder

3212
10
Jump to solution
04-03-2014 02:25 PM
Labels (1)
Cristian_Galindo
Frequent Contributor
DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far???

When creating two LocalFeatureService I use two package files to define each service. the file package2 is a copy of the file package1.

               var localCenterlineServiceMPK = new LocalFeatureService()    {                                                         Path = @"C:\package1.mpk",     MaxRecords = 100000    };     ArcGISLocalFeatureLayer lineLayer = null;     localCenterlineServiceMPK.Start();     lineLayer = new ArcGISLocalFeatureLayer    {     Url = localCenterlineServiceMPK.UrlFeatureService + "/0",     Service = localCenterlineServiceMPK,     ID = "lines",     LayerName = "lines",     Editable = true,     DisableClientCaching = true,     AutoSave = false,     Mode = FeatureLayer.QueryMode.Snapshot,     OutFields = new OutFields { "*" }    };              var localCenterlineServiceMPK2 = new LocalFeatureService()             {                 Path = @"C:\package2.mpk",                 MaxRecords = 100000             };              ArcGISLocalFeatureLayer lineLayer2 = null;              localCenterlineServiceMPK2.Start();              lineLayer2 = new ArcGISLocalFeatureLayer             {                 Url = localCenterlineServiceMPK.UrlFeatureService + "/0",                 Service = localCenterlineServiceMPK,                 ID = "lines",                 LayerName = "lines",                 Editable = true,                 DisableClientCaching = true,                 AutoSave = false,                 Mode = FeatureLayer.QueryMode.Snapshot,                 OutFields = new OutFields { "*" }             };              this.MyMap.Layers.Add(lineLayer);             this.MyMap.Layers.Add(lineLayer2);


When I check the folder C:\Users\XXXX\AppData\Local\ArcGISRuntime\Documents\ArcGIS\Packages there is only one folder : package1...

If I perform changes in the graphics of the layer lineLayer those changes are also visible in the lineLayer2. due both layers are sharing the same fileGDB.

Is there a way to force the ArcGISRuntime to unpack  both file packages (despite the fact that one is a copy), so the changes in one layer wont affect the other one.
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor
Hi,

I do not quite understand the requirement - although you will see some improvement in performance from distributing the map rendering load across multiple local services (each is a separate process). To achieve this you will need to republish the Map Package in ArcMap with a different map/package name.

This behaviour is by design. Each Map Package has a real/internal name which is not related to the filename. It is the name you gave the map/package when creating in ArcMap. When starting local services the API inspects the MPKs and unpacks based on the actual map name. Therefore if you copy the file and rename it will try to unpack these to the same location and will likely raise the InitializationFailed event, which of course you should add logic to handle for any layer type, just in case: http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client~ESRI.ArcGIS.Cli....

Cheers

Mike

View solution in original post

0 Kudos
10 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Which version are you using? This was fixed in v10.2 I believe, although 10.2.2 is the latest release.

Cheers

Mike
0 Kudos
Cristian_Galindo
Frequent Contributor
Hi,

Which version are you using? This was fixed in v10.2 I believe, although 10.2.2 is the latest release.

Cheers

Mike



Hello Mike!!

I'm using 10.2, been more acurate: I use the installer ArcGIS_Runtime_SDK_for_WPF_102_136375

Cheers
0 Kudos
Cristian_Galindo
Frequent Contributor
Well, I just installed the version 10.2.2

but the behavior is the same, it only unpack to one folder. 😞

the second layer includes the information saved in the first one.....Any suggested workaround?
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Well, I just installed the version 10.2.2 but the behavior is the same, it only unpack to one folder.


Hi,

I'll investigate and update this thread as soon as i have more information.

Cheers

Mike
0 Kudos
Cristian_Galindo
Frequent Contributor
Well, I just installed the version 10.2.2

but the behavior is the same, it only unpack to one folder. 😞

the second layer includes the information saved in the first one.....Any suggested workaround?


By the way, I uninstall the prior versions of ArcGIS Runtime (10.1.1, 10.2, .NET) before i install the version 10.2.2
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Why are you creating two services from the same package?

Cheers

Mike
0 Kudos
Cristian_Galindo
Frequent Contributor
Hi,

Why are you creating two services from the same package?

Cheers

Mike



Because it is some  kind of template to hold different layers but with the same attributes, so the idea is to create several layers with common attributes.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

I do not quite understand the requirement - although you will see some improvement in performance from distributing the map rendering load across multiple local services (each is a separate process). To achieve this you will need to republish the Map Package in ArcMap with a different map/package name.

This behaviour is by design. Each Map Package has a real/internal name which is not related to the filename. It is the name you gave the map/package when creating in ArcMap. When starting local services the API inspects the MPKs and unpacks based on the actual map name. Therefore if you copy the file and rename it will try to unpack these to the same location and will likely raise the InitializationFailed event, which of course you should add logic to handle for any layer type, just in case: http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client~ESRI.ArcGIS.Cli....

Cheers

Mike
0 Kudos
Cristian_Galindo
Frequent Contributor
Hello Mike,

thanks for your answer.

I subscribe the code to the event initialization failed, but it does not hit that method, the service is created and functional, due both services return the same features and the changes made in one of them are reflected in the other.

my requirement is this:

I have a service that returns me a set of data that includes lat/long and feature attributes (I know that attributes, so I prepare a package file with a geoDB inside with those attributte fields) so If i make a call to the service i want to see the results of that call in  a layer (a different layer per each call).

I dont know how many calls the user in the applicaction is going to make, therefore, i though that the correct approach was to have some kind of package file template, copy it, and use it to create a new service then consume it to draw the features and use the persistence that the ArcGISLocalFeatureLayer gives to reduce the amont of traffic over the network in other sessions of the same user due some objects will be saved in the geoDB that the package creates.

Taking into account that I cannot goes to ArcMap and cretes a new package every time I make a call to the service, do you fancy any workaround?
0 Kudos