[Mapserver-users] PHP MapScript problem (use of undefined constant)

Geoffrey Rowland geoffrey.rowland at noaa.gov
Tue Sep 2 14:46:40 EDT 2003


This is a multi-part message in MIME format.
--------------020104020707010103090708
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Notice: Use of undefined constant MS_SWF - assumed 'MS_SWF' in 
D:\Inetpub\CIP ROOT BETA\wnv\wnv_pop.php on line 4

this will have the same notice no matter what type of file i try to 
output...and the image doesn't output (nothing is written in the 
directory that i specified to use in my map file).  any idea what may be 
causing this?

<?
         $map = ms_newMapObj("pop.map");
         $image=$map->draw();
         $image_url=$image->saveWebImage(MS_SWF,1,1,0);
       
         ?>
       
          <HTML>
              <HEAD>
                 <TITLE>Example 1: Displaying a map</TITLE>
             </HEAD>
             <BODY>
                 <IMG SRC=<?php echo $image_url; ?> >
             </BODY>
         </HTML>

map file

#
# Start of map file
#
NAME "PopTest"
STATUS ON
SIZE 600 600
EXTENT -178.227822 18.913826 -66.949831 71.38269
UNITS dd
SHAPEPATH "data"
IMAGECOLOR 255 255 255


#IMAGETYPE PNG

OUTPUTFORMAT
        NAME swf
        MIMETYPE "application/x-shockwave-flash"
        DRIVER swf
        IMAGEMODE PC256
        FORMATOPTION "OUTPUT_MOVIE=MULTIPLE"
      END


#PROJECTION
#  "proj=latlong"
#END

WEB
  HEADER us_header.html
  TEMPLATE temp.html
  FOOTER us_footer.html
  LOG popmapserver.log
  MINSCALE 1
  MAXSCALE 36335600
  IMAGEPATH "d:/Inetpub/pop/swf/"
  IMAGEURL "http://localhost/pop/swf/"
  METADATA
   WMS_TITLE "United States County Data"
   WMS_ABSTRACT "This is a demonstration of using Mapserver to display 
the County data set."
   WMS_ACCESSCONSTRAINTS none
 
   WMS_SRS "EPSG:4269"
  END # End Metadata
END # End Web

QUERYMAP
  SIZE 200 200
  STATUS ON
  STYLE HILITE
  COLOR 255 0 0
END


#
# Start of legend
#
LEGEND
  KEYSIZE 18 12
  LABEL
    TYPE BITMAP
    SIZE MEDIUM
    COLOR 0 0 89
  END
  STATUS ON
END

#
# Start of scalebar
#
SCALEBAR
  IMAGECOLOR 255 255 255
  LABEL
    COLOR 255 255 255
    SIZE tiny   
  END
  STYLE 1
  SIZE 80 2
  COLOR 255 255 255
  UNITS MILES
  INTERVALS 1
  TRANSPARENT TRUE
  STATUS TRUE
END

 


LAYER
  NAME states
  METADATA
    "DESCRIPTION" "States"
    "RESULT_FIELDS" "State_Name Pop1999"
    "SWFDUMPATTRIBUTES" "State_Name,Pop1999"
  END
  TYPE POLYGON
  STATUS ON
  DATA states
 

CLASSITEM 'Pop1999'
NAME Pop1999
TEMPLATE us_pop.html
CLASS
  EXPRESSION ([Pop1999] > 0 and [Pop1999] < 2135252)
  COLOR 254 240 217
  OUTLINECOLOR 128 128 128
END

CLASS
  EXPRESSION ([Pop1999] >   2135251 and [Pop1999] < 4970311)
  COLOR 253 212 158
  OUTLINECOLOR 128 128 128
END

CLASS
  EXPRESSION ([Pop1999] > 4970310 and [Pop1999] < 9866640)
  COLOR 253 187 132
  OUTLINECOLOR 128 128 128
END

CLASS
  EXPRESSION ([Pop1999] > 9866639 and [Pop1999] < 20127338)
  COLOR 252 141 89
  OUTLINECOLOR 128 128 128
