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

Geoffrey Rowland geoffrey.rowland at noaa.gov
Tue Sep 2 11:46:40 PDT 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).  any idea what may
be causing this?<br>
<br>
<?<br>
         $map = ms_newMapObj("pop.map");<br>
         $image=$map->draw();<br>
         $image_url=$image->saveWebImage(MS_SWF,1,1,0);<br>
        <br>
         ?><br>
        <br>
          <HTML><br>
              <HEAD><br>
                 <TITLE>Example 1: Displaying a map</TITLE><br>
             </HEAD><br>
             <BODY><br>
                 <IMG SRC=<?php echo $image_url; ?> ><br>
             </BODY><br>
         </HTML><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>
        NAME swf <br>
        MIMETYPE "application/x-shockwave-flash" <br>
        DRIVER swf <br>
        IMAGEMODE PC256 <br>
        FORMATOPTION "OUTPUT_MOVIE=MULTIPLE" <br>
      END <br>
<br>
<br>
#PROJECTION<br>
#  "proj=latlong"<br>
#END<br>
<br>
WEB<br>
  HEADER us_header.html<br>
  TEMPLATE temp.html<br>
  FOOTER us_footer.html<br>
  LOG popmapserver.log<br>
  MINSCALE 1<br>
  MAXSCALE 36335600 <br>
  IMAGEPATH "d:/Inetpub/pop/swf/"<br>
  IMAGEURL <a class="moz-txt-link-rfc2396E" href="http://localhost/pop/swf/">"http://localhost/pop/swf/"</a><br>
  METADATA<br>
   WMS_TITLE "United States County Data"<br>
   WMS_ABSTRACT "This is a demonstration of using Mapserver to display
the County data set."<br>
   WMS_ACCESSCONSTRAINTS none<br>
  <br>
   WMS_SRS "EPSG:4269"<br>
  END # End Metadata<br>
END # End Web <br>
<br>
QUERYMAP<br>
  SIZE 200 200<br>
  STATUS ON<br>
  STYLE HILITE<br>
  COLOR 255 0 0<br>
END<br>
<br>
<br>
#<br>
# Start of legend<br>
#<br>
LEGEND<br>
  KEYSIZE 18 12<br>
  LABEL<br>
    TYPE BITMAP<br>
    SIZE MEDIUM<br>
    COLOR 0 0 89<br>
  END<br>
  STATUS ON<br>
END<br>
<br>
#<br>
# Start of scalebar<br>
#<br>
SCALEBAR<br>
  IMAGECOLOR 255 255 255<br>
  LABEL<br>
    COLOR 255 255 255<br>
    SIZE tiny    <br>
  END<br>
  STYLE 1<br>
  SIZE 80 2<br>
  COLOR 255 255 255<br>
  UNITS MILES<br>
  INTERVALS 1<br>
  TRANSPARENT TRUE<br>
  STATUS TRUE<br>
END<br>
<br>
  <br>
<br>
<br>
LAYER<br>
  NAME states<br>
  METADATA<br>
    "DESCRIPTION" "States"<br>
    "RESULT_FIELDS" "State_Name Pop1999"<br>
    "SWFDUMPATTRIBUTES" "State_Name,Pop1999"<br>
  END<br>
  TYPE POLYGON<br>
  STATUS ON<br>
  DATA states<br>
 <br>
<br>
CLASSITEM 'Pop1999'<br>
NAME Pop1999<br>
TEMPLATE us_pop.html<br>
CLASS<br>
  EXPRESSION ([Pop1999] > 0 and [Pop1999] < 2135252)<br>
  COLOR 254 240 217<br>
  OUTLINECOLOR 128 128 128<br>
END<br>
<br>
CLASS<br>
  EXPRESSION ([Pop1999] >   2135251 and [Pop1999] < 4970311)<br>
  COLOR 253 212 158<br>
  OUTLINECOLOR 128 128 128<br>
END<br>
<br>
CLASS<br>
  EXPRESSION ([Pop1999] > 4970310 and [Pop1999] < 9866640)<br>
  COLOR 253 187 132<br>
  OUTLINECOLOR 128 128 128<br>
END<br>
<br>
CLASS<br>
  EXPRESSION ([Pop1999] > 9866639 and [Pop1999] < 20127338)<br>
  COLOR 252 141 89<br>
  OUTLINECOLOR 128 128 128<br>
END<br>
<br>
CLASS<br>
  EXPRESSION ([Pop1999] >   20127337 )<br>
  COLOR 227 74 51<br>
  OUTLINECOLOR 128 128 128<br>
END<br>
<br>
<br>
<br>
END # end class<br>
  <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