[mapserver-users] PHP MapScript inserting extra parameters into.map file

Ian iansgis at gmail.com
Thu Apr 9 15:02:22 EDT 2009


The display of the data still works, however the altered .map file is
no longer compatible with the OpenLayers wiki print.php code
(http://trac.openlayers.org/wiki/Printing). I can't figure out why. My
TileCache layers will still print but any layers coming from the PHP
MapScript-edited map file no longer work. print.php doesn't throw any
errors, the requested tiles all look valid, but the return is "500
Unexpected Error" and "Some unexpected error occurred. Error text was:
" with no error text. The relevant bits from my map file:

MAP
  EXTENT -180 -90 180 90
  FONTSET "/var/www/html/maps/fontset.txt"
  IMAGECOLOR 60 100 145
  IMAGETYPE png
  SYMBOLSET "/var/www/html/maps/symbols.sym"
  SHAPEPATH "data"
  SIZE 500 500
  STATUS ON
  UNITS DD
  NAME "My map"

  OUTPUTFORMAT
          NAME PNG24
          DRIVER "GD/PNG"
          MIMETYPE "image/png"
          IMAGEMODE RGB
          EXTENSION "png"
          FORMATOPTION "INTERLACE=OFF"
  END

  PROJECTION
    "init=epsg:4326"
  END
...
MAP


More is being changed by PHP MapScript than I realized, my
OUTPUTFORMAT block becomes:

OUTPUTFORMAT
    NAME "png"
    MIMETYPE "image/png"
    DRIVER "GD/PNG"
    EXTENSION "png"
    IMAGEMODE "PC256"
    TRANSPARENT FALSE
  END


The layer that I am dynamically changing starts as:

LAYER
  NAME "arrow"
  TYPE POLYGON
  PROJECTION
    "init=epsg:4326"
  END
  METADATA
    "wms_title" "arrow"
  END
  DATA shapefiles/arrow
  STATUS ON
  TRANSPARENCY ALPHA
  CLASS
    STYLE
      ANTIALIAS TRUE
      COLOR 255 0 0
      OUTLINECOLOR 0 0 0
    END ## Style
  END ## Class
END ## Layer

and after PHP MapScript runs looks like:

LAYER
    DATA "shapefiles/arrow"
    METADATA
      "wms_title"       "arrow"
    END
    NAME "arrow"
    PROJECTION
      "init=epsg:4326"
    END
    STATUS ON
    OPACITY ALPHA
    TYPE POLYGON
    UNITS METERS
    CLASS
      STYLE
        ANGLE 360
        ANTIALIAS TRUE
        COLOR 255 0 0
        OPACITY 100
        OUTLINECOLOR 0 0 0
        SYMBOL 0
      END
    END
  END


PHP MapScript is changing the OUTPUTFORMAT configuration (including
deleting the FORMATOPTION "INTERLACE=OFF" parameter I need for
TileCache), adding UNITS METERS, STYLE ANGLE 360 OPACITY 100 END to
each LAYER, as well as changing TRANSPARENCY ALPHA to OPACITY ALPHA
for each LAYER in the map. I realize that the anti-aliasing syntax I
am using is deprecated and may change that but I'm going to ask again
for what I put in my enhancement request ticket yesterday:

Through a flag, configuration, directive, etc for PHP MapScript,
enable it to ONLY change the parameters supplied in the script, and
not alter/add/remove additional map parameters.
Thank you,
Ian




On Wed, Apr 8, 2009 at 3:42 PM, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
> All that's happening is MapServer is writing the default values for some of the parameters. The mapfile
> before and after should be functionally equivalent. Not sure how that would wreak havoc. Your input
> mapfile is using older syntax (no styles) that the mapfile writer can't/won't produce. So at a minimum
> you'd see the style block as output.
>
> Steve


More information about the mapserver-users mailing list