POST
|
If I do not put my clientid in between ’<‘ and ‘>’, it gives EXC_BAD_ACCESS. I wonder if I need to put my clientid in between ‘<‘ and ‘>’(If I put it in ‘<‘ and ‘>’, I do not get EXC_BAD_ACCESS but it says my client id is invalid but it should be valid..) I am trying to add the client id to remove 'Developer Use Only' mark by using the following code: NSString* clientID = @"<XYZ>"; [AGSRuntimeEnvironment setClientID:clientID error:&error]; if(error){ // We had a problem using our client ID NSLog(@"Error using client ID : %@",[error localizedDescription]); }
... View more
04-23-2015
01:57 AM
|
0
|
1
|
3483
|
POST
|
Excellent! Thank you very much. UIGetScreenImage() worked for me too.
... View more
08-13-2013
11:19 AM
|
0
|
0
|
369
|
POST
|
Hey Guys, I have followed the above example and tried moving the renderers around. Like some of the other comments the code works great in the simulator but when I put it onto my iPad, I get a black image. Has anyone figured this out? I am sure I am just doing something wrong. Cheers, Jeff On the device, try sending the app to the background and bringing it back to the foreground. For some reason, it starts working after bringing the app back from the background.. I am looking forward to get an answer/comment from ArcGIS team on this issue.
... View more
08-09-2013
09:59 AM
|
0
|
0
|
712
|
POST
|
I use the getImage method from bernese. I use it in this manner: //export image of mapView
UIImage *screenshot = [[UIImage alloc] initWithData:[self getImage]];
//save image to photo album
UIImageWriteToSavedPhotosAlbum(screenshot,self,@selector(image:didFinishSavingWithError:contextInfo:),nil);
Edit: I do not have any code similar to the DrawableProperty snippet you included. Thank you very much for your reply. I noticed that the code starts working if you send the app to the background and bring it back. It is weird but it starts working correctly after sending the app to the background and getting it back to the foreground but it does not work before doing it, it just shows blank image..
... View more
08-01-2013
11:56 AM
|
0
|
0
|
369
|
POST
|
This question has been asked before and answered (for example: http://forums.arcgis.com/threads/78166-How-to-save-screenshot-of-AGSMapView). However, the solution provided returns a black blank image on iOS 6 when used on a device (it works on the simulator). The suggestion to fix the problem on the device is to try use the following code: CAEAGLLayer *eaglLayer = (CAEAGLLayer *) self.mapView.layer;
eaglLayer.drawableProperties = @{
kEAGLDrawablePropertyRetainedBacking: [NSNumber numberWithBool:YES],
kEAGLDrawablePropertyColorFormat: kEAGLColorFormatRGBA8
};
However, it did not work for me. I would really appreciate if someone can share a solution for this problem.. Note: Latest ArcGIS SDK, I am using is:Version 10.1.1 Update 1 Thanks!
... View more
07-31-2013
07:15 AM
|
0
|
4
|
696
|
POST
|
Thanks a lot for this... However this only works in the simulator but the same code returns a blank screen in the device. Any idea why this might be.\ Thanks again Have you solved this problem? I am facing the same issue (not working on the device) and moving the following code did not help as suggested: CAEAGLLayer *eaglLayer = (CAEAGLLayer *) theMap.layer;
eaglLayer.drawableProperties = @{
kEAGLDrawablePropertyRetainedBacking: [NSNumber numberWithBool:YES],
kEAGLDrawablePropertyColorFormat: kEAGLColorFormatRGBA8
};
I would appreciate if you could share your solution. Thanks.
... View more
07-31-2013
06:59 AM
|
0
|
0
|
712
|
POST
|
Hi Divesh, Do you know any ideas or a solution for this. Can we expect a fix soon for this or do we need to use AGSSimpleMarkerSymbol instead of AGSPictureMarkerSymbol for now? Thanks, Oguzhan.
... View more
07-10-2013
06:43 AM
|
0
|
0
|
367
|
POST
|
The quality of the image drawn on the map becomes significantly low for the same code after upgrading the SDK to 10.1.1. I copy/paste the code below. Orange.png is a 90x90 pixel image. Its size is adjusted based on the diameter parameter. As the diameter gets smaller, the image's quality becomes lower. Should I use a bigger image? Is there any parameters that I need to set to improve the quality? (I tried setting graphicsLayer.renderNativeResolution to FALSE/TRUE but it did not change anything..) NSString *imageName = @"Orange.png";
// Creates a custom marker symbol with the picture
AGSPictureMarkerSymbol *myMarkerSymbol = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:imageName];
// Adjust the size for the node
myMarkerSymbol.size = CGSizeMake( diameter, diameter );
// Converts latitude and longitude values to mercator
double num = longtitude * 0.017453292519943295;
double x = 6378137.0 * num;
double a = latitude * 0.017453292519943295;
double mercatorX = x;
double mercatorY = 3189068.5 * log((1.0 + sin(a))/(1.0 - sin(a)));
//Create an AGSPoint (which inherits from AGSGeometry) that
//defines where the Graphic will be drawn
AGSPoint* myMarkerPoint = [AGSPoint pointWithX:mercatorX
y:mercatorY
spatialReference:self.mapView.spatialReference];
//NodeInfoTemplate handles what needs to be written in the callout window
NodeInfoTemplate *template = [[NodeInfoTemplate alloc] init];
//Create the Graphic, using the symbol and geometry created earlier
AGSGraphic* myGraphic =[AGSGraphic graphicWithGeometry:myMarkerPoint
symbol:myMarkerSymbol
attributes:nodeDict
infoTemplateDelegate:template];
//Add the graphic to the Graphics layer
[self.graphicsLayer addGraphic:myGraphic];
... View more
07-05-2013
11:11 AM
|
0
|
3
|
708
|
POST
|
I figured out what I was doing wrong.. I was reinitializing the graphics layer while I should not: self.graphicsLayer = [AGSGraphicsLayer graphicsLayer]; I was using the following code to remove previous graphics in the old SDK: [self.graphicsLayer.graphics removeAllObjects]; After the upgrade, I figured, I need to use the following code instead: [self.graphicsLayer removeAllGraphics]; I hope this helps to somebody..
... View more
07-05-2013
09:12 AM
|
0
|
0
|
197
|
POST
|
I searched for an answer about this issue but could not find.. I upgraded the SDK to 10.1.1 and now graphics that I add to the graphics layer do not show up. I am copy pasting my code below. I removed [graphicsLayer dataChanged] method call since it is removed with the new SDK. ============ NSString *imageName = @"Orange.png"; // Creates a custom marker symbol with the picture AGSPictureMarkerSymbol *myMarkerSymbol = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:imageName]; // Gets the size for the node float diameter = 50.0; myMarkerSymbol.size = CGSizeMake( diameter, diameter ); // Converts latitude and longitude values to mercator double num = longtitude * 0.017453292519943295; double x = 6378137.0 * num; double a = latitude * 0.017453292519943295; double mercatorX = x; double mercatorY = 3189068.5 * log((1.0 + sin(a))/(1.0 - sin(a))); //Create an AGSPoint (which inherits from AGSGeometry) that //defines where the Graphic will be drawn AGSPoint* myMarkerPoint = [AGSPoint pointWithX:mercatorX y:mercatorY spatialReference:self.mapView.spatialReference]; //NodeInfoTemplate handles what needs to be written in the callout window NodeInfoTemplate *template = [[NodeInfoTemplate alloc] init]; //Create the Graphic, using the symbol and geometry created earlier AGSGraphic* myGraphic =[AGSGraphic graphicWithGeometry:myMarkerPoint symbol:myMarkerSymbol attributes:nodeDict infoTemplateDelegate:template]; //Add the graphic to the Graphics layer [self.graphicsLayer addGraphic:myGraphic]; ============ Note that I removed the following line since dataChanged method is removed with the new SDK. [self.graphicsLayer dataChanged];
... View more
07-05-2013
08:37 AM
|
0
|
1
|
721
|
POST
|
That's it! It worked.. You are the MAN! 🙂 Much appreciated, Regards. Okay, what is the spatial reference of the map (self.mapView.spatialReference)? What is the spatial reference of the geometries returned by query task? If they are different then you should set out spatial reference to self.mapView.spatialReference of the query so server return geometries in map's spatial reference. query.outSpatialReference = self.mapView.spatialReference; Regards, Nimesh
... View more
10-12-2012
02:36 PM
|
0
|
0
|
459
|
POST
|
Thanks again for your answer. I read the documentation and I think everything I do (with your help) looks correct. However, it still do not work. I tried so many things.. To see if I can draw a line on the graphics layer, I tried the following and it worked. But it does not work with the graphics from queryTask.
AGSMutablePolyline *polyline = [[AGSMutablePolyline alloc] initWithSpatialReference:self.mapView.spatialReference];
[polyline addPathToPolyline];
[polyline addPointToPath:myPoint1];
[polyline addPointToPath:myPoint2];
AGSGraphic *poly = [[AGSGraphic alloc] initWithGeometry:polyline
symbol:[AGSSimpleLineSymbol simpleLineSymbolWithColor:[UIColor blackColor]]
attributes:nil
infoTemplateDelegate:nil];
[self.graphicsLayer addGraphic:poly];
[poly release];
Thanks for you time, Regards. I said, "If returned graphics has polygon geometry then do this." but since geometry is polyline you should create simple line symbol. Just use below code and it will handle all type of geometry. - (void)queryTask:(AGSQueryTask *)queryTask operation:(NSOperation *)op didExecuteWithFeatureSetResult:(AGSFeatureSet *)featureSet {
[self.graphicsLayer removeAllGraphics];
AGSSimpleFillSymbol *simpleFillSymbol = [AGSSimpleFillSymbol simpleFillSymbol];
for (AGSGraphic *graphic in featureSet.features) {
if ([graphic.geometry isKindOfClass:[AGSPoint class]] || [graphic.geometry isKindOfClass:[AGSMultipoint class]]) {
graphic.symbol = [AGSSimpleMarkerSymbol simpleMarkerSymbol];
}
else if ([graphic.geometry isKindOfClass:[AGSPolyline class]]) {
graphic.symbol = [AGSSimpleLineSymbol simpleLineSymbol];
}
else if ([graphic.geometry isKindOfClass:[AGSPolygon class]]) {
graphic.symbol = [AGSSimpleFillSymbol simpleFillSymbol];
}
graphic.visible = YES;
[self.graphicsLayer addGraphic:graphic];
}
[self.graphicsLayer dataChanged];
} Also, go through working with symbols and renderer documentation. That'll help you understand everything. Regards, Nimesh
... View more
10-12-2012
01:39 PM
|
0
|
0
|
459
|
POST
|
Thanks for your reply. The geometry is esriGeometryPolyline. I tried what you recommended but it didn't work. Then I checked graphicsLayer's renderer. It is null. Even though I tried the following to set the renderer, my self.graphicsLayer.renderer is still null. self.graphicsLayer.renderer = [[AGSSimpleRenderer simpleRendererWithSymbol:[AGSSimpleFillSymbol simpleFillSymbol]] retain];
Now my code is as follows:
- (void)queryTask:(AGSQueryTask *)queryTask operation:(NSOperation *)op didExecuteWithFeatureSetResult:(AGSFeatureSet *)featureSet {
NSLog ( @"Renderer: %@", [self.graphicsLayer.renderer description]);
NSLog( @" featureSet: %@", [featureSet description]);
[self.graphicsLayer removeAllGraphics];
AGSSimpleFillSymbol *simpleFillSymbol = [AGSSimpleFillSymbol simpleFillSymbol];
for (AGSGraphic *graphic in featureSet.features) {
graphic.visible = YES;
graphic.symbol = simpleFillSymbol;
[self.graphicsLayer addGraphic:graphic];
NSLog(@" graphic: %@", [graphic description]);
}
[self.graphicsLayer dataChanged];
}
I get the following output:
Renderer: (null)
featureSet: AGSFeatureSet: display name: SEGMENT_PREFIX
geometry type: esriGeometryPolyline
num features: 100
spatial reference: AGSSpatialReference: wkid = 4326, wkt = null
graphic: geometry: AGSPolyline: [envelope: AGSEnvelope: xmin = -83.691725, ymin = 36.763704, xmax = -83.378514, ymax = 36.886530, spatial reference: [AGSSpatialReference: wkid = 4326, wkt = null]], symbol: <AGSSimpleFillSymbol: 0xacc3110>, attributes: {
"ENG_REGION" = SOUTH;
OBJECTID = 25;
"SEGMENT_PREFIX" = 0SC;
"SHAPE.LEN" = "41502.858489515296";
}, visible: 1
Any suggestions? What type of renderer is set for the graphics layer? The returned graphics from query task ash which type of geometry? If render set on the graphics layer does not support geometry returned by query task then you should set symbol on each graphic before adding them to the graphics layer and it should draw it. If returned graphics has polygon geometry then do this. - (void)queryTask:(AGSQueryTask *)queryTask operation:(NSOperation *)op didExecuteWithFeatureSetResult:(AGSFeatureSet *)featureSet {
[self.graphicsLayer removeAllGraphics];
AGSSimpleFillSymbol *simpleFillSymbol = [AGSSimpleFillSymbol simpleFillSymbol];
for (AGSGraphic *graphic in featureSet.features) {
graphic.visible = YES;
graphic.symbol = simpleFillSymbol;
[self.graphicsLayer addGraphic:graphic];
}
[self.graphicsLayer dataChanged];
} Hope this helps! Regards, Nimesh
... View more
10-12-2012
11:37 AM
|
0
|
0
|
459
|
POST
|
I spent quite some time on this but could not figure out. Help is much appreciated.. I query a feature map as follows: self.queryTask = [AGSQueryTask queryTaskWithURL:featureURL]; self.queryTask.delegate = self; AGSQuery *query = [AGSQuery query]; query.where = @"OBJECTID <= 100"; query.outFields = [NSArray arrayWithObject:@"*"]; query.returnGeometry = YES; [self.queryTask executeWithQuery:query]; Everything works fine so far and I get response for 100 objects and add them to the graphicsLayer. graphic.geometry is not null. - (void)queryTask:(AGSQueryTask *)queryTask operation:(NSOperation *)op didExecuteWithFeatureSetResult:(AGSFeatureSet *)featureSet { [self.graphicsLayer removeAllGraphics]; for (AGSGraphic *graphic in featureSet.features) { graphic.visible = YES; [self.graphicsLayer addGraphic:graphic]; } [self.graphicsLayer dataChanged]; } HOWEVER, I cannot see anything on the map. (I also tried the above code without removeAllGraphics) The following code in another method works fine to add nodes on the map: AGSGraphic* myGraphic =[AGSGraphic graphicWithGeometry:myMarkerPoint symbol:myMarkerSymbol attributes:nodeDict infoTemplateDelegate:template]; //Add the graphic to the Graphics layer [self.graphicsLayer addGraphic:myGraphic]; Any ideas about what could be going wrong? Thanks!
... View more
10-12-2012
09:44 AM
|
0
|
7
|
2633
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|