[Mapserver-users] PHP MapScript problem (use of undefined constant)
Armin Burger
armin.burger at libero.it
Tue Sep 2 14:11:31 PDT 2003
Geoffrey,
are you using Mapserver 4? Then you have to define the image format
before:
$map->selectOutputFormat("swf");
$image=$map->draw();
$image_url=$image->saveWebImage();
Armin
> 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
More information about the MapServer-users
mailing list