ThinkGeo.com    |     Documentation    |     Premium Support

Google Overlay LocalCache

I just installed the new version of the desktop edition win forms software. It complained that the LocalCache property on the GoogleMapsOverlay is no longer there. Can you explain this change? Is there a local cache for google maps? Setting that was one of the steps I took that seemed to help resolve some issues I had with the google map disappearing.


I looked at the API change log (took me a while to find it), and it seems like it recommends using a property called ClientCache, which I don't see. What am I missing?


Thanks,


Kimberly



I wanted to add here that simply by commenting out the LocalCache line, I do seem to be having some issues with the google part of the map going white for long periods of time. I had done a lot of tweaking to get that to go away before and now this change seems to bring it back.



hi 
 i’m using version 3.1.299 
  
 the following code works fine for me, the cache is setup in the creation of the layer. 
 Before i create the layer, i check for TMPGoogleCountries02.* and delete them if exits, 
 the layer throws an exception if files exits. 
  
  private LayerOverlay SetupGoogleAndWorldLayer(Projection googleProjection) 
  { 
  string shapeFile = m_shapePath + @“Countries02.shp”; 
  string googleShapeFile = m_shapePath + @“GoogleCountries02.shp”; 
  ShapeFileFeatureSource.SaveToProjection(shapeFile, googleShapeFile, googleProjection, OverwriteMode.Overwrite); 
  
  
  ShapeFileFeatureLayer shapeFileLayer = new ShapeFileFeatureLayer(googleShapeFile); 
  
  shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.County2; 
  shapeFileLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(GeoColor.SimpleColors.DarkBlue, 1)); 
  shapeFileLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 
  //string googleCacheDir = Environment.SpecialFolder.ApplicationData 
  m_googleLayer = new GoogleMapsLayer(@“XXXXXXXXXXX”, m_shapePath + “GoogleCache”); 
  m_googleLayer.MapType = m_googleMapType; 
  m_googleLayer.IsVisible = true; 
  m_googleLayer.DrawingExceptionMode = DrawingExceptionMode.DrawException; 
  LayerOverlay backgroundOverlay = new LayerOverlay(); 
  backgroundOverlay.Layers.Add(GetLayerName(LayerNameEnum.Google), m_googleLayer); 
  backgroundOverlay.Layers.Add(GetLayerName(LayerNameEnum.World), shapeFileLayer); 
  
  return backgroundOverlay; 
  }

Lars, thanks for the response.  
  
 This actually brings up sort of another question for me that I meant to post before. What’s the difference between a GoogleMapsOverlay and a GoogleMapsLayer? Obviously one is an overlay and one is a layer and I know what the difference is there, but is there a reason when you want to use one over the other? I am using a GoogleMapsOverlay and I had the LocalCache property set on that. Is there a benefit is switching to a google layer? I would probably still have it on its own overlay at the bottom just because it sort of puts it out of the way of the other logical groupings.  
  
 Thanks! 
 Kimberly

Hi 
 I will let the thinkgeo guru’s answer that :) 
 I had some problems with the projections between googlelayer and shapefile, and ThinkGeo 
 came with the ShapeFileFeatureSource solution above. 
  
  


Thanks Lars! I do appreciate the response. :)

you welcome

Thanks for your help, Lars.


Kimberly,
Following two ways can shows you how to setup a TileCache for GoogleOverlay, the second way is an advanced usage which allows you to use some kinds of other CacheSystem or customized CacheSystem instead of only disk-based cache system.

GoogleMapsOverlay g = new GoogleMapsOverlay();            
g.CacheDirectory = @"C:\temp\GooleMapOverlayTileCache";
 
GoogleMapsOverlay g = new GoogleMapsOverlay();           
g.TileCache = new FileBitmapTileCache(@"C:\temp\GooleMapOverlayTileCache", string.Empty);

 
We have removed the LocalCache or ClientCache in the latest public release(3.1.299), we suggest using the TileCache instead.
 
Any more quesitons just feel free to let me know.
 
Thanks.
 
Yale