loadMap(): Web application error. CGI variable \'map\' is not set.

Brad Neuhauser neuhausr at BITSTREAM.NET
Sun Mar 25 13:01:11 PDT 2007


Jason,

I think you're having problems because in your html page, you've got a
form to call the  legend nested within the larger form, which I think is a
no-no.

Hope this helps,
Brad

> Hello all:
>
> Building my first map and I can't get passed an error I keep getting.
> "(loadMap
> (): Web application error. CGI variable "map" is not set.)"
>
> THe first html page loads my map image correctly after starting mapserver
> but
> when I click on the image to zoom in, etc, i get the error.
>
> Any thoughts?
>
> Map file...(html page follows)
>
> # Map file created from QGIS project file C:/wwwroot/map/canada map.qgs
> # Edit this file to customize for your map interface
> MAP
> 	SIZE 600 457
> 	EXTENT -145.954 26.8972 -47.2402 97.3579
> 	UNITS dd
> 	IMAGECOLOR 255 255 255
>
>   SCALEBAR
>     STATUS on
>     UNITS KILOMETERS
>     INTERVALS 3
>     TRANSPARENT TRUE
>     OUTLINECOLOR 0 0 0
>   END
>
>   # Legend
>   LEGEND
>     IMAGECOLOR 255 255 255
>     STATUS ON
>     KEYSIZE 18 12
>     LABEL
>       TYPE BITMAP
>       SIZE MEDIUM
>       COLOR 0 0 89
>     END
>   END
>
>   #Reference Map
>   REFERENCE
> 	STATUS ON
> 	IMAGE reference.png
> 	EXTENT -180 -90 180 90
> 	SIZE 241 121
> 	COLOR -1 -1 -1
> 	OUTLINECOLOR 255 0 0
>   END
>
> WEB
>     IMAGEPATH "\ms4w\tmp\ms_tmp\"
> 	IMAGEURL "/ms_tmp/"
> 	TEMPLATE "template.html"
> END
>
>   LAYER
>     NAME 'LANDSAT'
>     TYPE RASTER
>     DATA 'C:/wwwroot/map/canada.tif'
>     METADATA
>       'wms_title' 'LANDSAT'
>     END
>     STATUS OFF
>     TRANSPARENCY 100
>     PROJECTION
>     'proj=longlat'
>     'ellps=GRS80'
>     'datum=NAD83'
>     'no_defs'
>     ''
>     END
>   END
>
>   LAYER
>     NAME 'provinces'
>     TYPE POLYGON
>     DATA 'C:/wwwroot/map/province_dd.shp'
>     METADATA
>       'wms_title' 'Provincal Boundaries'
>     END
>     STATUS DEFAULT
>     TRANSPARENCY 35
>     PROJECTION
>     'proj=longlat'
>     'ellps=GRS80'
> 	'datum=NAD83'
>     'no_defs'
>     END
>     CLASSITEM 'NAME_ENG'
>     CLASS
>       NAME 'Provincial boundary of Alberta'
>       EXPRESSION 'Alberta'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 170 170 127
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Provincial boundary of British Columbia'
>       EXPRESSION 'British Columbia'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 0 170 0
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Provincial boundary of Manitoba'
>       EXPRESSION 'Manitoba'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 85 85 127
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Provincial boundary of New Brunswick'
>       EXPRESSION 'New Brunswick'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 255 255 127
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Provincial boundary of Newfoundland'
>       EXPRESSION 'Newfoundland'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 0 0 127
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Territorial boundary of Northwest Territories'
>       EXPRESSION 'Northwest Territories'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 118 61 220
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Provincial boundary of Nova Scotia'
>       EXPRESSION 'Nova Scotia'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 85 255 255
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Territorial boundary of Nunavut'
>       EXPRESSION 'Nunavut'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 0 85 0
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Provincial boundary of Ontario'
>       EXPRESSION 'Ontario'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 232 0 0
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Provincial boundary of Prince Edward Island'
>       EXPRESSION 'Prince Edward Island'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 215 7 96
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Provincial boundary of Quebec'
>       EXPRESSION 'Quebec'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 255 0 255
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Provincial boundary of Saskatchewan'
>       EXPRESSION 'Saskatchewan'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 170 150 50
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>     CLASS
>       NAME 'Territorial boundary of Yukon Territory'
>       EXPRESSION 'Yukon Territory'
>       STYLE
>         SYMBOL 0
>          OUTLINECOLOR 0 0 0
>          COLOR 70 150 177
>        END
>      LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>   END
>
>   LAYER
> 	NAME 'province_labels'
> 	TYPE ANNOTATION
> 	STATUS default
> 	DATA province_dd.shp
> 	LABELITEM 'NAME_ENG'
> 		LABELMAXSCALE 2250000
> 	CLASS
> 		LABEL
> 			COLOR 255 255 255
> 			OUTLINECOLOR 0 0 0
> 			POSITION LR
> 			MINFEATURESIZE 10
> 			MINDISTANCE 10
> 		END # End for label
> 	END # end for class
> 	PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
> 	END # End for projection
> END # End for layer
>
>
>   LAYER
>     NAME 'Large Water'
>     TYPE POLYGON
>     DATA 'C:/wwwroot/map/big_water.shp'
>     METADATA
>       'wms_title' 'Large Water'
>     END
>     STATUS OFF
>     TRANSPARENCY 100
>     PROJECTION
>     'proj=longlat'
>     'ellps=GRS80'
>     'datum=NAD83'
>     'no_defs'
>     END
> 	LABELITEM 'NAME'
> 		LABELMAXSCALE 250000
>     CLASS
>        NAME "Large Lakes"
>        STYLE
>          SYMBOL 0
>          SIZE 6
>          OUTLINECOLOR 0 0 255
>          COLOR 85 170 225
>        END
> 	  LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>   END
>
>   LAYER
>     NAME 'Small Water'
>     TYPE POLYGON
>     DATA 'C:/wwwroot/Map/small_water.shp'
>     METADATA
>       'wms_title' 'Small Water'
>     END
>     STATUS OFF
>     TRANSPARENCY 100
>     PROJECTION
>     'proj=longlat'
>     'ellps=GRS80'
>     'datum=NAD83'
>     'no_defs'
>     ''
>     END
> 	LABELITEM 'NAME'
> 		LABELMAXSCALE 250000
>     CLASS
>        NAME "Small Lakes"
>        STYLE
>          SYMBOL 0
>          SIZE 6
>          OUTLINECOLOR 0 0 255
>          COLOR 85 170 255
>        END
> 	  LABEL
>       SIZE medium
>       COLOR 0 0 0
>       ANGLE 0
>       BUFFER 0
>      END
>     END
>   END
>
>   LAYER
>     NAME 'Roads'
>     TYPE LINE
>     DATA 'C:/wwwroot/map/mjrroads_1-3.shp'
>     METADATA
>       'wms_title' 'Roads'
>     END
>     STATUS OFF
> 	TRANSPARENCY 100
>     PROJECTION
>     'proj=longlat'
>     'ellps=GRS80'
>     'datum=NAD83'
>     'no_defs'
>     END
> 	CLASS
>        NAME "Roads"
>        STYLE
>          SYMBOL 0
>          SIZE 6
>          OUTLINECOLOR 170 94 58
>          COLOR 0 0 0
>        END
>     END
>   END
>
>   LAYER
> 	NAME 'road_labels'
> 	TYPE ANNOTATION
> 	STATUS OFF
> 	DATA mjrroads_1-3.shp
> 	LABELITEM 'NAME'
> 	CLASS
> 		LABEL
> 			COLOR 255 255 255
> 			OUTLINECOLOR 0 0 0
> 			POSITION LR
> 		END # End for label
> 	END # end for class
> 	PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
> 	END # End for projection
> END # End for layer
>
>   LAYER
>     NAME 'capitals'
>     TYPE POINT
>     DATA 'C:/wwwroot/map/capitals_cities.shp'
>     METADATA
>       'wms_title' 'Provincial Capitals'
>     END
>     STATUS OFF
> 	TRANSPARENCY 100
>     PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
>     END
>     CLASS
>        NAME "Provincial Capitals"
>        STYLE
>          SYMBOL 'CIRCLE'
>          SIZE 6
>          OUTLINECOLOR 0 0 0
>          COLOR 255 0 0
>        END
>     END
>   END
>
>   LAYER
> 	NAME 'capitals_labels'
> 	TYPE ANNOTATION
> 	STATUS OFF
> 	DATA capitals_cities.shp
> 	LABELITEM 'NAME'
> 		LABELMAXSCALE 2000000
> 	CLASS
> 		LABEL
> 			COLOR 255 255 255
> 			OUTLINECOLOR 0 0 0
> 			POSITION LR
> 		END # End for label
> 	END # end for class
> 	PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
> 	END # End for projection
> END # End for layer
>
>   LAYER
>     NAME 'Major Cities'
>     TYPE POINT
>     DATA 'C:/wwwroot/map/major_cities.shp'
>     METADATA
>       'wms_title' 'Major Cities'
>     END
>     STATUS OFF
>     TRANSPARENCY 100
>     PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
>     END
>     CLASS
>        NAME "Major Cities"
>        STYLE
>          SYMBOL 'CIRCLE'
>          SIZE 6
>          OUTLINECOLOR 0 0 0
>          COLOR 255 255 0
>        END
>     END
>   END
>
>   LAYER
> 	NAME 'major_cities_labels'
> 	TYPE ANNOTATION
> 	STATUS OFF
> 	DATA major_cities.shp
> 	LABELITEM 'NAME'
> 		LABELMAXSCALE 2000000
> 	CLASS
> 		LABEL
> 			COLOR 255 255 255
> 			OUTLINECOLOR 0 0 0
> 			POSITION LR
> 		END # End for label
> 	END # end for class
> 	PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
> 	END # End for projection
> END # End for layer
>
>   LAYER
>     NAME 'other_sites'
>     TYPE POINT
>     DATA 'C:/wwwroot/map/other_sites.shp'
>     METADATA
>       'wms_title' 'Other Sites to See'
>     END
>     STATUS OFF
> 	TRANSPARENCY 100
>     PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
>     END
>     CLASS
>        NAME "Other Sites to See"
>        STYLE
>          SYMBOL 'CIRCLE'
>          SIZE 6
>          OUTLINECOLOR 0 0 0
>          COLOR 255 170 0
>        END
>     END
>   END
>
>   LAYER
> 	NAME 'other_sites_labels'
> 	TYPE ANNOTATION
> 	STATUS OFF
> 	DATA other_sites.shp
> 	LABELITEM 'OtherSites'
> 		LABELMAXSCALE 2000000
> 	CLASS
> 		LABEL
> 			COLOR 255 255 255
> 			OUTLINECOLOR 0 0 0
> 			POSITION LR
> 		END # End for label
> 	END # end for class
> 	PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
> 	END # End for projection
> END # End for layer
>
>   LAYER
>     NAME 'sites'
>     TYPE POINT
>     DATA 'C:/wwwroot/map/sites.shp'
>     METADATA
>       'wms_title' 'National Historic Sites of Canada'
>     END
>     STATUS OFF
>     TRANSPARENCY 100
>     PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
>     END
> 	CLASS
>        NAME "National Historic Sites of Canada"
>        STYLE
>          SYMBOL 'CIRCLE'
>          SIZE 6
>          OUTLINECOLOR 0 0 0
>          COLOR 170 0 127
>        END
>     END
>   END
>
>   LAYER
> 	NAME 'sites_labels'
> 	TYPE ANNOTATION
> 	STATUS OFF
> 	DATA sites.shp
> 	LABELITEM 'NationalHi'
> 		LABELMAXSCALE 2000000
> 	CLASS
> 		LABEL
> 			COLOR 255 255 255
> 			OUTLINECOLOR 0 0 0
> 			POSITION LR
> 		END # End for label
> 	END # end for class
> 	PROJECTION
> 		'proj=longlat'
> 		'ellps=GRS80'
> 		'datum=NAD83'
> 		'no_defs'
> 	END # End for projection
> END # End for layer
>
>     #Circle symbol
>       SYMBOL
>         NAME 'CIRCLE'
>         TYPE ellipse
>         FILLED true
>         POINTS
>           1 1
>         END
>       END
> END
>
>
> (end of map file)
>
> begin html page...
>
> <html>
> <head>
> <title>Road Map of Canada</title>
> </head>
> <body>
> <center style="font-family: Tahoma;" style="font-size:80%">
> <h2>Road Map of Canada</h2>
> </center>
>
> <form style="font-family: Tahoma;" style="font-size:80%" method="GET"
> action="/cgi-bin/mapserv.exe"> <input name="img" src="[img]" alt="Road Map
> of Canada" align="left" border="1" height="[mapheight]" type="image"
> width="[mapwidth]">
> <br>
>
> <table width="350">
> <tbody>
>     <tr>
> 		<td>Zoom In <INPUT type=radio name=zoomdir value=1
> [zoomdir_1_check]></td>
> 		<td>Re-center <INPUT type=radio name=zoomdir value=0
> [zoomdir_0_check]></td>
> 		<td>Zoom out <INPUT type=radio name=zoomdir value=-1
> [zoomdir_-1_check]></td>
> 		<td>Zoom Size <INPUT type=text name=zoomsize size=1
> value=[zoomsize]></td>
>     </tr>
> </tbody>
> </table>
>
> <br>
>
> <table style="width: 350px; height: 350px;" style="font-family: Tahoma;"
> style="font-size:100%">
>   <tbody>
>    <tr>
>       <td style="text-align: left;"><a href="help.html#layers"
> target="_blank"
> style="text-decoration:none"><b>Layers</b></a></td>
>       <td style="text-align: left;"><a href="help.html#labels"
> target="_blank"
> style="text-decoration:none"><b>Labels</b></a></td>
>     </tr>
>     <tr>
>       <td><INPUT type="checkbox" name="layer" value="Roads"  [Roads_check]
>> Roads</td>
>       <td><INPUT type="checkbox" name="layer" value="road_labels"
> [road_labels_check]> Label Roads</td>
>     </tr>
>      <tr>
>       <td><INPUT type="checkbox" name="layer" value="Major Cities" [Major
> Cities_check]> Major Cities</td>
>       <td><INPUT type="checkbox" name="layer" value="major_cities_labels"
> [major_cities_labels_check]> Label Major Cities</td>
>     </tr>
>     <tr>
>       <td><INPUT type="checkbox" name="layer" value="capitals"
> [capitals_check]> Provincial Capitals</td>
>       <td><INPUT type="checkbox" name="layer" value="capitals_labels"
> [capitals_labels_check]> Label Capital Cities</td>
>     </tr>
>     <tr>
>       <td><INPUT type="checkbox" name="layer" value="sites" [sites_check]>
> National Historic Sites</td>
>       <td><INPUT type="checkbox" name="layer" value="sites_labels"
> [sites_labels_check]> Label Historic Sites</td>
>     </tr>
>     <tr>
>       <td><INPUT type="checkbox" name="layer" value="other_sites"
> [other_sites_check]> More sites to see</td>
>       <td><INPUT type="checkbox" name="layer" value="other_sites_labels"
> [other_sites_labels_check]> Label other sites</td>
>     </tr>
> 	<tr>
>       <td><INPUT type="checkbox" name="layer" value="Large Water" [Large
> Water_check]> Large Water</td>
> 	  <td><INPUT type="submit" value="Redraw" width="15"></td>
>     </tr>
>     <tr>
>       <td><INPUT type="checkbox" name="layer" value="Small Water" [Small
> Water_check] > Small Water</td>
>     </tr>
>     <tr>
>       <td><INPUT type="checkbox" name="layer" value="LANDSAT"
> [LANDSAT_check]> LANDSAT image</td>
>     <td><script type="text/javascript">
> function open_win()
> {
> window.open("[legend]","_blank","toolbar=no, location=no, directories=no,
> status=yes, menubar=no, scrollbars=no, resizable=yes, copyhistory=no,
> width=375, height=425")
> }
> </script>
> <form> <INPUT value="Legend" onclick="open_win()" type="button">
> </form>
> </tr>
> </tbody>
> </table>
> <br>
> <br>
> <table width="100%" style="font-family: Tahoma;" style="font-size:75%">
> 	<tbody>
> 			<tr>
> 			<td><img style="font-family: Tahoma;"
> src="[scalebar]" alt="Scale"></td>
> 			<td><a href="help.html" style="font-family:
> Tahoma;">Help</a></td>
> <td><INPUT name="ref" TYPE="image" SRC="[ref]" width="240" height="120"
> ALT="Reference Map"></td>
> </tr>
> </tbody>
> </table>
>
> </center>
> </center>
>
> <input name="imgxy" value="[center]" type="hidden">
> <input name="imgext" value="[mapext]" type="hidden">
> <input name="map" value="/wwwroot/map/canada.map" type="hidden">
> <input name="mapext" value="shapes" type="hidden">
> <input name="savequery" value="true" type="hidden">
> </form>
> </body>
> </html>
>
>
>



More information about the MapServer-users mailing list