ThinkGeo.com    |     Documentation    |     Premium Support

AerialWithLabels/Roads overlays and panning

I have a map with two overlays - one overlay contains a VirtualEarthLayer with a MapType of Road and the other contains a VirtualEarthLayer with a MapType of AerialWithLabels. I've set the IsBase of both overlays to True. I hide and show the overlays based on the user's selection (using some radio buttons). However, if the visible overlay is the AerialWithLabels overlay (which means the Road overlay is hidden) when you pan the map it displays the Road overlay during the drag operation, and when you drop the map in its new location, the AerialWithLabels overlay is drawn. What's the best way to set this up so that the visible overlay is the one that is used in the drag operation of panning?


Thanks!



Gregory,


I doubt you set the same cache direcotry for the two VE layers? Try following codes to see it works.

        private void ShowHideLayer_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit = GeographyUnit.Meter;
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
            string accountId = "*******";
            string password = "********";
            string clientIpAddress = "***.***.***.***";
            string cacheDirectory = @"c:\temp1\";
            VirtualEarthLayer veLayer1 = new VirtualEarthLayer(accountId, password, clientIpAddress, cacheDirectory);
            veLayer1.MapType = VirtualEarthMapType.Road;
 
            LayerOverlay layerOVerlay1 = new LayerOverlay();
            layerOVerlay1.Layers.Add("veLayer1",veLayer1);
            layerOVerlay1.IsBase = true;
 
            winformsMap1.Overlays.Add("layerOVerlay1", layerOVerlay1);
 
            string cacheDirectory2 = @"c:\temp2\";
            VirtualEarthLayer veLayer2 = new VirtualEarthLayer(accountId, password, clientIpAddress, cacheDirectory2);
            veLayer2.MapType = VirtualEarthMapType.AerialWithLabels;
            
            LayerOverlay layerOVerlay2 = new LayerOverlay();
            layerOVerlay2.Layers.Add("veLayer2", veLayer2);
            layerOVerlay2.IsBase = true;
            winformsMap1.Overlays.Add("layerOVerlay2",layerOVerlay2);
            
 
            winformsMap1.CurrentExtent = new RectangleShape(-1000000, 1000000, 1000000, -1000000);
            //winformsMap1.ZoomOut(99);
 
            winformsMap1.Refresh();
        }
 
        private void cbkShowAerialWithLabelLayer_CheckedChanged(object sender, EventArgs e)
        {
            LayerOverlay overlay2 = (LayerOverlay)winformsMap1.Overlays["layerOVerlay2"];
            overlay2.Layers["veLayer2"].IsVisible = cbkShowLayer.Checked;
 
 
            winformsMap1.Refresh(winformsMap1.Overlays["layerOVerlay2"]);
        }


 
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Hi, Yale!


I use two different caches for the VE images - c:\images\AerialWithLabels and c:\images\Road. I can inspect the contents of these folders and there is no mixup of aerial and roads images, so I know i don't have roads images bleeding into the aerial image folder.


I am attaching a screen-print of how the image looks when you first start to "drag" during the pan operation. You can see the road image overlay the aerial image. As soon as I start the pan, the road image replaces the aerial image and I am dragging the road image. When I release the road image, it vanishes and is replaced by the appropriate aerial image.


 



Hi, Gregory,


I did not notice the screen-print image :).
 
Also, I am curious did you try the code above to see it works fine? If you still have problem, could you send us a very small sample appliction to show us your problem.
 
Thanks.
 
Yale