[Mapserver-users] Variable substitution 4.0.1
Steve Lime
steve.lime at dnr.state.mn.us
Wed Jan 7 09:17:41 PST 2004
I made the change in the development version CVS. So this should be
fixed permanently in the new release. Thanks for the detective work!
Steve
>>> "Johansen Per Henrik" <phj at norgit.no> 1/7/2004 4:44:05 AM >>>
I have looked through the source again this morning and found what I
believe is the error/bug.
It seems that Mapserver gets an MS_STRING token instead of an IMAGE
token returned from the lexer, so I modified the lexer and now
everything seem to work as I would expect. I have included the diff
below. I do not know if this would cause other errors to occur though,
but Mapserver seem to behave as expected after the change.
Per Henrik
diff mapserver-4.0.1/maplexer.l mapserver-4.0.1-perhenrik/maplexer.l
121c121
< <INITIAL>extent {
return(EXTENT); }
---
> <INITIAL,OBJECT_STRING>extent {
return(EXTENT); }
138c138
< <INITIAL>image { return(IMAGE);
}
---
> <INITIAL,OBJECT_STRING>image { return(IMAGE);
}
--
Interconsult NORGIT AS
Per Henrik Johansen
Systemutvikler/Systems developer
Tel: + 47 69 394805 Mob: + 47 950 71822
icq: 4975767
Web: http://www.norgit.no
> -----Original Message-----
> From: Johansen Per Henrik
> Sent: 6. januar 2004 21:49
> To: mapserver-users at lists.gis.umn.edu
> Cc: Steve Lime
> Subject: RE: [Mapserver-users] Variable substitution 4.0.1
>
>
> Thanks for the reply.
>
> But using map_reference_image does not seem to work either. I
> have tried to look at the source code for 4.0.1 and to figure
> out what happens. mapserv recognize that I pass it a map_
> variable through CGI, but everything seem to end in the
> function loadReferenceMapString() in mapfile.c. The
> switch(msyylex()) statement never seem to match any of the
> cases (it triggers the default, to do nothing). The same
> happens when I try to set map_reference_extent, the default
> case is triggered.
>
> Maybe I am missing something (it is late over here), I have
> also peeked at how map_web_imagepath (loadWebString()) is
> handled (which works btw), and I can not spot any major
> differences at the moment.
>
> Could this be a bug in the lexer/parser?
>
> The function loadReferenceMap(), which is used to read from
> the mapfile works though.
>
> Per Henrik
>
> > -----Original Message-----
> > From: Steve Lime [mailto:steve.lime at dnr.state.mn.us]
> > Sent: 6. januar 2004 18:41
> > To: mapserver-users at lists.gis.umn.edu; Johansen Per Henrik
> > Subject: Re: [Mapserver-users] Variable substitution 4.0.1
> >
> >
> > Variable substitution is only available in a couple of
> instances where
> > you might like to alter a portion of a parameter but not the whole
> > thing. This basically amounts to FILTERs and EXPRESSIONs and
> > CONNECTIONs. The other method you mention should be used instead.
I
> > suspect that what's happening is that the map file parser
> > reads the file
> > first and then augments it using substitutions (as limited
> > above) or via
> > the other method, and the string you've got for image is
> > indeed illegal.
> > To fix?
> >
> > 1) Don't use the substitution, use map_reference_image instead.
> > 2) Change your mapfile like so:
> >
> > REFERENCE
> > IMAGE "passed in via URL"
> > ...
> > END
> >
> > Steve
> >
> > >>> "Johansen Per Henrik" <phj at norgit.no> 1/6/2004 10:05:11 AM >>>
> > Hi,
> >
> > I am a bit puzzled with the variable substition features in
> Mapserver.
> > It seems to work fine in some cases, like in the layer
> > object, but when
> > I try to use this functionality in the reference object, I
> > get a parser
> > error. getString(): Symbol definition error. Parsing error near
(%)
> > I use it like this to use a dynamically created reference image:
> >
> > REFERENCE
> > IMAGE %refimage%
> > ...
> > END
> >
> > I have also tried to overwrite the IMAGE value by referencing it
as
> > map_reference_image=... in the cgi call, but with the same result.
> > Am I right to suspect that the REFERENCE objectdoes not support
> > variable substitution and cgi referencing?
> >
> > Regards,
> >
> > Per Henrik
> >
> > --
> > Interconsult NORGIT AS
> > Per Henrik Johansen
> > Systemutvikler/Systems developer
> > Tel: + 47 69 394805 Mob: + 47 950 71822
> > icq: 4975767
> > Web: http://www.norgit.no
> >
> >
> > _______________________________________________
> > Mapserver-users mailing list
> > Mapserver-users at lists.gis.umn.edu
> > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> >
>
> --
> Interconsult NORGIT AS
> Per Henrik Johansen
> Systemutvikler/Systems developer
> Tel: + 47 69 394805 Mob: + 47 950 71822
> icq: 4975767
> Web: http://www.norgit.no
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list