Tuesday, 31 March 2015

AIMS / MapGuide backup batch script

I used to create backups for the repository files and the library - by running the batch files provided by MapGuide manually and using the Admin web interface for creating a package. To simplify the process I have written one batch file for the whole procedure. As I'm not familiar with batch file scripting there is probably lots of space for improvements left. Here are some details:


1. make package 
I modified the existing "makepackage.php" script (...\Autodesk Infrastructure Web Server Extension 2013\www\mapadmin) in order to run it from command line. It needs some configuration parameters such as path to webconfig.ini and the Administrator's credentials (MapGuide Admin).

2. repository backup batch files
The backup scripts provided by MapGuide need a little modification - I added an "exit" at the end of each of the files I use and renamed them as well (kept the originals).

 ...  
 echo.  
 php -n RepositoryAdmin.php -c Restore -i "%cd%\..\BackupRepositories\Library\LastColdBackup" -o "%cd%\..\Repositories\Library"  
 echo.  
 exit  

  
3. batch script 
One batch script is needed to run all other scripts, for shutting down and restarting MapGuide service and for copying the backed up files to a different drive.

To run other batch files use:

 ...  
 start /wait call %batch_file_backup%  
 if ERRORLEVEL 1 goto error_start  
 ...  


This will run another batch file and wait until the batch file has finished. If the batch file does not finish succesfully you can catch an error code. A modification of the original batch files provided by Mapguide is required to get this to work - see above.

One click and files are backed up:


backup batch file in action

Script files are available here.

Install:

1) Copy files to "..\Autodesk Infrastructure Map Server\RepositoryAdmin" folder.
2) check and modify settings in "makepackagescript.php"
3) check and modify settings in "AIMS_backup.bat"
4) run "AIMS_backup.bat"

This should work for AIMS 2013 and the corresponding MGOS version.

Friday, 20 March 2015

Oracle Trigger - display debug information

Just for my own reference:

(1) within trigger use DBMS_OUTPUT.PUT_LINE, e.g.


 DBMS_OUTPUT.PUT_LINE(REC_INSP.FID || ' ' || REC_INSP.FID_BAUM);  

to display text in SQL Developer:

(2a) - open DBMS output panel 
(2b) - in DBMS-output panel : choose active Oracle connection

or:

(3) - run:

 SET SERVEROUTPUT ON  


(4) execute SQL in SQL Developer which fires trigger


>> Debug information will be displayed either in DBMS-output or Script output panel



SQL Developer - DBMS output panel

Source Code Formatter

Tuesday, 17 March 2015

MapGuide / AIMS - WMS layer and background transparency and opacity

We set up a few new FDO WMS data sources and created layers accordingly. For an unknown reason for layers from some data sources the background was not transparent. All WMS layers are provided by the same organisation, we set up all data sources and layers the same way.
I finally found out that changing settings in "Set coordinate system overrides" for the data source and re-creating the layers solved the problem. I just changed image format from png to something else and unchecked the "Transparent" checkbox, saved the changes and then set the original values back again and saved it. 

WMS data source - cs overrides does the trick....

When creating a layer for the modified data source afterwards background transparency was present again. It is probably sufficient to just uncheck the "Transparent" checkbox but I haven't tested that - wasted enough time already...

After this issue was solved the second question came up - can we now set an opacity for the WMS layer? No, we can't... It is possible in AutoCAD Map to apply opacity to a raster layer but this does not work for raster layers in AIMS/MapGuide (at least not with FDO Raster Provider) and for WMS based layers.
Would be a nice enhancement if it were possible...

"Opacity" with Map raster layers - here you will find further information (German language),

Map, AIMS 2013