|
POST
|
Renaming the geodatabase file is fine, but note that once you do that, setting the useExisting parameter on generateGeodatabaseWithParameters:downloadFolderPath:useExisting:status:completion: method to YES will no longer be able to find the local database that matches your parameters. The way it works is that the default name of the gdb file is basically a hash of the parameters provided; this allows the API to easily search for an existing one before requesting the service. If you change the name, that will no longer work. Thanks Divesh for the advice. In our case it is necessary to rename the geodatabase because our app has many modules and each module has its own geodatabase (strictly speaking, each module could be a separate app and the reason to include them in one app is to be able to share tile packages among the modules/apps.) When our app goes offline, if the local geodatabase for the current module is found it is used and the layers in it are loaded into the map view, otherwise the app generates a new geodatabase for the module and downloads features within the visible map extent, and the database is being renamed in the downing process. When sync, an instance of AGSGDBGeodatabase is created with the renamed geodatabase file and registered with the feature service from which the geodatabase is generated. So I think the parameter 'useExisting' does not have any effect in our process and so far everything has seemed to be working as expected... Cheers, Shimin
... View more
06-10-2014
04:21 PM
|
0
|
2
|
975
|
|
POST
|
This looks like it would do the trick: http://gpxframework.com You should be able to just iterate over a feature set and push the items into the GPX file. Thanks Mike for the link. I think it can do what I wanted to do... However, we decided to take advantage of ArcGIS Online to share our mobile data if required instead of exporting to GPX or shapefiles. We'll be looking at authorising a web map on ArcGIS Online that has access to our arcgis server mobile feature services. Then from within the iDevices we just simply email the link to the web map with the bounding box coordinates or centroid of the map view...
... View more
06-10-2014
03:21 PM
|
0
|
0
|
718
|
|
POST
|
Did it in the completion block of the generateGeodatabaseWithParameters method. @property (nonatomic, strong) AGSGDBSyncTask *gdbTask; [self.gdbTask generateGeodatabaseWithParameters:params downloadFolderPath:nil useExisting:YES status:^(AGSResumableTaskJobStatus status, NSDictionary *userInfo) { if(status == AGSResumableTaskJobStatusFetchingResult) { _newlyDownloaded = YES; } [self logStatus:[NSString stringWithFormat:@"Status: %@", [self statusMessageForAsyncStatus:status]]]; } completion:^(AGSGDBGeodatabase *geodatabase, NSError *error) { if (error) { _goingOffline = NO; _offline = NO; [self logStatus:[NSString stringWithFormat:@"error taking feature layers offline: %@", error]]; [SVProgressHUD showErrorWithStatus:@"Couldn't download features"]; [self updateUI]; } else { _goingOffline = NO; _offline = YES; [self logStatus:@"now viewing local data"]; ////Remove all live feature layers for (AGSLayer* lyr in self.mapView.mapLayers) { if([lyr isKindOfClass:[AGSFeatureLayer class]]) { [self.mapView removeMapLayer:lyr]; } } //rename the database NSString *orginalFilePath = geodatabase.path; NSString *directoryPath = [orginalFilePath stringByDeletingLastPathComponent]; NSString *directoryPathNameWithoutExtension = [orginalFilePath stringByDeletingPathExtension]; NSString *orginalFilePathShm = [directoryPathNameWithoutExtension stringByAppendingString:@".geodatabase-shm"]; NSString *orginalFilePathWal = [directoryPathNameWithoutExtension stringByAppendingString:@".geodatabase-wal"]; NSString *newFilePath = [directoryPath stringByAppendingString:@"/HFDPlanning.geodatabase"]; NSString *newFilePathShm = [directoryPath stringByAppendingString:@"/HFDPlanning.geodatabase-shm"]; NSString *newFilePathWal = [directoryPath stringByAppendingString:@"/HFDPlanning.geodatabase-wal"]; [FCNSWUtils renameFile:orginalFilePath :newFilePath]; [FCNSWUtils renameFile:orginalFilePathShm :newFilePathShm]; [FCNSWUtils renameFile:orginalFilePathWal :newFilePathWal]; AGSGDBGeodatabase *gdb = [[AGSGDBGeodatabase alloc]initWithPath:newFilePath error:nil]; self.geodatabase = gdb; geodatabase = gdb; //Add local feature/table layers for (AGSFeatureTable* fTable in geodatabase.featureTables) { if ([fTable hasGeometry]) { AGSFeatureTableLayer *ftl = [[AGSFeatureTableLayer alloc]initWithFeatureTable:fTable]; ftl.delegate = self; [self.mapView addMapLayer:ftl]; } } if (_newlyDownloaded) { [SVProgressHUD showSuccessWithStatus:@"Finished \n downloading"]; } else { [SVProgressHUD dismiss]; [self showEditsInGeodatabaseAsBadge:geodatabase]; UIAlertView* av = [[UIAlertView alloc]initWithTitle:@"Found local data" message:@" It may contain edits or may be out of date. Do you want synchronize it with the service?" delegate:nil cancelButtonTitle:@"Later" otherButtonTitles:@"Yes", nil]; [av showWithCompletion:^(UIAlertView *alertView, NSInteger buttonIndex) { switch (buttonIndex) { case 0: //do nothing break; case 1: //Yes, sync [self syncAction:nil]; break; default: break; } }]; } [self updateUI]; } }]; +(BOOL) renameFile:(NSString *)oldFilePath :(NSString *)newFilePath { //to rename a file just need to move the file to a different name in the same directory. //so the oldFilePath and newFilePath should point to the same directory but wiht different file names. NSFileManager *fileManager = [NSFileManager defaultManager]; NSError *error = nil; bool success = NO; success = [fileManager moveItemAtPath:oldFilePath toPath:newFilePath error:&error]; if(success) { NSLog(@"File renamed."); } else { NSLog(@"%@", [error localizedDescription]); } return success; }
... View more
06-04-2014
07:19 PM
|
0
|
0
|
975
|
|
POST
|
Hi all, We are generating offline geodatabase with the method AGSGDBSyncTask generateGeodatabaseWithParameters. When downloading features we don't want to download existing attachments as it could take ages but do want to add attachment offline. We are able to disable attachment downloading by setting AGSGDBGenerateParameters.returnAttachments = NO. The problem is that if returenAttachment is set to NO , we are not able to add attachment offline. No attachment downloading but able to add attachment offline... How do I achieve this? Thanks, Shimin
... View more
06-03-2014
06:10 PM
|
0
|
6
|
5845
|
|
POST
|
Hi there, Is it possible to export features to GPX or shape file from AGSFeatureLayer and AGSFeatureTableLayer? Any idea? Thanks, Shimin
... View more
06-03-2014
04:50 PM
|
0
|
2
|
6711
|
|
POST
|
Hi, Probably now ESRI does not encourage using the offline capability prior to ArcGIS 10.2 but I started doing offline editing in my app from ArcGIS 10.1 and ESRI iOS SDK 10.1.1. It worked fine in 10.1 and was just recently migrated to 10.2.1... The 10.1 offline editing was based on the ESRI OnlineOfflineEditingSample at the 10.1 time. The sample couldn't be found anymore in the ESRI sample site. So I dug it out from my computer and put a copy in the Dropbox: https://www.dropbox.com/s/10pe58o4hnsfcys/OnlineOfflineEditingSample.zip. (I'm hoping I'm not offending ESRI by doing this...) Basically in this sample, when going offline, it uses a custom class OnlineOfflineFeatureLayer, FeatureLayerDefinition.json, FeatureSet.json to save feature layer definition and features to device and reload the layers and features offline using the json files. It also uses the json files to send local edits to the server when going online... There is a bug showing offline features in this sample and the solution can be found in this thread: http://forums.arcgis.com/threads/81574-Online-Offline-Editing-Sample Hope it helps. Shimin
... View more
05-21-2014
06:23 PM
|
0
|
0
|
1088
|
|
POST
|
Hi, my app always starts up offline if a local geodatabase exists. My local geodatabase is in the app's Documents folder and it loads local data or live data in the viewDidLoad method. Hope it helps. Regards, Shimin. @property (nonatomic, strong) AGSGDBGeodatabase *geodatabase; //in the viewDidLoad NSString *gdbFilePath = [[FCNSWUtils documentsPath] stringByAppendingPathComponent:@"MyLocalDB.geodatabase"]; if([FCNSWUtils fileExist:gdbFilePath]) { [self loadLocalData]; } else { [self takeOnline];//load live data. } -(void)loadLocalData { NSString *gdbFilePath = [[FCNSWUtils documentsPath] stringByAppendingPathComponent:@"MyLocalDB.geodatabase"]; AGSGDBGeodatabase *gdb = [[AGSGDBGeodatabase alloc]initWithPath:gdbFilePath error:nil]; self.geodatabase = gdb; ////Remove all live feature layers if any for (AGSLayer* lyr in self.mapView.mapLayers) { if([lyr isKindOfClass:[AGSFeatureLayer class]]) { [self.mapView removeMapLayer:lyr]; } } //Add local feature/table layers for (AGSFeatureTable* fTable in self.geodatabase.featureTables) { if ([fTable hasGeometry]) { AGSFeatureTableLayer *ftl = [[AGSFeatureTableLayer alloc]initWithFeatureTable:fTable]; ftl.delegate = self; [self.mapView addMapLayer:ftl]; } } [self showEditsInGeodatabaseAsBadge:self.geodatabase]; }
... View more
05-20-2014
03:37 PM
|
0
|
0
|
664
|
|
POST
|
Yes the method "localTiledLayerWithPath:filePath" solved my problem and I agree with Steven that there might be a problem with the "localTiledLayerWithName:fileName" method. Thanks Steven. A strange thing for ESRI to look into: I've been removing and reinstalling the 10.2.3 sdk for five times. At one time the method "localTiledLayerWithName" worked but other times it didn't. It might be an installer issue or a problem with the method. Thanks Divesh for looking into my problem. Cheers, Shimin
... View more
05-06-2014
05:33 PM
|
0
|
0
|
1605
|
|
POST
|
Hi Nimesh, Here is the dropbox link for the two tpks: https://www.dropbox.com/sh/kqbjlri7ie0jl79/sD_rRg0hqy . The tpks are in the spatial reference of 3308 GDA_1994_NSW_Lambert. Thanks a lot for your help. Shimin
... View more
05-01-2014
07:01 PM
|
0
|
0
|
1605
|
|
POST
|
Further, I tried the latest LocalTiledLayerSample and it is experiencing the exactly same problem with my tpks: unable to display the tpks in 10.2.3 and ok with 10.2.2...
... View more
04-30-2014
06:19 PM
|
0
|
0
|
1605
|
|
POST
|
I created a tpk in 10.2.1 arcmap and it didn't work either in the 10.2.3 sdk. But both the 10.1 and 10.2.1 tpks can be displayed in the 10.2.2 sdk. Note that there is no coding involved at all... How do I upload the tpks to esri? Both together is about 140 mb. Thanks, Shimin
... View more
04-30-2014
05:52 PM
|
0
|
0
|
1605
|
|
POST
|
I had the same issue before. I'm using the code below in the app delegation method didFinishLaunchingWithOptions to license my app. Here I used a dummy client id and license code. Hope it helps. Regards, Shimin //License ArcGIS Runtime Standard //set the Client ID first. The client id was issued when registering the app with esri ArcGIS for Developers. NSError *error; NSString *clientID = @"1Fffgff667Loj123"; [AGSRuntimeEnvironment setClientID:clientID error:&error]; if(error) { NSLog(@"Error using client ID: %@", [error localizedDescription]); } //Enable Standard level functionality using the license code KLUJY5D9QW8K5L3BH290. //According to the ESRI Australia support, the license code was generated using ArcGIS Software Authorization Wizard. //The authorization number rud######### is obtained from the Customer Care Portal. //Note: the authorization number is case sensitive. The RUD######### does not work and is displayed in the Customer Care Portal. [[AGSRuntimeEnvironment license]setLicenseCode:@"runtimestandard,101,rud#########,none, KLUJY5D9QW8K5L3BH290"];
... View more
04-30-2014
04:48 PM
|
0
|
0
|
921
|
|
POST
|
Hi, After I migrated my app to the new SDK 10.2.3, my tile packages can no longer be displayed. What I got was just an empty white screen. However, when I rolled back to the SDK 10.2.2, everything is working fine. Any idea? All my tpks were built in 10.1 ArcGIS. Does the new SDK require tpks being built in 10.2 ArcGIS? Thanks, Shimin
... View more
04-28-2014
10:21 PM
|
0
|
9
|
2292
|
|
POST
|
Hi All, Is it possible to build legend from tile package (*.tpk) in code? Our users create their own tpks and want to be able to see the legend for the tpks. Any ideas? Thanks, Shimin
... View more
04-28-2014
08:04 PM
|
0
|
2
|
3441
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-08-2022 01:10 PM | |
| 1 | 09-19-2022 09:21 PM | |
| 1 | 05-23-2022 06:49 PM | |
| 1 | 03-24-2022 05:49 PM | |
| 1 | 10-31-2021 03:16 PM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|