TatukGIS menu

Knowledge Base

KB10923 - Method to dynamically load and refresh an image layer.

Delete and create the layer each time the layer content is reloaded. For example, to dynamically update a PNG layer:

  GIS.Lock();                 // avoid screen refreshes   

  zorder = layer.ZOrder ;     // store layer z=order position
  GIS.Delete( layer.Name );   // delete existing layer
  layer = new TGIS_LayerPNG;
  layer.Stream = mystream;    // you can just read layer from the stream!
  // or
  // layer.Path = mypath;
  layer.Open() ;              // it will read all layer properties
  layer.SetCSByEPSG( mycs );  // just assign layer.CS to set the layer coordinate system
  layer.Extent = myextent;    // to set the layer extent expressed in coordinate system units!!!
  GIS.Add( layer )
  layer.ZOrder = zorder;      // restore layer z-order position  

  GIS.Unlock();               // unlock screen refereshed

This will be just as fast as re-reading the layer.

Created: August 10, 2016, Modified: December 07, 2016