Monday, 5 March 2018

c# - Can custom map tiles be properly rendered via ArcObjects within my ArcGIS 10.1 Desktop AddIn?


Within ArcObjects for ArcGIS 10.1, we are attempting to render pre-generated map tiles as a basemap (group) layer. The tiles themselves are of the typical web mercator aux. spherical tiling scheme.



Under ArcMap 10.1 the tiles do not render properly: incorrect rendering result


and the ArcMap 10.1 UI is displaying the following drawing error: "Missing raster band wavelength properties"


[Expected] rendering result under ArcMap 10.0: enter image description here


While this is related to this (my) question here, that was a holistic approach question. Here I am specifically asking how to properly render the tiles in ArcMap 10.1.


We successfully accomplished the layer adding/rendering within 10.0 via the following code:


_tileLayer = new MyCustomTileLayer();    // implements ILayer among others..
_coverageBasemapLayer = new BasemapLayerClass();
_coverageGroupLayer = _coverageBasemapLayer as IGroupLayer;

// add the layer to the map

IMap map = ArcMap.Document.FocusMap;
map.AddLayer((ILayer)_coverageBasemapLayer);

...

// wire the AfterDraw Event
IActiveViewEvents_Event avEvent = ArcMap.Document.FocusMap as IActiveViewEvents_Event;
avEvent.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(avEvent_AfterDraw);

private void avEvent_AfterDraw(IDisplay Display, esriViewDrawPhase phase) {

// force re-draw
_tileLayer.Draw(esriDrawPhase.esriDPGeography, Display, null);
}

...

// effectively, within _tileLayer.Draw() here...
IRasterLayer rl = new RasterLayerClass();
// 'file' is the full path to the map tile PNG on the local file system, downloaded
// and/or cached

rl.CreateFromFilePath(file);

_coverageGroupLayer.Add(rl);

Presumably many things have changed within the renderer for 10.1. However can anyone provide insight into the ArcObjects changes required? Specifically how can we [properly] accomplish this within ArcObjects under 10.1?


Thank you in advance.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...