Select to view content in your preferred language

Objects not getting plotted on bing maps

1151
8
09-06-2011 05:15 AM
TariqMohd
Emerging Contributor
So as per your documentation that to instantiate an AGSBingMapLayer, I need to provide a valid Bing Maps Key and a style for the imagery -- Roads, Aerial, or Aerial with labels.

AGSBingMapLayer* layer = [[AGSBingMapLayer alloc] initWithAppID:Bing_Key style:AGSBingMapLayerStyleRoad];
  [mMapView addMapLayer:layer withName:@"Bing_Key"];
  [layer release];

where Bing_Key i am fetching from service.

So I am able to show all 3 types of bing maps but my objects are not getting plotted on bingmap while all objects are getting easily plotted using AGSTiledMapServiceLayer for Street, Satellite etc.
0 Kudos
8 Replies
NimeshJarecha
Esri Regular Contributor
I'm sorry to say but I'm not able to fully understand your question. What you mean by "objects not getting plotted on bing maps"?

By providing valid AppId of bing layer, are you able to see the bing maps (all three styles) on map view?

Regards,
Nimesh
0 Kudos
TariqMohd
Emerging Contributor
Yes by providing valid AppId of bing layer, i am able to load bing maps.

But whenever I am trying to use below line then its crashing
[self.mapView addMapLayer:mObjectsGraphicsLayer withName:@"Objects"];

if i will not use addMapLayer then i cannot plot any image/object on map layer.

where mObjectsGraphicsLayer = [AGSGraphicsLayer graphicsLayer];
0 Kudos
NimeshJarecha
Esri Regular Contributor
So, you are saying you are not able to add a graphics layer on top of bing layer? If yes, it should just work. Could you please provide a complete code or a sample application?

Regards,
Nimesh
0 Kudos
TariqMohd
Emerging Contributor
I have fixed the problem by calling addMapLayer for graphic layer in didLoadLayerForLayerView delegate.

I dont know whether it is permanent solution or not but for time being I have fixed that.

Issue was like If I add AGSBingMapLayer to the mapLayer and in next line if I add graphic layer to the map layer then application was crashing. So for providing some delay I have added graphic layer related codes in didLoadLayerForLayerView delegate.
0 Kudos
TariqMohd
Emerging Contributor
But still sometime I get the crash if I use this line

self.objectsGraphicsLayer=[AGSGraphicsLayer graphicsLayer];
[self.mapView addMapLayer:mObjectsGraphicsLayer withName:kObjectsLayerNameKey];

here is the crash log:


*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderMutableString initWithString:]: nil argument'
*** Call stack at first throw:
(
0   CoreFoundation                      0x0215dbe9 __exceptionPreprocess + 185
1   libobjc.A.dylib                     0x022b25c2 objc_exception_throw + 47
2   CoreFoundation                      0x02116628 +[NSException raise:format:arguments:] + 136
3   CoreFoundation                      0x0211659a +[NSException raise:format:] + 58
4   Foundation                          0x00b03e9e -[NSPlaceholderMutableString initWithString:] + 111
5   Foundation                          0x00b2d2c2 +[NSString stringWithString:] + 72
6   G2Maps                              0x000824a5 -[AGSBingMapLayer tileUrlForTile:] + 82
7   G2Maps                              0x0008224c -[AGSBingMapLayer retrieveImageAsyncForTile:] + 99
8   G2Maps                              0x000c462b -[AGSTiledLayerView requestTileAtLevel:row:col:offsetx:offsety:mapFrame:left:top:currLod:tileWidth:tileHeight:] + 1076
9   G2Maps                              0x000c418f -[AGSTiledLayerView requestTilesInView:] + 2312
10  G2Maps                              0x000c4dba -[AGSTiledLayerView mapPanned:] + 81
11  G2Maps                              0x000ba7b5 -[AGSMapView kickOffMapPanned:] + 321
12  Foundation                          0x00b159a6 __NSThreadPerformPerform + 251
13  CoreFoundation                      0x0213f01f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
14  CoreFoundation                      0x0209d28b __CFRunLoopDoSources0 + 571
15  CoreFoundation                      0x0209c786 __CFRunLoopRun + 470
16  CoreFoundation                      0x0209c240 CFRunLoopRunSpecific + 208
17  CoreFoundation                      0x0209c161 CFRunLoopRunInMode + 97
18  Foundation                          0x00b37175 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 295
19  G2Maps                              0x000ad894 -[WorkerThreadUnit workerThreadMainRoutine] + 166
20  Foundation                          0x00b00d4c -[NSThread main] + 81
21  Foundation                          0x00b00cd8 __NSThread__main__ + 1387
22  libSystem.B.dylib                   0x9087e7fd _pthread_start + 345
23  libSystem.B.dylib                   0x9087e682 thread_start + 34
)
terminate called after throwing an instance of 'NSException'
0 Kudos
NimeshJarecha
Esri Regular Contributor
You are passing the name of graphics layer as kObjectsLayerNameKey in following codeline. Is it a valid string?

[self.mapView addMapLayer:mObjectsGraphicsLayer withName:kObjectsLayerNameKey];


Regards,
Nimesh
0 Kudos
TariqMohd
Emerging Contributor
Yes this is the right string:

#define kObjectsLayerNameKey @"layer_object_name"
0 Kudos
NimeshJarecha
Esri Regular Contributor
It should work. Could you please attach a sample app (hide the bing app id) to test?

Regards,
Nimesh
0 Kudos