|
POST
|
https://community.esri.com/message/665336-popups-in-arcgis-runtime-sdk-for-net?q=popup
... View more
02-24-2017
08:16 AM
|
0
|
0
|
3074
|
|
POST
|
Just to add to this, I encountered the same issue when using AddFeatureAsync(), then ApplyEditsAsync(), and then without going back to the server to get the feature, calling UpdateFeatureAsync(). This actually throws a different error (I can't post if it will help, just let me know), but if you call RefreshObjectId on the feature, then everything works as expected. Thanks again for your help in getting this figured out.
... View more
02-23-2017
06:56 PM
|
0
|
0
|
5610
|
|
POST
|
Magical....it is not refreshing, but yeah, the delete does actually work. Thanks, better than going back to query for the feature again. Thanks for the Id feedback. I understand the ObjectId, just thought the GlobalId would remain the same. Regardless, all set, thanks so much for helping out.
... View more
02-22-2017
09:01 AM
|
0
|
0
|
5610
|
|
POST
|
Jennifer, RefreshObjectId() doesn't seem to work, it stays a negative value. Should RetryLoadAsync() load the feature from the server? I did confirm that getting the results from the EditResult returned from ApplyEditsAsync does in fact have the ObjectId and GlobalId values. Thanks for that tip, much appreciated. Just curious, why does the GlobalId get set when the feature is added, but then changes after ApplyEditsAsync() is called? await ftrTable.AddFeatureAsync (feature);
var gidFieldName = ((ArcGISFeatureTable)feature.FeatureTable).GlobalIdField;
object gid = string.Empty;
feature.Attributes.TryGetValue (gidFieldName, out gid);
var oidFieldName = ((ArcGISFeatureTable)feature.FeatureTable).ObjectIdField;
object oid = string.Empty;
feature.Attributes.TryGetValue (oidFieldName, out oid);
ToastHelpers.ShowInfo (oid.ToString (), gid.ToString (), 2);
feature.RefreshObjectId ();
oid = string.Empty;
feature.Attributes.TryGetValue (oidFieldName, out oid);
ToastHelpers.ShowInfo (oid.ToString (), gid.ToString (), 2);
ServiceFeatureTable serviceTable = ftrTable as ServiceFeatureTable;
IReadOnlyList<EditResult> results = await serviceTable.ApplyEditsAsync ();
foreach (EditResult result in results) {
ToastHelpers.ShowInfo (result.ObjectId.ToString (), result.GlobalId, 2);
}
... View more
02-22-2017
05:48 AM
|
0
|
3
|
5610
|
|
POST
|
Jennifer, thanks again, I'll try RefreshObjectId and see if that resolves my issue. I missed that one, sounds like it will fix my issue. Thanks again, I'll post back my results after I get a chance to test.
... View more
02-21-2017
12:03 PM
|
0
|
5
|
5610
|
|
POST
|
Jennifer, thanks for the reply. I am adding the feature similar to the code you show, but it is more like below since the user is adding the feature online, where apply edits is called. try
{
var location = await MyMapView.SketchEditor.StartAsync(SketchCreationMode.Point, false) as MapPoint;
var layer = (FeatureLayer)MyMapView.Map.OperationalLayers[0];
var table = (ArcGISFeatureTable)layer.FeatureTable;
var template = table.LayerInfo.FeatureTemplates.FirstOrDefault();
var feature = table.CreateFeature(template);
feature.Geometry = location;
await table.AddFeatureAsync(feature);
var serviceTable = table as ServiceFeatureTable;
var results = await serviceTable.ApplyEditsAsync ();
await layer.FeatureTable.DeleteFeatureAsync(feature);
}
catch (TaskCanceledException)
{
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
} In this code, you'll get the 'Unable to complete operation' error when DeleteFeaturesAsync() is called. And, if you inspect the GlobalId, you'll see that it is set. But, if you use QueryFeaturesAsync or get the feature by tapping on it, you'll see that the GlobalId is different. Is this expected? Is there a way to get/refresh the feature that has been added without going back to the server to get it (either by QueryFeaturesAsync or tapping the map)? Should RetryLoadAsync() refresh the feature so it's what is on the server? I get it if I need to go back to the server, but stumped on how to get the feature, other than use the attributes that the user entered since the ObjectId is a negative number (not refreshed from the server) and the GlobalId is different. Hope this makes sense. This is not an issue while offline, only when working in a connected environment. Thanks again for your help.
... View more
02-18-2017
03:32 AM
|
0
|
7
|
5610
|
|
POST
|
I'm experiencing an issue trying to delete a feature which was just created. This is all while working online using iOS (haven't tested yet on Android or UWP). The scenario is this: User is viewing a list of maintenance records and wants to add a new one. We transition to a new page to allow the user to add the new record, click save and the feature is created and added to the model which is bound to the previous page. User returns to the previous page and sees the new record, but then decides they'd rather not add, so they select the record and attempt to delete it. I've tried 3 ways to get this to work, but none have worked. It seems like the feature is "stuck" as the local copy, not the actual feature that was added to the server. Feature.RetryLoadAsync() does nothing to change this behavior. Using FeatureTable.DeleteAsync() throws an error: "Unable to complete operation". Next thought was to use the ObjectId and query to find the feature. Well, this is a negative number (which makes sense, but I'm online, so why isn't it the real one?) Next try the GlobalId. Well...the GlobalId is created when CreateFeature() is called. But, if you use this to query to find the record on the server so you can delete it, it won't find it, because the server record has a new GlobalId. If I query the table to get all of the records again, I can then find the one I want using other attributes and delete it, but this only works after using another query. Any way around this? Should RetryLoadAsync() rehydrate the feature as it is on the server? Seems like there needs to be a way to get the server feature after it is created, but I don't see any way to do that. Any ideas or thoughts would be appreciated.
... View more
02-15-2017
11:51 AM
|
1
|
9
|
6840
|
|
POST
|
Thanks Antti. I tried the second option with no luck, so for now I'll go with the workaround.
... View more
02-07-2017
03:50 AM
|
0
|
0
|
832
|
|
POST
|
I have a page which shows maps which have been downloaded to the device. The page shows the name, date and the number of edits in each map. To show the edit count, the Gdb is opened using Geodatabase.OpenAsync. On this page, the user can choose to open, sync or delete the map. This works fine on iOS and Android, however on UWP the Geodatabase.OpenAsync creates a lock on the file when the page is loaded, and I can't seem to figure out how to release it so the user can delete the map. Any ideas? Thanks.
... View more
02-06-2017
02:32 PM
|
0
|
2
|
1436
|
|
POST
|
Here's some code which works for me. Hopefully you can piece it together and it works for you. Hit me up again if not. /// <summary> /// Gets or sets the current basemap URL. /// </summary> /// <value>The current basemap URL.</value> public static string CurrentBasemapUrl { get { switch (CurrentBasemapName.Trim ().ToLower ()) { case "imagery": return "https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"; case "streets": return "https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Street_Map/MapServer"; case "topo": return "https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Topo_Map/MapServer"; default: return "https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"; } } } /// <summary> /// The export tile cache. /// </summary> private static ExportTileCacheTask _exportTileTask = null; /// <summary> /// The export tile parameters. /// </summary> private static ExportTileCacheParameters _tileParameters = null; /// <summary> /// Setups the export tile cache. /// </summary> /// <returns>The export tile cache.</returns> /// <param name="mapExtent">Map extent.</param> /// <param name="maxLOD">Max LOD.</param> private static async Task SetupExportTileCacheAsync(Envelope mapExtent, int maxLOD) { try { //Generate the token options and credential var options = new Esri.ArcGISRuntime.Security.GenerateTokenOptions() { Referer = new Uri(StorageManager.CurrentBasemapUrl) }; var user = await ConfigurationManager.GetArcGISUserNameAsync (); var pass = await ConfigurationManager.GetArcGISPasswordAsync (); var cred = await Esri.ArcGISRuntime.Security.AuthenticationManager.Current.GenerateCredentialAsync( new Uri("https://www.arcgis.com/sharing/rest/generatetoken"), user, pass, options); //Check the credential and add to the identity manager if (cred != null) Esri.ArcGISRuntime.Security.AuthenticationManager.Current.AddCredential(cred); //Create the service for the export var tileService = new ArcGISTiledLayer(new Uri (StorageManager.CurrentBasemapUrl)); if (tileService.LoadStatus != Esri.ArcGISRuntime.LoadStatus.Loaded) await tileService.LoadAsync (); //Create the export task _exportTileTask = await ExportTileCacheTask.CreateAsync(new Uri (StorageManager.CurrentBasemapUrl)); //Create the export parameters _tileParameters = await _exportTileTask.CreateDefaultExportTileCacheParametersAsync (mapExtent, tileService.TileInfo.LevelsOfDetail.ToArray()[0].Scale, tileService.TileInfo.LevelsOfDetail.ToArray()[maxLOD].Scale); } catch { throw; } } /// <summary> /// Downloads the tile cache. /// </summary> /// <returns>The tile cache.</returns> /// <param name="mapName">Map name.</param> /// <param name="mapExtent">Map extent.</param> /// <param name="maxLOD">Max LOD.</param> public static async Task<TileCache> DownloadTileCacheAsync(string mapName, Envelope mapExtent, int maxLOD) { try { //Setup the export parameters and task await SetupExportTileCacheAsync(mapExtent, maxLOD); //Get the export path and file string exportPath = Path.Combine (ConfigurationManager.AppDataDirectory, mapName); exportPath = PathHelpers.CleanPath (exportPath); //Create the directory if it doesn't exist if (!System.IO.Directory.Exists(exportPath)) System.IO.Directory.CreateDirectory(exportPath); string exportFile = Path.Combine(exportPath, "BasemapLayer.tpk"); if (System.IO.File.Exists(exportFile)) System.IO.File.Delete(exportFile); //Export the tiles Job<TileCache> exportJob = _exportTileTask.ExportTileCache(_tileParameters, exportFile); //Create the handler for status updates exportJob.JobChanged += (object sender, EventArgs evt) => { #if WINDOWS_UWP Debug.WriteLine("[EXPORT STATUS MESSAGE] " + exportJob.Status.ToString()); #else Console.WriteLine("[EXPORT STATUS MESSAGE] " + exportJob.Status.ToString()); #endif }; //Get the result TileCache cache = await exportJob.GetResultAsync(); //Check the result if (cache == null) { ToastHelpers.ShowError("Download Error", "Unable to download the selected basemap.\n\n" + exportJob.Error.Message, 7); } else { ToastHelpers.ShowSuccess("Basemap Download", "Successfully downloaded the basemap for offline use.", 5); } return cache; } catch (Exception ex) { ToastHelpers.ShowError ("Tile Cache Download Error", "An error occurred while downloading the tile cache.\n\n" + ex.Message, 7); return null; } }
... View more
01-27-2017
05:50 AM
|
0
|
0
|
1138
|
|
POST
|
What are the device specs you are testing on? Emulator or real device? OS, version, etc.
... View more
01-21-2017
10:46 AM
|
0
|
0
|
1882
|
|
POST
|
Sounds like you definitely have some weird things going on. Are you testing on an emulator? If so, which one? I periodically had issues using an emulator in the Beta version, but have not seen it with v. 100.0.0. Sync Geodatabase: - If you are only syncing a single layer, why not just use the Geodatabase sync model? - Does the error typically occur on the same service? Load map: - If you start online, then switch to offline and load the map, I would also try creating a new Map before you load the layers. - Might be good practice to check if the table has geometry. GeodatabaseFeatureTable.HasGeometry property. - If an error occurs on a specific database, have you checked that it's valid by just opening the database to view the contents? Internet Off: - What is the workflow you are using to load the offline geodatabase? Are the layers loaded when the application starts while offline? - Make sure to create a new Map if you transition from online to offline.
... View more
01-19-2017
10:57 AM
|
0
|
4
|
1882
|
|
POST
|
Bummer you are having such issues. I've been pleasantly surprised with how few issues I've encountered using the v. 100.0.0 release. And, in the case where issues were found, there are adequate workarounds in place or fixes provided. If you elaborate more on the issues and/or provide code, it will make it much easier for you to get help. Also, specifics on your dev and server environment and the devices/emulators you are working with would be helpful.
... View more
01-18-2017
03:51 PM
|
0
|
6
|
1882
|
|
POST
|
If you are loading the data directly from the geodatabase when online or offline, then there should be no difference. I've not had any issues loading data from the geodatabase. If you can share code or a sample geodatabase, that would help.
... View more
01-18-2017
04:35 AM
|
0
|
0
|
1317
|
|
POST
|
Your post stated you knew how to download TPK's, and I shared code for the geodatabase. Are you just asking how to get the extent? Using ExportTileCacheParameters, it would be something like, where the mapExtent variable is: EsriMapView.VisibleArea.Extent //Create the service for the export var tileService = new ArcGISTiledLayer(new Uri (StorageManager.CurrentBasemapUrl)); if (tileService.LoadStatus != Esri.ArcGISRuntime.LoadStatus.Loaded) await tileService.LoadAsync (); //Create the export task _exportTileTask = await ExportTileCacheTask.CreateAsync(new Uri (StorageManager.CurrentBasemapUrl)); //Create the export parameters _tileParameters = await _exportTileTask.CreateDefaultExportTileCacheParametersAsync (mapExtent, tileService.TileInfo.LevelsOfDetail.ToArray()[0].Scale, tileService.TileInfo.LevelsOfDetail.ToArray()[maxLOD].Scale);
... View more
01-18-2017
04:32 AM
|
0
|
0
|
1397
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2017 11:09 AM | |
| 1 | 09-22-2017 10:32 AM | |
| 1 | 06-20-2017 07:32 AM | |
| 1 | 04-07-2017 03:32 AM | |
| 3 | 12-19-2019 12:58 PM |
| Online Status |
Offline
|
| Date Last Visited |
03-11-2025
09:48 AM
|