ThinkGeo.com    |     Documentation    |     Premium Support

OverlayLayer.Refresh with WmsRasterLayer

MapSuite Team,

I have a situation where a OverlayLayer.Refresh does not refresh the WmsRasterLayer that is contained within the OverlayLayer.

My application has three OverlayLayer. The first contains a WmsRasterLayer, the second a MrSidRasterLayer, and the last one contains a number of ShapeFileFeatureLayer.

When an invoke of OverlayLayer.Refresh is performed on the overlays it works except for the Overlay with the WmsRasterLayer.

so my code is basically this…

Prior to the Refresh the IsVisible properties are:
First OverlayLayer.IsVisible = false;
Second OverlayLayer.IsVisible = true;
Third OverlayLayer.IsVisible = true;

Then IsVisible is changed:
First OverlayLayer.IsVisible = true;
Second OverlayLayer.IsVisible = false;
Third OverlayLayer.IsVisible = true;
First OverlayLayer.Refresh;
Second OverlayLayerRefresh;
Third OverlayLayerRefresh;

The result is the First OverlayLayer is not shown, the Second OverlayLayer is not shown as expected, and the Third OverlayLayer is also shown as expected.

If a pan/zoom is performed after these Refresh are done then the WmsRasterLayer appears.

Replacing the individual OverlayLayer.Refresh with one WpfMap.Refresh results in the overlays appearing as they should.

Thanks,
Dennis

Hi Dennis,

Thanks to let us know that, I think maybe the OverlayLayer.Refresh have bug when it contains the network related layers.

Please choose this API instead of it: map.Refresh(layerOverlay);

Regards,

Ethan

hi Ethan,

I’ve some more information on this issue.

The refresh issue applies to any OverlayLayer that has not been previously rendered. If an OverlayLayer had not been previously rendered an OverlayLayer.Refresh will not refresh. It requires a WpfMap.Refresh. Once the whole map refresh is done then the overlay refresh will work.

I will code-around this anomaly.

Also, I prefer to do an OverlayLayer refresh as opposed to a whole map refresh because it is more efficient. I’ve three OverlayLayer for fixed map layers, but six OverlayLayer for real-time GPS information and I don’t want to be refreshing those unless absolutely necessary.

Dennis

Hi Dennis,

This works by our design.
Map/Overlay refresh will update the map data. But the layer refresh only re-draw the layer to canvas but not update on map. If you uses layer.refresh, you need too update the map by yourself.

We have some perfessional projects have GPS location function, we used one layer overlay to store the GPS location, and use Overlay.refresh to update that. it is efficient too.

Hope this make sense, if you meet any issue when using overlay.refresh. please feel free to let us know that.

Thanks
Mark

hi Mark,

Thank you for the explanation. I do have it all working as needed.

But I do have another related question…here’s the scenario…

My application has an OverlayLayer containing one WmsRasterLayer, an OverlayLayer containing one MrSidRasterLayer, and another OverlayLayer for numerous ShapeFileFeatureLayer.

I’ve developed a feature to allow a user toggle between the WmsRasterLayer and MrSidRasterLayer. The user toggle merely causes one OverlayLayer.IsVisible to be set true and the other set false. This works okay, but it appears to have to ‘rebuild’ the layer in order to display it even when the extent has not changed between a toggle.

The toggle merely changes the IsVisible properties, it does not do a Refresh.

It would be nice if it was an instantaneous switch between the two OverlayLayer as long as the extent has not changed.

Is there anyway this can be achieved? What if the IsVisible was changed at the layer level instead of the OverlayLayer level?

Thanks,
Dennis

Hi Dennis,

Base on your description, I supposed that your Overlaylayer is LayerOverlay. So I think you have three overlay:

  1. WmsOverlay contains one WmsRasterLayer;
  2. MrSidOverlay contains one MrSidRasterLayer;
  3. ShapeFileOverlay contains numerous ShapeFileFeatureLayer.

You prefer to toggle WmsRasterLayer and MrSidRasterLayer, so I advice that you can put WmsRasterLayer and MrSidRasterLayer to one Overlay. So the new overlays are:

  1. RasterOverlay contains WmsRasterLayer and MrSidRasterLayer;
  2. ShapeFileOverlay contains numerous ShapeFileFeatureLayer.

Set layer.IsVisible when you need to toggle that, and then call RasterOverlay.Refesh() to refresh that. Then you can get the result as your expect.

Hope this make sense, if there is any issue, please feel free to let us know that.

Thanks
Mark

Mark,

Thanks for your response.

The way I’ve it implemented works. I just would like to see the rasters change instantaneously. Doing a Refresh would cause the layer to be redrawn. I don’t want to have to redraw the layer I just want it to appear.

This is especially true with a WmsRasterLayer with that layer is in the Cloud.

How can the image be maintained and simply made visible without a refresh/redraw?

Of course I’m taking about when the extent has not changed between a toggle.

Thanks,
Dennis

Hi Dennis,

I think you are implement that correctly. I need to tell you that you have to refresh overlay when set the layer.IsVisible by our correct design.

That is because we will draw all the layers on the Tile, and then display all the tiles on Map. If there are 2 layers on one Overlay. the 2 layers feature will be drawn on Map when call refresh. There is no way to change the tile content without call Refresh().

Thanks
Mark