The configuration for an in-memory layer must be added. (This cannot be handled in the project file because the project file contains no knowledge how to recreate a non-persistent layer.)
For example:
procedure TfrmMain.createLayerAndSaveConfig;
var
ll : TGIS_LayerVector ;
begin
ll := TGIS_LayerVector.Create ;
ll.StoreParamsInProject := False ; // DK8 only
ll.ConfigName := 'mylayer.ini' ;
ll.Params.Area.Color := clRed;
ll.WriteConfig ; // copy layer parmeters to configuration file
ll.SaveAll ; // to save all changes including ini file
end;
procedure TfrmMain.createLayerAndReadConfig;
var
ll : TGIS_LayerVector ;
begin
ll := TGIS_LayerVector.Create ;
ll.StoreParamsInProject := False ; // DK8 only
ll.ConfigName := 'mylayer.ini' ;
ll.RereadConfig ;
if ll.Params.Area.Color = clRed then begin
ShowMesssage( 'Bingo!')
end ;
end;
TGIS_Viewer.OnLayerAdd & OnLayerDelete can be used to automate such process.
Parameters will be to read/write from the .INI file only if such file exists. If you want to create a new .INI file, create an empty text file just before calling WriteConfig method.