[mapserver-users] ‘mode=map’ with WMC of dynamic <Layer> failing with getString() error

myOpenLayersUName joanne.mcgraw at SYMPATICO.CA
Fri Dec 10 16:57:02 EST 2010


I apologize profusely for how brutally long this post is, but I’m trying to
avoid a bunch of questions by providing as much background to the full
process I am trying to develop before I actually get to specific problem I
am stuck at now. I think it will save time, but I could be wrong…in which
case, I’m sorry.


I have a MAP file with an "empty" line LAYER defined as follows:

  LAYER
    NAME "line"
    STATUS ON
    TYPE line
    PROJECTION
      "init=epsg:42304"
    END
    CLASS
      COLOR 0 0 0
      NAME "Some Line Layer"
    END
    METADATA
      "wms_title" "Some Line Layer"
    END
  END


My process dynamically generates a shapefile. Then, within a WMS getMap
request, I provide the DATA value to create an image of its contents as
follows:

http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/testing/dynamic.map&request=getMap&service=wms&version=1.1.1&map.layer[line]=DATA
‘id3/vector’
END&layers=line&srs=EPSG:42304&bbox=-2338951,-800000,3008692,3900000&format=image/png&height=300&width=300


Knowing this, I can define this dynamic layer in a WMC <Layer> tag and load
it into OpenLayers (or probably anything else that supports loading and
displaying a WMC, OpenLayers is just what I am using). The WMC definition
for the above layer is as follows:

    <Layer queryable="0" hidden="0" clid="id3vector">
      <Server service="OGC:WMS" version="1.1.1" title="Id3 Vector">
        <OnlineResource xlink:type="simple"
xlink:href="http://<domain>/ogc/printVecWms_en?map.layer[line]=DATA
'id3/vector' END"/>
      </Server>
      <Name>line</Name>
      <Title>id3 vector</Title>
      <SRS>EPSG:42304</SRS>
      <FormatList>
        <Format current="1">image/png</Format>
      </FormatList>
      <StyleList>
        <Style current="1">
          <Name>default</Name>
          <Title>default</Title>
          <LegendURL format="image/png" width="47" height="294">
             <OnlineResource xlink:type="simple"
xlink:href="http://<domain>/ogc/printVecWms_en?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;map.layer[line]=DATA
'id3/vector' END&amp;layer=line&amp;format=image/png&amp;STYLE=default"/>
          </LegendURL>
        </Style>
      </StyleList>
      <Extension>
        <ol:maxExtent minx="-2903297" miny="-789911" maxx="3431059"
maxy="3959683"/>
        <ol:transparent>true</ol:transparent>
        <ol:isBaseLayer>false</ol:isBaseLayer>
        <ol:displayInLayerSwitcher>true</ol:displayInLayerSwitcher>
      </Extension>
    </Layer>



Okay, that’s the background and everything works fine up to this point. Now,
I’d like to print the image displayed to the user. To do this, I have
another empty MAP file that I use to print a WMC. The entire contents of the
MAP file are:


MAP
  NAME "wmsContextServer"
  FONTSET "../../../mapserv/etc/fonts.txt"
  SYMBOLSET "../../../mapserv/etc/symbols.sym"
  SIZE 400 300
  STATUS ON
  IMAGETYPE PNG
  IMAGECOLOR 255 255 255
  EXTENT -2338951 -800000 3008692 3900000
  UNITS METERS
  CONFIG "CGI_CONTEXT_URL" "1"
  PROJECTION
    "init=epsg:42304"
  END
  
  RESOLUTION 96
  
  REFERENCE
    # Parameter settings NOT to change
    STATUS          ON
    COLOR           -1 -1 -1
    OUTLINECOLOR    255 0 0
    # Parameter settings that will change if you replace the default
