CFX_mapDatav1.0Sept. 2004 |
|---|
Each region on the map should use one distinct, and only one, color from the palette. This way, the tag is able to change the color of all pixels in any region, just by changing the color these pixels use in the palette. This implies that a theoretical maximum of 256 regions can be shown on the map. All colors not used for regions may be used for the rest of the image, like backgrounds and titles. See an example with this map of Canada.
See examples with maps of Canada, France and United States
In order to use this tag, you first need to take the included mapData.dll; install it on a drive on your server and make it known to the ColdFusion administrator.
You do this by going to the "CFX Tags" tab in the administrator,
The other files are this documentation (mapDataDoc.cfm), and a couple of templates for the examples; just store them in any convenient place in the HTTP area on your development server.
Finally, if you want to run the examples from your server, you need to define a datasourece "mapData" on the Access file mapData.mdb.
<CFX_mapData MAPFILE = "" QUERY = "" DATACOLUMN = "" COLORCOLUMN = "" MINVALUE = "" STEP = "" NBSTEPS = "" SCALELIST = "" COLORLIST = "" NULLCOLOR = "" OUTFILE = "" > <CF_mapKey MINVALUE = "" STEP = "" NBSTEPS = "" SCALELIST = "" COLORLIST = "" > The attributes for CF_mapKey are the same as for CFX_mapData. Examples |
| TAG | ATTRIBUTE | CONTENT | REQUIRED | DEFAULT |
|---|---|---|---|---|
| <CFX_mapData | MAPFILE= | Full path name of the image file on the server. The file must have an extension GIF and must be a valid GIF image. | Yes | "mapData" |
| QUERY= | Name of the query to be used to read data and colors associated to regions. | Yes | ||
| DATACOLUMN= | Name of the column in the query containing the data to be used to calculate the color. | Yes | ||
| COLORCOLUMN= | Name of the column in the query containing the index in the gif palette associated to each region. This attribute is optional but, if it is not supplied, COLORLIST should be used. | Yes | ||
| MINVALUE= | Minimum value to be considered when calculating colors. | No | 0 | |
| STEP= | Difference between the values in two consecutive color zones. This attribute may be omitted if a scale list is supplied instead. | No | ||
| NBSTEPS= | Number of different data zones to calculate. The first will contain all data between MINVALUE and MINVALUE + STEP, the second between MINVALUE + STEP and MINVALUE + STEP*2, and so on. This attribute may be omitted if a scale list is supplied instead. | No | ||
| SCALELIST= | Comma separated list of scale values. This attribute may be used instead of STEP and NBSTEPS as an alternative way to define how the values range must be subdivided. This way permits non linear scales to be used. | No | ||
| COLORLIST= | Comma separated list of colors. These colors will be used to calculate intermediate colors for each step in the scale of colors by linear interpolation. A minimum of two colors must be given, but more can be given for more accurate and richer scale of colors. | Yes | ||
| NULLCOLOR= | Hexadecimal RGB value of the color to be used for null values in the DATACOLUMN. Most of the time, one will use blank ("FFFFFF"). | No | OUTFILE= | An optional full file name for saving the image on the server. This may be used to save the gif file for further use in case one wants to generate a map for data that will not change in time. | Yes |
Take for instance the maps for the population ratio in the United States. If one want to publish these maps for every year for the last century, it would mean 600 different maps, and it is very unlikely that all of them will ever be requested by visistors. Preparing all of them once for all would be a hudge task. The trick is then to create the map on the fly, as users request them. CFX_mapData is then an ideal solution for this kind of situation.