Edit shapefiles from mpk package

6449
2
Jump to solution
08-19-2014 03:24 AM
Labels (1)
JohanPersson2
New Contributor

I am working on a test application to evaluate the ArcGIS Runtime as a replacement for an old MapObjects application that we have. I have run into two problems that I have not yet been able to solve. I have created a mpk file in ArcMap that contains a simple TIFF map raster image and a polygon layer (shp) that has two features drawn. The shapefile layer was originally created using the old MapObjects application.

Problem 1: The mpk is loaded without any problems into my appplication and when the shapefile is assigned to the EditorWidget as an ArcGISLocalFeatureLayer I am able to select features, add features and delete features on the layer, but I cannot get the saving of the layer to work. The "Save" icon in the EditorWidget gets enabled but when I press it, it does not get disabled and the changes are not committed to the layer. I have tested both mpk with embedded contents and the "Reference all data" with the same result. I have tested the "EditingOffline" sample application available on the net and the saving of the layer of the sample mpk package works there and in my application. Saving of the layer from my mpk does not work in the sample application nor in my application. So I suspect that there is something wrong with my mpk package. Is there any setting or ption I need to select before generating the mpk file in order to have the layer editable?

Problem 2: I generated an mpk package containing the TIFF map raster image and an empty shp shapefile (line type). This shapefile was also originally created using MapObjects and the purpose of having it in the mpk is to use it as a tracking layer for persistant storage of the tracking history of the GPS position in the ArcGIS Runtime application. However, when I load the mpk in my test application, nothing of the contents appears on the map. If I remove the empty layer, the package loads without any problems again. I don't get any exceptions or error messages, it looks like the loading or display of the package is just interrupted. Are there any known limitations or is it considered a "bad practise" to handle empty layers?

0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

Hi,

RE: Problem 1:

It is not possible to edit Shapefiles directly via the ArcGIS Runtime SDK for WPF. Instead you will need to move to using the File Geodatabase (which is what happens when you include your data within the Map Package). I am not sure why the EditorWidget is not saving features in your case, are you starting the LocalFeatureService as editable? 

RE: Problem 2:

I cannot immediately say why the layer might not be displaying, it could be a problem starting the local service from the MPK (you should handle the service startup completed event, or await the StartAsync Task if you are using async Tasks). There is an error property on the service you can check. The LocalServer also write information to log file, which you can enable and access via the LocalServerUtility app available as a shortcut on your Start screen/menu. It is also possible it is simply a projection issue, perhaps your TIFF and/or the Shapefile and/or the map document are in different coordinate systems.

It is also worth noting, we have been working on a new .NET SDK for the ArcGIS Runtime which includes a WPF API for building Windows Desktop apps. It's an evolution of the existing ArcGIS Runtime SDK for WPF. You can find information on the current beta here: ArcGIS SDK for .Net | ArcGIS for Developers‌. Rather than using Shapefiles, Map Packages and LocalServices, in the new .NET SDK you can work with runtime geodatabases directly. These runtime geodatabases need to have been created from ArcMap (similar process to the Map packaging) or extracted from a feature service (on premises or hosted online).

Cheers

Mike

View solution in original post

0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

RE: Problem 1:

It is not possible to edit Shapefiles directly via the ArcGIS Runtime SDK for WPF. Instead you will need to move to using the File Geodatabase (which is what happens when you include your data within the Map Package). I am not sure why the EditorWidget is not saving features in your case, are you starting the LocalFeatureService as editable? 

RE: Problem 2:

I cannot immediately say why the layer might not be displaying, it could be a problem starting the local service from the MPK (you should handle the service startup completed event, or await the StartAsync Task if you are using async Tasks). There is an error property on the service you can check. The LocalServer also write information to log file, which you can enable and access via the LocalServerUtility app available as a shortcut on your Start screen/menu. It is also possible it is simply a projection issue, perhaps your TIFF and/or the Shapefile and/or the map document are in different coordinate systems.

It is also worth noting, we have been working on a new .NET SDK for the ArcGIS Runtime which includes a WPF API for building Windows Desktop apps. It's an evolution of the existing ArcGIS Runtime SDK for WPF. You can find information on the current beta here: ArcGIS SDK for .Net | ArcGIS for Developers‌. Rather than using Shapefiles, Map Packages and LocalServices, in the new .NET SDK you can work with runtime geodatabases directly. These runtime geodatabases need to have been created from ArcMap (similar process to the Map packaging) or extracted from a feature service (on premises or hosted online).

Cheers

Mike

0 Kudos
JohanPersson2
New Contributor

Thanks Michael! Your answer made me realize that I had not the layer as a geodatabase in the package. It just included the shp, shx, dbf etc. I used the Catalog to convert the shape file to a proper geodatabase and with that package it was possible to edit the layer in the target machine. I will also try a similar approach for the tracking layer. Probably that layer can be created as a geodatabase directly and not converted from a shapefile.

0 Kudos