ThinkGeo.com    |     Documentation    |     Premium Support

Tile Cache generator for silverlight apps

Hi,

We are using silverlight version of Mapsuite and we are using server cache as explained below to for better map performance

layerOverlay.ServerCache = new ServerCache(mapCachePath + layerOverlay.Id);

However we observed that even though tiles are cached at certain zoom levels again there is a redraw which is happening every time we zoom the map.Kind of Maps file type what we are using is, ecw, jp2, jpeg etc with associated world files.



We did try to use cache generator for the above map file types with following changes in layer provider class.

{

         var layertoadd=new EcwRasterLayer§;
              layersToCache.Add(layertoadd);
}

I could observe that it is still redrawing the map and the performance is not improved.Can you suggest how can we improve the performance of the map?

Is the approach to generate cache is right or any change is needed?Please help.

Regards,

Bhavya

Hi Bhavya,



Thanks for your post and welcome to Map Suite Support Forums!



After our test, layer will not be redrawn if it was cached on server. Would you please let us know how you observed that there is a redraw? Or do you mean tiles will be requested from server every time we zoom the map? 



For the performance question. Please try below options for SilverLight Edition:

1. Reduce the number of Overlays to reduce the duration of tile requesting. 

2. Add static layers to one overlay, and add ServerCache and ClientCache for this overlay as what you’ve done.



We are waiting for your reponse. BTW, you have a thread in Wpf forums is same to this, so please reply here directly.



Thanks,

Kevin

Hi Kevin,

Thanks for your reply.

We observed following things,

1. Server cache we have added as part of the server side code which generated map tiles in the specified directory. Even though the cache is present at the server side  we see that the map is getting drawn with black tiles appearing first and then getting filled up with real map tiles.

2.To avoid the above behavior we tried using Tile cache generator provided, yet we did not see any improvement in that behavior.

 When we used cache generator we observed that, the cache  scale sub folders have different name compared to what gets generated dynamically with layerOverlay.ServerCache.

When we manually change the sub folder names to what gets dynamically with servercache we could observe that the redraw effect is not there.



So i had following questions

1: What is the difference between using servercache and generating tiles dynamically when comapared to tile cache generator?

2: Can we statically create the cached tiles using servercache method itself?

3.How can we change cache generator to generate tiles same as server cache method?

3.What do you mean by client cache?How can we do that?





Regards,

Bhavya

Hi
Bhavya,


Firstly,
we need to confirm with you that if you have set the CacheId of
ServerCache? Only we set the CacheId of ServerCache same to cacheId we set to tile cache generator, the generated caches will work and the performance will be improved. 

If we don’t set CacheId, every time we start the application, overlay will
create a folder and named it with a GUID, and then map will generate cache
images and load caches from this folder, so the caches by tile cache generator will not work.


For
the difference between ServerCache and tile cache generator. The server cached
only cached tile images we have already viewed on the map, in other world, if
we want to cache everywhere of one zoomlevel, we need to pan map everywhere on
this zoomlevel manually. 


The
tile cache generator can pre-cache tiles we specified and don't need us to pan the map, in other word, cached
are generated automatically. This is the smart tool to help us with tile cache
generating.  But the tile cache can be
same as those generated by server cache.


Any
question please feel free to let us know.




Regards,


Kevin



Hi Kevin,
We did not have cacheId set for the servercache. However.However for test purpose I applied cacheId for server cache and for cache generator as well.
Still I could see that the tiles generated had different folder names.

I have attached the screenshot below.





Please suggest what can be done?




FolderMisatch.png (24.3 KB)

Hi
Bhavya,


The
screen shot is pretty fuzzy after pasted to reply, we cannot figure out if the
difference is supposed.  Could you please
put these images in a zip file and attach again?


Looks
like all the folder names are 4-digit number, I suspect they are cached row
numbers, and every folder contains cached images of that row. Different
cached area will have different cached row folder, so the different folder name can be correct.


Anyway,
please provide us some clearer screenshot and we will have more insights on.


Waiting
for your response.


Thanks,

Kevin



Hi Kevin,

You are right.If i observe the cached images fro server cache and from cache generator, they dont have same image names as well as same sub folders.Because of which i could see that the tiles are always drawn when we try to pan and zoom the map even after caching.