END

CLASS
  EXPRESSION ([Pop1999] >   20127337 )
  COLOR 227 74 51
  OUTLINECOLOR 128 128 128
END



END # end class
 
END # end layer


END # end Map File

-- 
Geoffrey Rowland
Technical Officer
Climate Information Project
NOAA Research
Office of  Global Programs
http://www.cip.ogp.noaa.gov
Contractor, 
RGII Technologies, Inc., a Computer Horizons Company
http://www.rg2.com
Phone: 301-427-2089x186
Fax : 301-427-2082
geoffrey.rowland at noaa.gov














--------------020104020707010103090708
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
<b>Notice</b>: Use of undefined constant MS_SWF - assumed 'MS_SWF' in <b>D:\Inetpub\CIP
ROOT BETA\wnv\wnv_pop.php</b> on line <b>4<br>
<br>
</b>this will have the same notice no matter what type of file i try to
output...and the image doesn't output (nothing is written in the
directory that i specified to use in my map file).&nbsp; any idea what may
be causing this?<br>
<br>
&lt;?<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$map = ms_newMapObj("pop.map");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$image=$map-&gt;draw();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$image_url=$image-&gt;saveWebImage(MS_SWF,1,1,0);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;?&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &lt;HTML&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &lt;HEAD&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;TITLE&gt;Example 1: Displaying a map&lt;/TITLE&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &lt;/HEAD&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &lt;BODY&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;IMG SRC=&lt;?php echo $image_url; ?&gt; &gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &lt;/BODY&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;/HTML&gt;<br>
<br>
map file<br>
<br>
#<br>
# Start of map file<br>
#<br>
NAME "PopTest"<br>
STATUS ON<br>
SIZE 600 600<br>
EXTENT -178.227822 18.913826 -66.949831 71.38269<br>
UNITS dd<br>
SHAPEPATH "data"<br>
IMAGECOLOR 255 255 255<br>
<br>
<br>
#IMAGETYPE PNG<br>
<br>
OUTPUTFORMAT <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NAME swf <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MIMETYPE "application/x-shockwave-flash" <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DRIVER swf <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMAGEMODE PC256 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FORMATOPTION "OUTPUT_MOVIE=MULTIPLE" <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END <br>
<br>
<br>
#PROJECTION<br>
#&nbsp; "proj=latlong"<br>
#END<br>
<br>
WEB<br>
&nbsp; HEADER us_header.html<br>
&nbsp; TEMPLATE temp.html<br>
&nbsp; FOOTER us_footer.html<br>
&nbsp; LOG popmapserver.log<br>
&nbsp; MINSCALE 1<br>
&nbsp; MAXSCALE 36335600 <br>
&nbsp; IMAGEPATH "d:/Inetpub/pop/swf/"<br>
&nbsp; IMAGEURL <a class="moz-txt-link-rfc2396E" href="http://localhost/pop/swf/">"http://localhost/pop/swf/"</a><br>
&nbsp; METADATA<br>
&nbsp;&nbsp; WMS_TITLE "United States County Data"<br>
&nbsp;&nbsp; WMS_ABSTRACT "This is a demonstration of using Mapserver to display
the County data set."<br>
&nbsp;&nbsp; WMS_ACCESSCONSTRAINTS none<br>
&nbsp; <br>
&nbsp;&nbsp; WMS_SRS "EPSG:4269"<br>
&nbsp; END # End Metadata<br>
END # End Web <br>
<br>
QUERYMAP<br>
&nbsp; SIZE 200 200<br>
&nbsp; STATUS ON<br>
&nbsp; STYLE HILITE<br>
&nbsp; COLOR 255 0 0<br>
END<br>
<br>
<br>
#<br>
# Start of legend<br>
#<br>
LEGEND<br>
&nbsp; KEYSIZE 18 12<br>
&nbsp; LABEL<br>
&nbsp;&nbsp;&nbsp; TYPE BITMAP<br>
&nbsp;&nbsp;&nbsp; SIZE MEDIUM<br>
&nbsp;&nbsp;&nbsp; COLOR 0 0 89<br>
&nbsp; END<br>
&nbsp; STATUS ON<br>
END<br>
<br>
#<br>
# Start of scalebar<br>
#<br>
SCALEBAR<br>
&nbsp; IMAGECOLOR 255 255 255<br>
&nbsp; LABEL<br>
&nbsp;&nbsp;&nbsp; COLOR 255 255 255<br>
&nbsp;&nbsp;&nbsp; SIZE tiny&nbsp;&nbsp;&nbsp; <br>
&nbsp; END<br>
&nbsp; STYLE 1<br>
&nbsp; SIZE 80 2<br>
&nbsp; COLOR 255 255 255<br>
&nbsp; UNITS MILES<br>
&nbsp; INTERVALS 1<br>
&nbsp; TRANSPARENT TRUE<br>
&nbsp; STATUS TRUE<br>
END<br>
<br>
&nbsp; <br>
<br>
<br>
LAYER<br>
&nbsp; NAME states<br>
&nbsp; METADATA<br>
&nbsp;&nbsp;&nbsp; "DESCRIPTION" "States"<br>
&nbsp;&nbsp;&nbsp; "RESULT_FIELDS" "State_Name Pop1999"<br>
&nbsp;&nbsp;&nbsp; "SWFDUMPATTRIBUTES" "State_Name,Pop1999"<br>
&nbsp; END<br>
&nbsp; TYPE POLYGON<br>
&nbsp; STATUS ON<br>
&nbsp; DATA states<br>
&nbsp;<br>
<br>
CLASSITEM 'Pop1999'<br>
NAME Pop1999<br>
TEMPLATE us_pop.html<br>
CLASS<br>
&nbsp; EXPRESSION ([Pop1999] &gt; 0 and [Pop1999] &lt; 2135252)<br>
&nbsp; COLOR 254 240 217<br>
&nbsp; OUTLINECOLOR 128 128 128<br>
END<br>
<br>
CLASS<br>
&nbsp; EXPRESSION ([Pop1999] &gt;&nbsp;&nbsp; 2135251 and [Pop1999] &lt; 4970311)<br>
&nbsp; COLOR 253 212 158<br>
&nbsp; OUTLINECOLOR 128 128 128<br>
END<br>
<br>
CLASS<br>
&nbsp; EXPRESSION ([Pop1999] &gt; 4970310 and [Pop1999] &lt; 9866640)<br>
&nbsp; COLOR 253 187 132<br>
&nbsp; OUTLINECOLOR 128 128 128<br>
END<br>
<br>
CLASS<br>
&nbsp; EXPRESSION ([Pop1999] &gt; 9866639 and [Pop1999] &lt; 20127338)<br>
&nbsp; COLOR 252 141 89<br>
&nbsp; OUTLINECOLOR 128 128 128<br>
END<br>
<br>
CLASS<br>
&nbsp; EXPRESSION ([Pop1999] &gt;&nbsp;&nbsp; 20127337 )<br>
&nbsp; COLOR 227 74 51<br>
&nbsp; OUTLINECOLOR 128 128 128<br>
END<br>
<br>
<br>
<br>
END # end class<br>
&nbsp; <br>
END # end layer<br>
<br>
<br>
END # end Map File<br>
<pre class="moz-signature" cols="72">-- 
Geoffrey Rowland
Technical Officer
Climate Information Project
NOAA Research
Office of  Global Programs
<a class="moz-txt-link-freetext" href="http://www.cip.ogp.noaa.gov">http://www.cip.ogp.noaa.gov</a>
Contractor, 
RGII Technologies, Inc., a Computer Horizons Company
<a class="moz-txt-link-freetext" href="http://www.rg2.com">http://www.rg2.com</a>
Phone: 301-427-2089x186
Fax : 301-427-2082
<a class="moz-txt-link-abbreviated" href="mailto:geoffrey.rowland at noaa.gov">geoffrey.rowland at noaa.gov</a>












</pre>
</body>
</html>

--------------020104020707010103090708--




More information about the mapserver-users mailing list