Editing & Updating Feature Layers

721
7
10-15-2012 09:00 AM
MattSheehan
Occasional Contributor III
We are building a mobile app which accesses ArcGIS Online. The attached image shows what we are loading from ArcGIS online in the mobile app (from flash builder). We have published in this webmap in arcgis online 2 shapefiles (operational layers 0 and 1). We are having no problem updating the features in each of these layers locally (though applyEdits updates the graphicslayer only for each layer which is a bit wonky) on a tablet. So all edits show up just fine on the device (stored in memory). We would like now update the server with these changes. We cannot see how to update the featurecollections for these two operational layers (0 and 1) on the server. We know it can be done since we can do it when logged into arcgis.com. Any insight would be very welcome

Thanks

--Rory
Tags (2)
0 Kudos
7 Replies
MikeMinami
Esri Notable Contributor
Do you have a subscription with ArcGIS Online? Are you working with a hosted feature service? Or alternatively, editing an ArcGIS Server feature service? These are the main options that support editing on the server.

Thanks,

Mike
0 Kudos
MattSheehan
Occasional Contributor III
Mike,

Thanks for the reply. We are a partner, and thus have a subscription account. The question is with shapefiles published to ArcGIS Online, so a hosted Feature Service. When actually logged into ArcGIS Online (via arcgis.com) we can edit and save with no problem. How do we do the same through our mobile app. Applyedits sends nothing to the server, it simply updates the local (on mobile device) copy of the data. We want to actually update the ArcGIS Online source.

Thx

--Rory
0 Kudos
BjornSvensson
Esri Regular Contributor
The question is with shapefiles published to ArcGIS Online, so a hosted Feature Service. When actually logged into ArcGIS Online (via arcgis.com) we can edit and save with no problem. How do we do the same through our mobile app. Applyedits sends nothing to the server, it simply updates the local (on mobile device) copy of the data. We want to actually update the ArcGIS Online source.


My first guess is that it is either something special about your hosted shapefile-based feature layer, or something about your code for working with featurelayers locally.

To test the first case:
Try testing with http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0

To test the second case:
If you are working with a feature layer (not using FeatureCollection) then applyEdits should do the right thing.  Could you test and verify that? 
If you are using a feature layer (with a featurecollection), then applyEdits will not work they way I think you are trying to use it. You would normally use FeatureCollection OR server-based data, not both at the same time. Look at  FeatureLayerTask which is what the feature layer is using under the hood. I think that's might be your best bet.
0 Kudos
MattSheehan
Occasional Contributor III
Bjorn,

Thanks for the reply. When we use feature layer which does not use FeatureCollection, all works well (we tested successfully the layer you included in your reply). Applyedits updates the server.

There is nothing special about the shapefiles we have used in our service, as far as we can see. It seems by default they are set as feature layers with featurecollections when published. From the flash builder image we attached you'll see these shapefile operations layers have no url. This may be a more fundamental question, something we are missing. But how do we use FeatureLayerTask against a feature layer with a featurecollection. The Flex api for FeatureLayerTask shows the following:

FeatureLayerTask(url:String = null)
Creates a new FeatureLayerTask object.

The webmap we are testing against is as follows:

http://webmapsolutions.maps.arcgis.com/home/webmap/viewer.html?webmap=c6b1e033e47248818b73757d03b58d...

Thanks again for your help

--Rory
0 Kudos
MikeMinami
Esri Notable Contributor
Looking at your web map, I see several layers, which ones are you trying to edit?

Pool Permits
Operations
beruit_natural
beruit_location

If you are trying to edit the beruit... layers, these shapefiles are not hosted feature services, but rather feature layers stored in the web map. This could be the problem.

Thanks,

Mike
0 Kudos
MattSheehan
Occasional Contributor III
Mike,

Thanks for clearing this up. We missed the step to make them hosted feature services

http://resources.arcgis.com/en/help/arcgisonline/index.html#//010q0000006m000000

we simply added the shapefile as a feature layer to the map. So if we have multiple shapefiles, we would need to publish each individually as hosted shapefiles. To pull them into one map, we would then just need to create a new webmap and add these hosted feature layers as new layers to this map.

--Rory
0 Kudos
MikeMinami
Esri Notable Contributor
If you publish from ArcGIS Desktop, you could create one feature service with multiple layers. Publishing from ArcGIS.com will give you one service per shapefile.

Thanks,

Mike
0 Kudos