[mapserver-users] R: understanding runtime substitution usage

umbertofilippo umbertofilippo at tiscali.it
Tue Nov 28 13:08:48 PST 2017


Hi.


The output of the form is supposed to be a value to pass to a filter 
specified in my mapfile.

Actually, I think I am close to the solution, but I also think I 
misunderstood the way I am supposed to do what I need.

Basically, the output of the form should replace the value '%vitigni%' 
in the string:

     FILTER ('[vitigni]' = '%vitigni%') # MAPFILE

I also forgot to mention I am doing everything with openlayers, so I 
think I should use ol API rather than ms templating.

Am I on the right track?

Actually, by my last tests I got something positive by specifying the 
'params' option using ol's " ol.source.ImageWMS" 
(http://openlayers.org/en/latest/apidoc/ol.source.ImageWMS.html).

The thing I need I guess is to get user choice from the form and pass it 
in the filter updating the 'params' option (using the "updateParams()" 
method?, see 
http://openlayers.org/en/latest/apidoc/ol.source.ImageWMS.html#updateParams).

Do you think this is correct?

Sorry for messing up a bit but it's really new stuff for me...


On 28/11/2017 21:30, Lime, Steve D (MNIT) wrote:
> The error you're getting is because no mode is set. That's the output from the form supposed to be? If it's just the resulting map then add a hidden variable called mode with a value of map. The filter and validation look ok to me. --Steve
>
> -----Original Message-----
> From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of umbertofilippo at tiscali.it
> Sent: Tuesday, November 28, 2017 8:24 AM
> To: 'Trond Michelsen' <trondmm-mapserver at crusaders.no>; 'Mapserver' <mapserver-users at lists.osgeo.org>
> Subject: [mapserver-users] R: understanding runtime substitution usage
>
> I tried that but that did not do the trick.
> I removed it from the HTML, but I keep it in the mapfile (as if I remove it
> it does not work anymore).
>
> So, what I am trying to do is showing my WMS filtered with the value
> specified in the form.
>
>  From what I've read in the docs
> (http://www.mapserver.org/cgi/runsub.html#filters), VALIDATION is also
> mandatory from version 6 onward, so I've included it.
> I simplified my testcase to this:
>
> mapfile
>
> 	LAYER
> 	  NAME zone
> 	  ...
> 	  FILTER ('[vitigni]' = '%vitigni%')
> 	  VALIDATION
> 	    "vitigni" "^[a-zA-Z\-]+$"
> 	  END
>                END
>
> Form
>
>                  <form name="mapserv" method="GET"
> action="http://localhost/cgi-bin/mapserver/mapserv.exe?">
> 		<input type="hidden" name="map"
> value="//nbgis01/mapserver/umbe/mapfile/test10_runtimesubstitution.map">
> 		<select name="vitigni">
>                          		<option value="Groppello"> Groppello
> </option>
>                      	</select>
> 		<br><br>
> 		<input type="submit" value="Click Me">
>                  </form>
>
> When I click "Click Me" I receive:
> 	mapserv(): Web application error. Traditional BROWSE mode requires a
> TEMPLATE in the WEB section, but none was provided.
>
> And the URL looks like (obviously wrong):
> 	
> http://localhost/cgi-bin/mapserver/mapserv.exe?map=%2F%2Fnbgis01%2Fmapserver
> %2Fumbe%2Fmapfile%2Ftest10_runtimesubstitution.map&vitigni=Groppello
>
> -----Messaggio originale-----
> Da: trondmm at main.crusaders.no [mailto:trondmm at main.crusaders.no] Per conto
> di Trond Michelsen
> Inviato: martedì 28 novembre 2017 15:04
> A: Mapserver <mapserver-users at lists.osgeo.org>
> Cc: umbertofilippo at tiscali.it
> Oggetto: Re: [mapserver-users] understanding runtime substitution usage
>
> Try to remove the brackets from the parameter name
>
> <select name="[vitigni]">
>
> should be
>
> <select name="vitigni">
>



More information about the mapserver-users mailing list