Uwe A. Schneider
October 24, 2007
Modifications from Tom
Rutherford's Interface
This GAMS - SHADEMAP interface is a modification of the interface developed by Tom Rutherford . SHADEMAP has been developed by Mark Horridge .
Other GAMS interfaces from/to: ShadeMap Gnuplot Stata Powerpoint Html Awk
Modifications from Tom Rutherford's Interface
1) A GAMS system subdirectory .\gislib is needed and used to store the data to produce maps
2) There are three files for each map being stored in <gams system directory>\gislib
:
a) <map
ID>.mif
b) <map ID>.mid
c) <map ID>_sm.gms
3) The file mapsets.exe is no longer used and needed
4) shademap.gms has been modified
5) Several maps can be executed once.
1) Extract files for Shademap program to GAMS system directory
2) Place shademap.gms in .\inclib subdirectory of GAMS system
3) Create .\gislib subdirectory of GAMS system
4) Place three files for each map in the .\gislib subdirectory of GAMS system. You can create these files on your own (see description below) or download the available maps from below:
|
Map ID |
A map is invoked through the following statement in your GAMS program.
$libinclude shademap <map ID> <Parameter>
for example:
Set yoursetname /<firstmapelement, ... ,
lastmapelement>/;
Parameter v(yoursetname )
Shade Values for the Map of Europe;
v(yoursetname) = uniform(0.5,1);
[format options - see below]
v(yoursetname) =
uniform(0.5,1);
$libinclude shademap Europe v
v(yoursetname) =
uniform(2,3);
$libinclude shademap Europe v
Format Options (the values of the global variables are case sensitive. "False" may not work, but "false" does.)
$setglobal sm_LineWidth 0
$setglobal sm_FontSize 6
$setglobal
sm_SpaceAround 10
$setglobal sm_DesiredWidth 700
$setglobal sm_yytrans
120
$setglobal sm_xDistort 0
$setglobal sm_yDistort 0
$setglobal
sm_DotCentroids false
$setglobal sm_DotPolyStarts false
$setglobal
sm_UseGreys false
$setglobal sm_OrdinalShades false
$setglobal
sm_RGBScores false
$setglobal sm_NumberRegions false
$setglobal
sm_ShowScores false
$setglobal sm_ShowNames false
$setglobal
sm_NumberRegionPatch false
$setglobal sm_ScoreNDec 1
$setglobal
sm_LegendPos "10 70"
$setglobal sm_LowColor blue
$setglobal sm_MidColor
red
$setglobal sm_HighColor mediumorchid
$setglobal sm_ShowLegend
true
$setglobal sm_TitlePos "70 95"
$setglobal sm_Title "My Plot
Title"
$setglobal sm_BackgroundColor orangered
$setglobal sm_AutoScale
false
$setglobal sm_ScaleBounds "0 50"
sm_LowColor
sm_MidColor
sm_HighColor
sm_BackgroundColor
You can loop over shademap statements.
Outside the loop, place the following statement:
$libinclude shademap <map ID> loop
If you want to see the loop element in the title, put the following statement(s) below before the loop:
$setglobal sm_loop1 MyScenarioSet1
$setglobal sm_loop2 MyScenarioSet2
$setglobal sm_loop3 MyScenarioSet3
Inside the loop, as before place
$libinclude shademap <map ID> <Parameter>
for example:
$libinclude shademap <map ID> loop
$setglobal sm_loop1 MyScenarioSet1
$setglobal sm_loop2 MyScenarioSet2
$setglobal sm_loop3 MyScenarioSet3
$setglobal sm_Title "This plot
shows: "
LOOP( (MyScenarioSet1, MyScenarioSet2,MyScenarioSet3),
$libinclude shademap <map ID> <Parameter>
);
The quality of maps is usually higher than the quality of the maps below.
World Countries
Europe NUTS2
Europe
The Contiguous US States
All US States
US Counties
The 10 US FASOM Regions
The 11 GGI-FASOM Regions
The following steps describe how to create new maps using ArcView 3.x or Mapinfo. With a special data exporting script (for download below), one can create two files for each map using Arcview. These files, however, must be further processed in order to match the required format for shademap. I have written small awk scripts for use with GAMS that do the job. These awk scripts will be used if you follow the steps below.
1) Run this script in ArcView 3.x on the map you want. This should give you a <yourmapname>.mif and a <yourmapname>.mid file. Note that the script may not work with other versions of ArcView, i.e. ArcView 9.x.
2) Create a new directory of your choice
3) Change the name of the <yourmapname>.mif
file into <yourmapname>_mif.gis
Change
the name of the <yourmapname>.mid file into
<yourmapname>_mid.gis
4) Place <yourmapname>_mif.gis and <yourmapname>_mid.gis into a GIS subdirectory of your new directory
5) Extract these files in the new directory and open a GAMS project in your new directory. The following files should be in this directory:
6) Open file 1_prepare.gms
7) Place <yourmapname> as additional set element in the set mapname.
8) Select from the set mapname all maps (each element identifies a map) you want to prepare
8) Run 1_prepare.gms (This will create 2_runawk.gms and 3_putfiles.gms )
9) Open 2_runawk.gms and 3_putfiles.gms and execute sequentially (3_putfiles.gms will produce one or more maps called 4_map_<map ID>.gms)
10) Run 4_map_<map ID>.gms files to check whether it works
Map enhancement
Mark Horridge has written a DOS tool to improve maps (download cleanmap.exe)
Syntax: takes 2 filenames (WITHOUT extensions) and a number as parameters:
cleanmap inmapnam outmapnam frac
| inmapnam | name of existing MapInfo region boundaries files (suffixed MIF/MID) | |
| outmapnam | name of new MapInfo region boundaries files (suffixed MIF/MID) | |
| frac | fraction (eg, 0.01) remove polygons area < frac*largest poly in region | |
| tol (optional) | remove polygons area < tol. The largest polygon in a region is never removed. |