POST
|
The iOS API 2.1 says: "The envelope property on AGSMapView has been deprecated and replaced by visibleArea to take into account map rotation." When I change to : AGSEnvelope *env = self.mapView.visibleArea; I get this error: Incompatible pointer types initializing 'AGSEnvelope *' with an expression of type 'AGSPolygon *' Nimesh : Your answer was The visibleArea returns AGSPolygon and you are trying to save it as AGSEnvelope. Hence the error. If you want envelope then change code line as following, AGSEnvelope *env = self.mapView.visibleArea.envelope; I tried this, and now I get an EXC Bad Access error on the zoom to envelope call. I do this: AGSEnvelope *env = self.mapView.visibleArea.envelope; then this: // remove all layers from the mapView [self.mapView reset]; // add the layers back in with the correct order if (_currentTMS.loaded == YES){ [self.mapView addMapLayer:_currentTMS withName:@"tiledLayer"]; } [self.mapView addMapLayer:baseLayer withName:@"baseLayer"]; [self.mapView addMapLayer:_currentFMS withName:@"featureLayer"]; [self.mapView addMapLayer:_currentGL withName:@"Parcel Outline Graphics Layer"]; [self.mapView zoomToEnvelope:env animated:NO]; the error is onthe zoomToEnvelope. This all worked fine when it was just AGSEnvelope *env = self.mapView.envelope; Any suggestions?
... View more
11-22-2011
07:43 AM
|
0
|
4
|
2191
|
POST
|
Nimesh, The iOS API 2.1 says: "The envelope property on AGSMapView has been deprecated and replaced by visibleArea to take into account map rotation." When I change to : AGSEnvelope *env = self.mapView.visibleArea; I get this error: Incompatible pointer types initializing 'AGSEnvelope *' with an expression of type 'AGSPolygon *'
... View more
11-22-2011
04:46 AM
|
0
|
0
|
480
|
POST
|
Thanks for the clarification! I'll give it a try and report back.
... View more
10-03-2011
10:18 AM
|
0
|
0
|
225
|
POST
|
OK. This post incorporates many different versions of the API, etc. I just tried to follow this and my head is spinning. Nimesh, can you please piece this together and show us how in the most recent API I (we) can get access to the current layers that are visible and drawn on the map in a map service. (not the default visible property on the layer). I would be VERY appreciative of this. Thanks!
... View more
10-01-2011
08:28 PM
|
0
|
0
|
225
|
POST
|
Answered my own question. After getting the buffer geometry, run a spatial selection using a querytask : mPolygon is the geometry of the buffer I already did. //set up query task against layer, specify the delegate self.queryTask = [AGSQueryTask queryTaskWithURL:[NSURL URLWithString:countiesLayerURL]]; self.queryTask.delegate = self; self.query = [AGSQuery query]; self.query.outFields = [NSArray arrayWithObjects:@"*", nil]; self.query.returnGeometry = YES; self.query.geometry = mPolygon; self.query.spatialRelationship = AGSSpatialRelationshipIntersects; [self.queryTask executeWithQuery:self.query];
... View more
09-28-2011
08:32 AM
|
0
|
0
|
301
|
POST
|
Thanks Nimesh I tried that - I used -bufferGeometry:byDistance: That still only returned a polygon. I want to take that polygon and find the parcels below it that it intersects. Am I on the right path?
... View more
09-28-2011
07:27 AM
|
0
|
0
|
301
|
POST
|
Can the #Esri iOS API do a buffer on a polygon feature or graphics point - and spatially select the polygon features that the buffer intersects? (Like a traditional Buffer in GIS). So, not just return a graphic of a distance around a point - Can it actually do the spatial selection ?
... View more
09-27-2011
04:59 PM
|
0
|
4
|
2414
|
POST
|
Hi Nimesh Spatial Feature of the FService is : 2249 The spatial ref of my mapview is the same (2249). The process runs, no errors are thrown. However, the feature with its symbology don't show in my map as it does in the example and when I open the Feature Class in SDE and I see the attributes, but there is no geometry. I've attached the editresults during debug. Also, I'm using my own map service not webmap. AGSMapServiceInfo *bms = [[[AGSMapServiceInfo alloc] initWithURL:[NSURL URLWithString:baseLayerURL] error:&error] autorelease]; AGSDynamicMapServiceLayer *baseLayer = [[AGSDynamicMapServiceLayer alloc] initWithMapServiceInfo:bms]; also at didSelectFeatureTemplate //set the active feature layer to the one we are going to edit self.activeFeatureLayer = featureLayer; //create a new feature based on the template _newFeature = [self.activeFeatureLayer createFeatureWithTemplate:template]; [self.activeFeatureLayer addGraphic:_newFeature]; AGSGraphic *gr = _newFeature; self.popupInfo = [AGSPopupInfo popupInfoForGraphic: gr]; self.popupInfo.allowEditGeometry = YES; self.popupInfo.showAttachments = YES; //Filter the fields we want to display to the user NSMutableArray* fieldInfos = [self.popupInfo.fieldInfos mutableCopy]; NSMutableArray* displayFields = [[[NSMutableArray alloc] init] autorelease]; NSArray* inspectiondisplayeditfields = [[[NSArray alloc] init] autorelease]; inspectiondisplayeditfields = self.fieldsForEditing; for (AGSPopupFieldInfo* fieldInfo in fieldInfos) { for (int i = 0 ; i < [inspectiondisplayeditfields count] ; i++) { if ([fieldInfo.fieldName isEqualToString:[inspectiondisplayeditfields objectAtIndex:i]]) { [displayFields addObject:fieldInfo]; } } } self.popupInfo.fieldInfos = displayFields; //Show popup for the graphic because the user tapped on the callout accessory button self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithPopupInfo:_popupInfo graphic:gr usingNavigationControllerStack:NO] autorelease]; self.popupVC.delegate = self; self.popupVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; //If iPad, use a modal presentation style if([[UIDevice currentDevice] isIPad]) self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet; // //First, dismiss the Feature Template Picker [self dismissModalViewControllerAnimated:NO]; [self presentModalViewController:self.popupVC animated:YES]; [self.popupVC startEditingCurrentPopup]; [fieldInfos release];
... View more
09-26-2011
12:25 PM
|
0
|
0
|
349
|
POST
|
Update on what's happening. After I click 'Sketch Done', the sketch disappears, but the Feature Symbology (From the template) does not show up. I'm getting no errors, and stepping through the code, it seems that everything is happening as it should. 😞
... View more
09-19-2011
01:57 PM
|
0
|
0
|
349
|
POST
|
Hi I'm attempting to use the FeatureEditingSample codebase to add a point feature to my map. (I changed the code to not use a WebMap, but rather a Feature Service). The code is executing, and a new record with an ObjectID all of the attributes are being posted to ArcSDE, but there is no geometry associated with it, so the point won't display on the map, of course. Is there something special I have to do when working with a Point Feature Class when using the FeatureEditing Code Sample?
... View more
09-19-2011
01:29 PM
|
0
|
7
|
851
|
POST
|
In the offline editing sample, is any special type of Map Service required in order to store the basemap on the iOS device? I guess what I don't understand is how are you ensuring that the iOS device is storing that basemap information as well as the feature service features when it goes offline?
... View more
09-19-2011
06:17 AM
|
0
|
1
|
427
|
POST
|
Could someone please instruct me on the proper way to remove layers from my mapView and replace them with new layers? I've tried a multitude of ways, and none works consistently. I get strange 'EXC_BAD_ACCESS' errors, or it will work twice, but on the 3rd time ALWAYS bombs. Here's what I'm trying to do - I initialize my map with 2 layers, a Base Layer and a Feature Layer. Then, during runtime, I want to remove those two layers and add in two new ones. Initial Set up Code: //Set up the map view self.mapView.layerDelegate = self; self.mapView.touchDelegate = self; self.mapView.calloutDelegate = self; self.mapView.showMagnifierOnTapAndHold = YES; // Add the Feature Layer to the mapView NSURL* url = [NSURL URLWithString: featureLayerURL]; self.featureLayer = [AGSFeatureLayer featureServiceLayerWithURL: url mode: AGSFeatureLayerModeOnDemand]; [self.mapView addMapLayer:self.featureLayer withName:@"featureLayer"]; // Create dynamic map service info with URL of base map AGSMapServiceInfo *bms = [[[AGSMapServiceInfo alloc] initWithURL:[NSURL URLWithString:baseLayerURL] error:&error] autorelease]; AGSDynamicMapServiceLayer *baseLayer = [[AGSDynamicMapServiceLayer alloc] initWithMapServiceInfo:bms]; // Add base layer to the mapView [self.mapView addMapLayer:baseLayer withName:@"baseLayer"]; No problems there. Then, in runtime, if the mapView has already been initialized I do this: [self.mapView reset]; // Add the Feature Layer to the mapView NSURL* url = [NSURL URLWithString: featureLayerURL]; self.featureLayer = [AGSFeatureLayer featureServiceLayerWithURL: url mode: AGSFeatureLayerModeOnDemand]; [self.mapView addMapLayer:self.featureLayer withName:@"featureLayer"]; self.featureLayer.infoTemplateDelegate = self.featureLayer; // Create dynamic map service info with URL of base map AGSMapServiceInfo *bms = [[[AGSMapServiceInfo alloc] initWithURL:[NSURL URLWithString:baseLayerURL] error:&error] autorelease]; AGSDynamicMapServiceLayer *baseLayer = [[AGSDynamicMapServiceLayer alloc] initWithMapServiceInfo:bms]; [self.mapView addMapLayer:baseLayer withName:@"baseLayer"]; This works SOME times, and then IF it works, it only works twice. On the third execution it always fails. In case you're wondering, the line it fails on is the one with the self.featureLayer self.featureLayer = [AGSFeatureLayer featureServiceLayerWithURL: url mode: AGSFeatureLayerModeOnDemand]; I have also tried to just remove the layers, and add them back in [self.mapView removeMapLayerWithName:@"featureLayer"]; [self.mapView removeMapLayerWithName:@"baseLayer"]; // Add the Feature Layer to the mapView NSURL* url = [NSURL URLWithString: featureLayerURL]; AGSFeatureLayer *tmpFeatureLayer = [[AGSFeatureLayer alloc] initWithURL:url mode:AGSFeatureLayerModeOnDemand]; [self.mapView addMapLayer:tmpFeatureLayer withName:@"featureLayer"]; // Create dynamic map service info with URL of base map AGSMapServiceInfo *bms = [[[AGSMapServiceInfo alloc] initWithURL:[NSURL URLWithString:baseLayerURL] error:&error] autorelease]; AGSDynamicMapServiceLayer *baseLayer = [[AGSDynamicMapServiceLayer alloc] initWithMapServiceInfo:bms]; [self.mapView addMapLayer:baseLayer withName:@"baseLayer"]; While this method works solid EVERY TIME, because I'm not setting the self.featureLayer info that I am in the first way of doing it - the if statement in the didLoadLayerForLayerView delegate call is never met, so therefore, the infoTemplateDelegate is never set, and I have no popup info windows on my newly added Feature Layer. -(void)mapView:(AGSMapView *)mapView didLoadLayerForLayerView:(UIView <AGSLayerView>*)layerView{ //grab the feature layer if (layerView.agsLayer == self.featureLayer){ AGSFeatureLayer *tmpfeatureLayer = (AGSFeatureLayer *)layerView.agsLayer; //set the feature layer as its infoTemplateDelegate //this will then automatically set the callout's title to a value //from the display field of the feature service tmpfeatureLayer.infoTemplateDelegate = tmpfeatureLayer; //Get all the fields tmpfeatureLayer.outFields = [NSArray arrayWithObject:@"*"]; //This view controller should be notified when features are edited tmpfeatureLayer.editingDelegate = self; [tmpfeatureLayer release]; } } If someone can tell me the proper way to do this, I would be VERY appreciative.
... View more
08-17-2011
04:22 AM
|
0
|
1
|
2055
|
POST
|
Does anyone know how to properly filter the list of fields to display in the PopupInfo? Here is the code that sends all fields in the Feature Class off to the popupViewController -(void)mapView:(AGSMapView *)mapView didClickCalloutAccessoryButtonForGraphic:(AGSGraphic *)graphic{ self.popupInfo = [AGSPopupInfo popupInfoForGraphic: graphic]; self.popupInfo.allowEditGeometry = NO; //Show popup for the graphic because the user tapped on the callout accessory button self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithPopupInfo:_popupInfo graphic:graphic usingNavigationControllerStack:NO] autorelease]; self.popupVC.delegate = self; self.popupVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; //If iPad, use a modal presentation style if([[UIDevice currentDevice] isIPad]) self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet; [self presentModalViewController:self.popupVC animated:YES]; [self.popupVC startEditingCurrentPopup]; } I want to only show Two fields, instead of all of the fields in the Feature Service Feature Class that "graphic" represents. The class reference is here: (Search for AGSPopupInfo) http://help.arcgis.com/en/arcgismobile/10.0/apis/iOS/2.0/reference/index.html It says to set the description to nil and then send it an NSArray of fields. I try that, but get an error (see below for error). -(void)mapView:(AGSMapView *)mapView didClickCalloutAccessoryButtonForGraphic:(AGSGraphic *)graphic{ self.popupInfo = [AGSPopupInfo popupInfoForGraphic: graphic]; self.popupInfo.allowEditGeometry = NO; NSMutableArray *items = [[NSMutableArray alloc] init]; [items addObject:@"OBJECTID"]; [items addObject:@"STATUS"]; self.popupInfo.description = nil; self.popupInfo.fieldInfos = items; [items release]; //Show popup for the graphic because the user tapped on the callout accessory button self.popupVC = [[[AGSPopupsContainerViewController alloc] initWithPopupInfo:_popupInfo graphic:graphic usingNavigationControllerStack:NO] autorelease]; self.popupVC.delegate = self; self.popupVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; //If iPad, use a modal presentation style if([[UIDevice currentDevice] isIPad]) self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet; [self presentModalViewController:self.popupVC animated:YES]; [self.popupVC startEditingCurrentPopup]; } When I run this, I get the following error: 2011-08-12 11:52:04.891 FeatureLayerEditingSample[16177:207] -[NSCFString isVisible]: unrecognized selector sent to instance 0x60f5c4 2011-08-12 11:52:04.940 FeatureLayerEditingSample[16177:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString isVisible]: unrecognized selector sent to instance 0x60f5c4' Any ideas?
... View more
08-12-2011
08:01 AM
|
0
|
3
|
831
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|