Creating custom dynamic image layer

2304
4
05-09-2013 10:21 AM
BillNalen
New Contributor
I'm working on an Android version of my iOS app. In my app I need to fetch an image from the server where the server isn't an arcgis server, similar to my question here http://forums.arcgis.com/threads/60285-How-do-I-create-a-layer-that-is-generated-from-an-image

So at this point I know the Envelope and the url of the image on the server. I'm trying to create a subclass of DynamicLayer thinking that getImage will get called at some point so I can return my image data fetched from the server, but getImage is never called.

When I'm ready I create a new instance of my custom class and add that as a layer to the existing map view. However, nothing in my custom class seems to be getting called.

What do I need to override in DynamicLayer in order to return image data to the map view?

Right now I"m overriding getFullExtent, getSpatialReference, getImage, and requestImage but none of these methods get called.

In my constructor I'm calling
super(url) with my custom image url, but really this url shouldn't refer to anything right?
super.initLayer()

Or should I be using some other class to subclass here?

Thanks
Bill
0 Kudos
4 Replies
BillNalen
New Contributor
Is anyone from ESRI reading this board? Is there some other customer service channel I should go through?

Thanks
0 Kudos
EricBader
Occasional Contributor III
Hi Bill.
I understand what you are trying to do. The object model extensibility has not really been tested to this level since this scenario is not supported, unfortunately.
What kind of service exactly are you trying to add to the map?
0 Kudos
BillNalen
New Contributor
It's not really a service in terms of esri. I have a regular map view layer. On top of this I want to put an image. I have the envelope and the image I receive fits directly on that envelope. The image is received directly from our server, i.e. I pass in an image id and I get back the image data. On iOS I'm doing this (but with the 2.3 sdk):

In - (NSOperation<AGSDynamicLayerDrawingOperation>*)exportMapImage:(AGSExportImageParams*)exportImageParams

    NSString *urlString = [NSString stringWithFormat:@"%@?id=%@&type=png", self.URL, self.imageId];
   
    NSMutableURLRequest *urlRequest;
    urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]];
    [urlRequest setHTTPMethod:@"GET"];
   
    AGSDynamicLayerImageRequestOperation *operation = [[AGSDynamicLayerImageRequestOperation alloc] initWithRequest:urlRequest];
    operation.target = self;
    operation.action = @selector(imageRequestOperation:didGetImage:);
    operation.errorAction = @selector(imageRequestOperation:didFailWithError:);
operation.exportImageParams = exportImageParams;

    [[AGSRequestOperation sharedOperationQueue] addOperation:operation];

And then in - (void)imageRequestOperation:(NSOperation<AGSDynamicLayerDrawingOperation>*)op didGetImage:(UIImage *)image


    [self.exportDelegate dynamicLayer:self exportMapImageOperation:op didFinishWithImage:image];


I'm not sure how this translates to the 10.1 SDK
0 Kudos
EricBader
Occasional Contributor III
Ok, I see. After further research on this, it is not something that you can do with the Android API like you can with iOS.
The team is researching and considering the extensibility points of the API for future releases to support the use case you've shown with iOS.

Thanks for sharing this, and for your patience!
0 Kudos