POST
|
the how to : for save NSMutableArray *arrayCarteSauvegarde = [[NSMutableArray alloc] init]; for (int i=0; i <[arrayCarteScolaire count]; i++) { AGSGDBFeature *feat = [arrayCarteScolaire objectAtIndex:i]; NSDictionary *dicFeat = feat.allAttributes; NSDictionary *dicFeat2 = [dicFeat ags_encodeJSON]; NSString *stringJSON = [dicFeat2 ags_JSONRepresentation]; NSLog(@"STRING FEATURE : %@", stringJSON); [arrayCarteSauvegarde addObject:stringJSON]; NSLog(@"%@", feat.geometry); //NSLog(@"JSON : %@", dicFeat2); } BOOL yes = [arrayCarteSauvegarde writeToFile:imageFilePathname atomically:YES]; //BOOL yes = [NSKeyedArchiver archiveRootObject:arrayCarteSauvegarde toFile:imageFilePathname]; //BOOL yes = [dataArray writeToFile:imageFilePathname atomically:YES]; if (yes) { NSLog(@"Fichier %@ créer", imageFilename); } else { NSLog(@"Could not create file -:%@ ",[error2 localizedDescription]); } for load retourCarte = [NSArray arrayWithContentsOfFile:imageFilePathname]; for (int i=0; i<[retourCarte count]; i++) { //Bon on récupère les infos //NSDictionary *dicFeat = [retourCarte objectAtIndex:i]; NSString *testJSON = [retourCarte objectAtIndex:i]; NSLog(@"TEST JSON SHAPE : %@", testJSON); NSDictionary *dicFeat = [testJSON ags_JSONValue]; NSLog(@"DICO JSON : %@", dicFeat); NSDictionary *geoDict = [dicFeat valueForKey:@"shape"]; NSLog(@"SHAPE : %@", geoDict); AGSGeometry *geom = [[AGSGeometry alloc] initWithJSON:geoDict]; NSLog(@"GEOMETRY : %@", geom); AGSMutablePolygon *testTest = [[AGSMutablePolygon alloc] initWithJSON:geoDict]; NSLog(@"POLYGON : %@", testTest); /*NSDictionary *dicFeat2 = [testJSON ags_JSONValue]; //NSLog(@"DIC JASON TRAITER : %@", dicFeat2); feat = [retourCarte objectAtIndex:i]; //NSLog(@"FEAT : %@", feat); feat2.geometry = geom; //NSLog(@"FEAT 2 : %@", feat2); //[arrayCarteScolaire addObject:feat];*/ //AGSGraphic *test = [[AGSGraphic alloc] initWithJSON:geoDict]; AGSGraphic *test = [[AGSGraphic alloc] initWithGeometry:testTest symbol:nil attributes:dicFeat]; NSLog(@"AGSGraphic = %@", test); [arrayCarteScolaire addObject:test]; } Stounfr
... View more
11-12-2015
10:25 AM
|
1
|
0
|
544
|
POST
|
Hi, I want to copy AGSGDBFeature array in the device because i dont what modify the geodatabase. When the user quit the app and reload it, i want that the app charge the geodatabase not modified and if the user want charge the modified Feature the app take the AGSGDBFeature. Stounfr
... View more
11-12-2015
05:36 AM
|
0
|
1
|
544
|
POST
|
Hi, i have a NSMutableArray whit Feature and i want to write the NSMutableArray to my NSDocumentDirectory. my code : NSLog(@"ARRAY CARTE SCOLAIRE :%@", arrayCarteScolaire); NSArray *arrayCarteSauvegarde = [[NSArray alloc] initWithArray:arrayCarteScolaire]; NSLog(@"ARRAY SAUVEGARDE :%@", arrayCarteSauvegarde); NSString* imageFilename = [NSString stringWithFormat:@"SAUVEGARDE CARTE %@", anneeChoisiTab]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString* imageFilePathname = [documentsDirectory stringByAppendingPathComponent:imageFilename]; //on fait la verif pour voir s'il y a les images du bundle dans le DocumentDirectory if ([[NSFileManager defaultManager] fileExistsAtPath:imageFilePathname]) { NSLog(@"Fichier %@ déjà présent dans le dossier document - Voir pour la modification", imageFilename); //on efface et on copie NSError *error; BOOL success = [[NSFileManager defaultManager] removeItemAtPath:imageFilePathname error:&error]; if (success) { NSLog(@"Le fichier %@ a bien été effacé", imageFilename); //UIAlertView *removeSuccessFulAlert=[[UIAlertView alloc]initWithTitle:@"Congratulation:" message:@"Successfully removed" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil]; //[removeSuccessFulAlert show]; } else { NSLog(@"Could not delete file -:%@ ",[error localizedDescription]); } //on copie le fichier NSError *error2; BOOL yes = [arrayCarteSauvegarde writeToFile:imageFilePathname atomically:YES]; if (yes) { NSLog(@"Fichier %@ créer", imageFilename); } else { NSLog(@"Could not create file -:%@ ",[error2 localizedDescription]); } } else { NSLog(@"Fichier %@ non présent dans le dossier document", imageFilename); //on va copier le fichier normalement NSError *error2; BOOL yes = [arrayCarteSauvegarde writeToFile:imageFilePathname atomically:YES]; //BOOL yes = [NSKeyedArchiver archiveRootObject:arrayCarteSauvegarde toFile:imageFilePathname]; if (yes) { NSLog(@"Fichier %@ créer", imageFilename); } else { NSLog(@"Could not create file -:%@ ",[error2 localizedDescription]); } } The file is not create in the document directory but no crash. With this code : else { NSLog(@"Fichier %@ non présent dans le dossier document", imageFilename); //on va copier le fichier normalement NSError *error2; //BOOL yes = [arrayCarteSauvegarde writeToFile:imageFilePathname atomically:YES]; BOOL yes = [NSKeyedArchiver archiveRootObject:arrayCarteSauvegarde toFile:imageFilePathname]; if (yes) { NSLog(@"Fichier %@ créer", imageFilename); } else { NSLog(@"Could not create file -:%@ ",[error2 localizedDescription]); } } The app crash with this error : 2015-11-10 13:42:59.243 Ecoles Colleges 06 Antibes[211:11878] -[AGSGDBFeature encodeWithCoder:]: unrecognized selector sent to instance 0x1742a05a0 2015-11-10 13:42:59.245 Ecoles Colleges 06 Antibes[211:11878] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AGSGDBFeature encodeWithCoder:]: unrecognized selector sent to instance 0x1742a05a0' Thanks for regards. Stounfr
... View more
11-10-2015
10:20 AM
|
0
|
3
|
3707
|
POST
|
Hi david, i have look the GeometryEngine but i'have not see that i want. I've the sdk version 10.2.4
... View more
09-14-2015
09:03 AM
|
0
|
1
|
410
|
POST
|
Hello, I wonder if it was possible to modify the code by neighboring feature geometries in a geometry changed Sketchgraphic layer . I would like the neighboring geometries modified geometry is modified to fit the shape of the geometry. thank you in advance image sample : Geometry change with sketch graphic - A Stéphane
... View more
09-14-2015
08:23 AM
|
0
|
3
|
2366
|
POST
|
Hello, I have a problem to decode the shape attribute for adding the feature.geometry on a graphic layer. Code for iOS : -(void)resultatRecherche{ //on affiche le quartier qui est associé au nom recherche featureForArray = [arrayQuartierRechercher objectAtIndex:0]; NSLog(@"feature rechercher : %@", featureForArray); //NSLog(@"Geometry : %@", featureForArray.geometry.ags_JSONRepresentation); //on essaye de redefinir les infos de shape //NSString *shape = [featureForArray valueForKey:@"shape"]; //NSString* jsonPointAsString = @"{ \"x\" : -118.4 , \"y\" : -45.2 , \"spatialReference\" : {\"wkid\" : 4326} }"; //NSDictionary *json = [jsonPointAsString AGSJSONValue]; //AGSPoint* point = [[AGSPoint alloc] initWithJSON:json]; //AGSGeometry *testGeo = [featureForArray valueForKey:@"shape"]; //featureForArray.geometry = testGeo; AGSSimpleFillSymbol *innerSymbol = [AGSSimpleFillSymbol simpleFillSymbol]; innerSymbol.color = [[UIColor redColor] colorWithAlphaComponent:0.80]; innerSymbol.outline = nil; //graphicSelect = [AGSGraphic graphicWithGeometry:featureForArray.geometry symbol:innerSymbol attributes:nil]; //[myGraphicsLayer addGraphic:graphicSelect]; } Result on iPad logs : 2015-03-02 16:55:40.587 CM 99[3226:951335] feature rechercher : { "code_insee" = "'97117'"; date = "'2008-10-24 00:00:00'"; "ident_section" = "'97117AR'"; nom = "'Loreal'"; "numero_section" = "'AR'"; objectid = "\\n'12'"; origine = "'URBIS'"; shape = "'050300007C000000080010006C7F0000AD0B000001000000BFFBAFF9AF038EBFD9B0EF06A7F32CE2D376B4BE12C2FE8901FFF507F0993700C5D631F5C80AC1FF44B4BE12DDFD44B3FC23F6BC0F87F808C6EC03B5CC4CCAA308A4DF3C8E840BBFAA47CAA3088ABB37009BA40597B129FFF507BE932CB6C80A85D6319AA40585D631A3C70AA6F62EB6C80A94D026B1AA22BF8916BBFE24BF8916A8816782F52E82983283E1028C8467C3E102B09632CD8E2184AC22EEA408949932BCA813BFF50785D63190ED0FBABC3FF4BE12BE932CA4D10286D6318FE317BBA813B2B85C808A16A7F32CCBA308A6903AF08F2195FC24CBA308B9EA3483EB18999A0DBF8916BFF5078AAD1ED99A0D89AD1ECDCF2781FF44F6D20293D026B5C80A8ECF1B999A0D9FE9188ED91F83EB18BA8267B08F21A7F32CC3E102AA871DF8C710B2AA22CD8E2188D844CF8350B3B41AE38B16AB911587C205BCE117A38B16E4D1028D8E21A4D1028D8E2186B61A81F52E88A305B7DB3CFEEB0F86CC1BF2AA2295C610D38F3ABAB229D38F3A91EF23CFE317CE840BE4DF3C8E840BDEC62FCBA308FAF42C9FB429FEF507808A16F4BE128AA308DA9A0DC4E102FFF50791EF23FFF50782EB18CEE31786CC1BE9FD24BF8916CDD91F87C205EB9115D1E50DEA871DC1FF44CEE317C7C205D7861DC3E102EA871DBCA813AB911587C20598901594C610B2AA22B8C710999A0D86CC1BB7D2028AAD1E9AA405ADAE1EEB9B0D8AAD1EB6D20289AD1EF5C80A90EF23D9901597FC39CEE31798A713CED91FB5E60DF3B41A8AAD1ED89015B1850BCBEC3496BB3FCCCF2790F939C29832AEA408F3B41AC3EB18C6B61AC3E102E9871D8AA308F3B41A8E840BCED91FABC305DFE5298F1FEC991DF2D30AEBF0109BA405ECB708EBDD1FC9AF1EF6B238D48620C3E326EBF010D0B91AE7CE17F2F516F7F116DFE51FBBE609FBCD4DEDE805F99D12D1FA8201F8CD2DF7BE71D7BD24F09A5AD9B821B0C50EDAAE1BEAF642F5DC36E4A777DD9F12C0D54BFD8E09EBC71BF4B10EAAE808CFD324A5E934FAC59A019EC62FF8DA81019FD027D0F87E83A22AEFAD63'"; "source_geometrique" = "'-pci_dxf'"; x = "'677087.24670071'"; y = "'1805011.62693986'"; } with this code the app crash : -(void)resultatRecherche{ //on affiche le quartier qui est associé au nom recherche featureForArray = [arrayQuartierRechercher objectAtIndex:0]; NSLog(@"feature rechercher : %@", featureForArray); //NSLog(@"Geometry : %@", featureForArray.geometry.ags_JSONRepresentation); //on essaye de redefinir les infos de shape //NSString *shape = [featureForArray valueForKey:@"shape"]; //NSString* jsonPointAsString = @"{ \"x\" : -118.4 , \"y\" : -45.2 , \"spatialReference\" : {\"wkid\" : 4326} }"; //NSDictionary *json = [jsonPointAsString AGSJSONValue]; //AGSPoint* point = [[AGSPoint alloc] initWithJSON:json]; //AGSGeometry *testGeo = [featureForArray valueForKey:@"shape"]; //featureForArray.geometry = testGeo; AGSSimpleFillSymbol *innerSymbol = [AGSSimpleFillSymbol simpleFillSymbol]; innerSymbol.color = [[UIColor redColor] colorWithAlphaComponent:0.80]; innerSymbol.outline = nil; graphicSelect = [AGSGraphic graphicWithGeometry:featureForArray.geometry symbol:innerSymbol attributes:nil]; [myGraphicsLayer addGraphic:graphicSelect]; } with this logs : 2015-03-02 16:42:44.378 CM 99[3188:948468] -[__NSDictionaryI geometry]: unrecognized selector sent to instance 0x1781a9760 2015-03-02 16:42:44.381 CM 99[3188:948468] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI geometry]: unrecognized selector sent to instance 0x1781a9760' *** First throw call stack: (0x186e25e48 0x197a740e4 0x186e2cf14 0x186e29cc4 0x186d2ec1c 0x1000e35bc 0x1000e395c 0x197f0fca0 0x187cfedb8 0x187cfef44 0x1000e3430 0x1000e82a4 0x187cdb508 0x187c2cc94 0x187c1c61c 0x187cde26c 0x1018ccdf0 0x1018d175c 0x186ddd6a0 0x186ddb748 0x186d091f4 0x18fe835a4 0x18b63a784 0x1000e95b8 0x1980e2a08) libc++abi.dylib: terminating with uncaught exception of type NSException Any idea ? Stephane
... View more
03-03-2015
04:55 AM
|
0
|
1
|
4133
|
POST
|
Hello, Thanks for the answer. For the first question, it's ok. I use the fonction : - (void)mapView:(AGSMapView *)mapView didClickAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint features:(NSDictionary *)features{ [self.localFeatureTableLayer clearSelection]; if (features){ for (AGSGDBFeature *feature in [features valueForKey:@"Local Data Bati"]) { [self.localFeatureTableLayer setSelected:YES forFeature:feature]; NSLog(@"Feature selectionner BATI Local"); } } } For the second question, i have a problem. I use this code for obtain the number of fields and the number of lines in the table but i don't understand how to obtain the data line. NSLog(@"%lu collones", (unsigned long)featureServiceTable.fields.count); NSLog(@"%lu", (unsigned long)localFeatureTableLayer.table.featureCount); NSLog(@" Traitement base"); arrayPrincipal = [[NSMutableArray alloc] init]; int i2 = 1; for (int i = 0; i < (localFeatureTableLayer.table.featureCount); i++) { NSLog(@" Traitement fiche : %i", i); //AGSGraphic* graphic = [localFeatureTableLayer select:i2]; //featureForArray = [localFeatureTableLayer select:i2]; //NSLog(@"%@", graphic); i2 ++; } Stephane
... View more
12-09-2014
04:28 AM
|
0
|
0
|
432
|
POST
|
Bonjour, Nouveau dans la communauté esri, je travaille pour un bureau d'urbanisme qui utilise les outils d'esri. Je développe des applications pour iPad et pour les besoins d'un projet, je me suis mis a regarder le sdk arcgis pour iOS. Pas trop de soucis jusqu'à présent mais deux questions : • Est-il possible de modifier la couleur ou le contour d'un polygone lorsque l'on fait un callout dessus ? (j'arrive bien a afficher les infos lié à ce polygone mais je ne trouve rien pour lui changer la couleur lorsqu'il est sélectionné) • Est-il possible de copier les données d'une table dans un NSArray ? Cordialement Stéphane Sotlar
... View more
11-26-2014
07:04 AM
|
0
|
2
|
2912
|
Title | Kudos | Posted |
---|---|---|
1 | 11-12-2015 10:25 AM |
Online Status |
Offline
|
Date Last Visited |
12-13-2023
09:05 PM
|