Attaching the image.


Mismathedtiles.zip (86.5 KB)
001_FolderMisatch.png (46.3 KB)

Hi Bhavya,


Form the screenshot, seems the Tile Cache Generator only
cached tiles in a pretty small extent, and didn’t cache the area that you have
view on the map. The caching extent of Tile Cache Generator should contains the
extent of map we are panning. So would you please compare caching extent of
Tile Cache Generator with CurrentExtent of map? Do they intersect? 


If the issue still persist, would you please provide us a complete
sample with test data and we will dig into this.


Regards,


Kevin 



Hi kevin,

I tried all the suggestions from you, yet it doesn’t look like the issue is resolved.

We are using .jp2 and .ecw format of the map files with custom map zoom for our application.With cache generator we are not able to get any tiles which has the real image(all are white or unlicensed), even though extent provided are correct

I have attached the modified cache generator with modified class files and the map file in the attachment.Please guide us on this and let me know what we are doing wrong.

Runtime: .Net3.5

Mapuite core dll version:5.5.0.0

The projection of the map is

Upper left latitude: 12.9337

Upper left longitude: 77.68166

Lower right latitude: 12.91624

lower right longitude: 77.69404



Kindly revert back.



Regards,

Bhavya

FilesModified.zip (1.42 MB)

Hi Bhavya,



We don’t occur the issue you mentioned. We’ve build a sample with code you provided. Please follow below steps to have a check.

    1. Open CacheGenerator, and Click Generate button. Caches will be generated to D:\CacheFolder.

    2. Open WPFDisplayCachedMap, run the solution and program will load tile cache from D:\WPFDisplayCachedMap.

Also you can uncomment from line 38th to 41st to load the jp2 file and see if two caches is matched.



As we don’t have code about how you load the tile caches, so we build the sample for you and hope this would be helpful.



Regards,

Kevin




post12556.zip (1.46 MB)

Hi kevin,

Thanks for your reply.

i was able to generate cached tiles with the help.

I have created a sample to which mimics our application in how we use map.With that also however i was able to see that tiles are recreating everytime we zoom in and out.

How can we improve the map such that human eyes don’t perceive this redrawing effect at all?

MapSample_(2).zip (127 KB)

Hi Bhavya,


Firstly, I want to make it
clear what you mean by “tiles are recreating”. Are there some new tile cache
images generated every time we zooming?


Or you means tiles still
will requested from server side?


Waiting for your response.


Thanks,


Kevin



Hi Kevin, 
 When the tiles are getting loaded its always requested from server side and we see that visible effect on the IE client that maps are getting loaded is very much prominent. 
 And tiles are loaded with a time delay of 2 seconds even with the sample when we zoom or pan the map,which i have attached. 
 Our application need is to support time delay up to 500ms only when any map operation is performed. 
 Please suggest how can we achieve that. 
  
 Regards, 
 Bhavya 
  
  


Hi Bhavya, 
  
 If you found the tile loaded takes 2 seconds, I think we need make sure where is the problem, please make sure the 3 items as below: 
  
 1. Whether the tile on map is cached or generated when you pan/zoom. If you choose Cache Generator to generate the cache, please choose add WaterMark, so that when you see the tiles on client side, you can know whether that’s the tile you pre-generated. 
  
 2. Whether the 2 seconds is network delay. I am not very sure about your test environment, but I think you can know whether there is a network delay when test, if you are under development, this shouldn’t be the problem. 
  
 3. If render data and network delay haven’t take the 2 seconds, I think I need take a look at the project you mentioned, please let me know whether that’s the MapSample_(2).zip or any zip file before that? 
  
 Regards, 
  
 Don

Hi Don, 
 First option is tried and i don’t see much improvement even with that. As cache generator generates lesser files when compared to run time cache generation. 
 There is no network delay as is checked in the local machine in dev environment. I am checking the sample with Win7 32bit 4GB RAM machine. 
 Yeah its the same sample which i tried with the map which is attached with previous mail chain FilesModified.zip 
  
 Regards, 
 Bhavya

Hi Bhavya,  
  
 It looks you give more detail information in ticket and it said the same thing with this post. 
  
 I will look at your project and have a test today. Just to let you know I will reply you there. 
  
 Regards, 
  
 Don