'refmap.png'
    IMAGE           "../htdocs/images/refmap.png"
    SIZE            100 74
    EXTENT          -2.2e+006 -712631 3.0728e+006 3.84e+006
  END # REFERENCE

  SCALEBAR
    STATUS EMBED
    INTERVALS 1
    POSITION LL
    TRANSPARENT true
    UNITS kilometers
    STYLE 1
    SIZE 100 7
    LABEL
      SIZE small
    END
  END

  WEB
    INCLUDE "../../../mapserv/conf/imagepath.inc.map"
    METADATA
      # Used for App Page Title
      "wms_title" "WMC Context Client"
      "wms_connectiontimeout" "60"
    END
  END
  OUTPUTFORMAT
    NAME png
    DRIVER 'GD/PNG'
    MIMETYPE 'image/png'
    IMAGEMODE RGB
    FORMATOPTION "INTERLACE=OFF"
    EXTENSION 'png'
    #TRANSPARENT ON
  END
  
  OUTPUTFORMAT
    NAME gif
    DRIVER 'GD/GIF'
    MIMETYPE 'image/gif'
    IMAGEMODE RGB
    FORMATOPTION "INTERLACE=OFF"
    EXTENSION 'gif'
  END

END


For any WMC I have tried so far that doesn’t contain one of these “dynamic”
layers in it, I can use the following URL to get an image of all of the
layers in the WMC successfully:

http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/testing/wmsContextServer.map&mode=map&context=http://localhost/contexts/non-dynamiclayer.xml&layers=all 


And, without using any dynamic layers, we have been following this approach
in a production environment for a couple of years to provide our print
functionality. The wmsContextServer.map file has not changed since February
2, 2009. However, now we are trying to introduce these dynamic layers into
the mix and I am running into trouble.


If I use the same URL to the wmsContextServer.map but point to a context
with a dynamic layer added in to it (I start with one that works and just
insert the WMC <LayerList><Layer> contents I included above), I get the
following error message and the *.img.tmp file mentioned is not created in
the IMAGEURL directory (which is pointed to, BTW in the imagepath.inc.map
file included in the “wmsContextServer” MAP file above):

msDrawMap(): WMS connection error. Failed to draw WMS layer named 'line'.
This most likely happened because the remote WMS server returned an invalid
image, and XML exception or another unexpected result in response to the
GetMap request. Also check and make sure that the layer's connection URL is
valid. msDrawRaster(): Image handling error. Unrecognized or unsupported
image format drawEPP(): Image handling error.
/data/nl18/httpd/htdocs/ogc_tmp/4d027765_4cb4_3.img.tmp is not an EPPL file.


I’ve looked online for some suggestions re: why I might be getting this
message. It seems to have many possibilities but generally indicates a
problem with the data. Unfortunately, the suggestions they contain aren’t
helping me to figure out my specific problem and what could be wrong with
the data or my definition of it or the request being made to get it, etc.


In trying to figure this out, I guessed there must be some difference in
generating the image depicting the dynamic layer when it is done as a WMS
GetMap request vs. when it is done using a MapServer “mode=map” parameter.
So, I’ve been trying to figure out what the “mode=map” URL would be to
display that single “dynamic” layer and perhaps identify my specific
problem. 


And, maybe I have, but now I’m completely stuck. At this point, I have the
following URL:

http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/testing/dynamic.map&map.layer[line]=DATA
‘id3/vector’ END&layers=line&mode=map


And it is giving me this error: getString(): Symbol definition error.
Parsing error near (‘):(line 1)


>From searching again online, I think that MapServer is trying to tell me
there’s an error with the MAP file somehow but, first, I’m not clear how (if
there’s a problem with the MAP file) the WMS GetMap requests against the
same LAYER are working (and generally the MAP file has been working for
close to 2 years) and, second, how to figure out what the problem with the
MAP file is that it doesn’t like the dynamic layers.


I came across the following post:
http://osgeo-org.1803224.n2.nabble.com/Clarification-on-RFC-44-changes-td2585073.html
which suggests that there may be a problem with the syntax of
“map.layer[line]=DATA ‘id3/vector’ END” in my URL but I don’t know what an
alternative correct way to send this information would be that would work
for both the WMS GetMap requests and the “mode=map” method. I haven’t been
able to get either the WMS GetMap request or the “mode=map” request to work
trying to guess.


Is there anyone out there who can provide any help with this? Either some
way to find out what the specific problem in the MAP file is that is causing
the getString() error? Or, some alternative syntax to try for specifying the
DATA parameter that would work for both a getMap request and using
“mode=map”? 


Very important, I am restricted to using MapServer 5.4.0 as that is the
version currently running in our production environment and there are no
plans for upgrading at this time.



Cheers,
jtm
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/mode-map-with-WMC-of-dynamic-Layer-failing-with-getString-error-tp5824774p5824774.html
Sent from the Mapserver - User mailing list archive at Nabble.com.


More information about the mapserver-users mailing list