Select to view content in your preferred language

Have individual cache tiles, how to load in map as CachedTileLayer

1133
2
03-24-2011 03:17 PM
davidrenz
Deactivated User
I am able to get each individual tile from a tile cache, with each request by intercepting the "TileLoading" event. That works fine.

But, how do i then stitch them all back together for the map?

I just found this documentation on doing what I am doing:
http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.ArcGISTile...

but now don't know how to put everything back together so that i can load the map with my tiles.


this is how i am getting the tiles.
when i am watching fiddler, i see an initial connection to the map service, but then see no more communication.
is assigning the e.ImageSource all i really need to do?


        private void ArcGISTiledMapServiceLayer_TileLoading(object sender, ESRI.ArcGIS.Client.TiledLayer.TileLoadEventArgs e)
        {
            string sBaseLocation = @"D:\Cache\Test\_alllayers";
          
            ImageSourceConverter isc = new ImageSourceConverter();
            e.ImageSource = (ImageSource) isc.ConvertFromString(sBaseLocation + "\\L" + e.Level.ToString().PadLeft(2, '0')
                    + "\\R" + e.Row.ToString("x").PadLeft(8, '0') + "\\C"
                    + e.Column.ToString("x").PadLeft(8, '0') + ".png");

        }


any help would be greatly appreciated.

thanks
david
0 Kudos
2 Replies
wangzhifang
Frequent Contributor
I am able to get each individual tile from a tile cache, with each request by intercepting the "TileLoading" event. That works fine.

But, how do i then stitch them all back together for the map?

I just found this documentation on doing what I am doing:
http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.ArcGISTile...

but now don't know how to put everything back together so that i can load the map with my tiles.


this is how i am getting the tiles.
when i am watching fiddler, i see an initial connection to the map service, but then see no more communication.
is assigning the e.ImageSource all i really need to do?


        private void ArcGISTiledMapServiceLayer_TileLoading(object sender, ESRI.ArcGIS.Client.TiledLayer.TileLoadEventArgs e)
        {
            string sBaseLocation = @"D:\Cache\Test\_alllayers";
          
            ImageSourceConverter isc = new ImageSourceConverter();
            e.ImageSource = (ImageSource) isc.ConvertFromString(sBaseLocation + "\\L" + e.Level.ToString().PadLeft(2, '0')
                    + "\\R" + e.Row.ToString("x").PadLeft(8, '0') + "\\C"
                    + e.Column.ToString("x").PadLeft(8, '0') + ".png");

        }


any help would be greatly appreciated.

thanks
david


You can inherit from TiledLayer or TiledMapServiceLayer, and override its
GetTileSource(protected override void GetTileSource(int level, int row, int col, Action<System.Windows.Media.ImageSource> onComplete)
method, return your image in onComplete action, that's all.
0 Kudos
dotMorten_esri
Esri Notable Contributor
If you listen to TileLoading, you can intercept the tilerequest before it's being requested from the server, check if you already have the tile locally, and set the ImageSource property on the eventargument.
0 Kudos