English

How To: Recreate the Map Composition environment through SML

Summary

Once a MAP composition is closed, there seems to be no way to reestablish the environment in which it was created. Unless these steps were written down, often the MAP has to be recreated if changes are required. The following two SML routines show how you can "save" the map environment under which a map composition was created with the MAP command. You can then "restore" the map environment before you modify the map composition again.

Procedure

The trick is to write map environment commands like the page size, mapextent, line color etc. out to a file on the map composition directory called e0000.plt. The file e0000.plt is never created by the map composer, but it is one of the few files that can be stored in a map composition directory and not "confuse" the map composer. To restore the map environment, just &run the e0000.plt file.

Code:
====================mapsave.sml============================
&REM SAVE the map environment to E0000.PLT
&REM The first parameter is the map composition name.
&REM
&openw %1\e0000.plt
show mapext 2 3 4 5
&write "mapext %2 %3 %4 %5"
show pagesize 2 3
&write "pagesize %2 %3%
&closew
&return

Code:
==================maprest.sml===============================
&rem Restore the map environment created by mapsave
&rem %1 is the map composition name
&run %1\e0000.plt
&return