Re: [mapserver-users] run-time substitution
Hi Jeff, thanks a lot! It really works with your validation expression. Looking forward to see you in Bonn! Eva 2016-07-11 20:50 GMT+02:00 Jeff McKenna : > Hello Eva, > > Testing with MS4W 3.1.4 (MapServer 7.0.1) on Windows, I am able to pass > "&ma_name=testing" in the url and the resulting GetCapabilities response > correctly replaces that in the wms_onlineresource value. Note that my > validation block is slightly different than yours: > > WEB > VALIDATION > "ma_name" "[a-z]+" > END > METADATA > "wms_onlineresource" "http://url/cgi-bin/gp_%ma_name%_com_wms?"; > ... > END > ... > END > > > -jeff > > > -- > Jeff McKenna > MapServer Consulting and Training Services > http://www.gatewaygeomatics.com/ > > > > On 2016-07-11 12:39 PM, Eva Jelínková wrote: > >> Dear mapserv people, >> >> does anybody has an experience with runtime substitution in MAP->WEB: >> METADATA section of mapfile (MapServer 7)? >> http://mapserver.org/cgi/runsub.html#parameters-supported >> >> I am trying to substitute part of 'wms_onlineresource' value, using >> default value in VALIDATION. GetCapabilities request gives me string >> with %name_of_parameter% in the URL. >> >> > > > > > ___ > mapserver-users mailing list > mapserver-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] run-time substitution
Hello Eva, Testing with MS4W 3.1.4 (MapServer 7.0.1) on Windows, I am able to pass "&ma_name=testing" in the url and the resulting GetCapabilities response correctly replaces that in the wms_onlineresource value. Note that my validation block is slightly different than yours: WEB VALIDATION "ma_name" "[a-z]+" END METADATA "wms_onlineresource" "http://url/cgi-bin/gp_%ma_name%_com_wms?"; ... END ... END -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ On 2016-07-11 12:39 PM, Eva Jelínková wrote: Dear mapserv people, does anybody has an experience with runtime substitution in MAP->WEB: METADATA section of mapfile (MapServer 7)? http://mapserver.org/cgi/runsub.html#parameters-supported I am trying to substitute part of 'wms_onlineresource' value, using default value in VALIDATION. GetCapabilities request gives me string with %name_of_parameter% in the URL. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Run-time substitution
Hi, I fear that only ascii characters can be used for validation. For us who need to use also non-ascii characters validation can be set to "." which accepts everything, so no validation at all. -Jukka Rahkonen- Lähettäjä: mapserver-users-boun...@lists.osgeo.org [mapserver-users-boun...@lists.osgeo.org] käyttäjän scott...@free.fr [scott...@free.fr] puolesta Lähetetty: 9. kesäkuuta 2012 12:22 Vastaanottaja: mapserver-users@lists.osgeo.org Aihe: [mapserver-users] Run-time substitution Hi, I would like to use run-time substitution in a mapfile to insert variables like %firstname%. Is it necessary to specify validation block in the mapfile to use it ? It doesn't work without this validation pattern. Second problem, how to specify this validation pattern to use characters with accent like 'é, à'. I try this example but it doesn't work : VALIDATION 'firstname' '^[a-zA-Zéà\-]+$' END Thanks a lot ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Run-time Substitution and Raster file problem
first thing that comes to mind is 'fhour_validation_pattern' '^[][_a-zA-Z0-9]+$' this should go in a VALIDATION block VALIDATION 'fhour' '^[][_a-zA-Z0-9]+$' END On Sat, Mar 17, 2012 at 00:43, teknocreator wrote: > This is somewhat related to the post by Kathleen Hirst on Feb 27. We're > using MapServer 6.0.1 and I'm attempting get around the fact that one isn't > able to change the PROCESSING "BANDS=" directive via Run-time Substitution. > I couldn't find a way to do it through modifying the URL that's passed > either. As we don't have a many rasters in a file as Kathleen, I thought of > splitting the bigger file up into individual rasters. Then use Run-time > Substitution and pass in either the filename or just a piece of the file > name to the DATA portion of the mapfile. The docs seem to indicate I should > be able to do this. But, I get an error with each attempt. Here's what I > tried first: > > MAP > NAME "testgrib" > IMAGETYPE PNG > EXTENT -1400 300 -700 700 > STATUS ON > SIZE 2145 1377 > > SHAPEPATH "../shapefiles" > SYMBOLSET "../symbols/symbols35.sym" > FONTSET "../fonts/fonts.list" > DATAPATTERN "^.*$" > IMAGECOLOR 255 255 255 > > PROJECTION > "init=epsg:3857" > END > WEB > IMAGEPATH "test/img/tmp/ms_tmp/" > IMAGEURL "http://localhost:8080/wxmap/test/img/tmp/ms_tmp/"; > METADATA > "wms_title" "WMS Test " ## REQUIRED > "wms_onlineresource" "http://localhost:8080/cgi-bin/mapserv?"; > ## Recommended > "wms_srs" "ESPG:3857 EPSG:4326 EPSG:4269 EPSG:3978 > EPSG:900913" ## Recommended > "wms_abstract" "This text describes my WMS service." ## > Recommended > "wms_enable_request" "*" > "ows_sld_enable" "true" > # testing > "wms_feature_info_mime_type" "text/html" > END > END > > OUTPUTFORMAT > NAME "png" > DRIVER GD/PNG > MIMETYPE "image/png" > IMAGEMODE RGBA > EXTENSION "png" > TRANSPARENT ON > END > > > LAYER # GRIB attempt > NAME mosaic > STATUS ON > TYPE RASTER > > DATA *../grib/ds_vis%fhour%.grb* > > CLASSITEM "[pixel]" > METADATA > "gml_include_items" "all" > "wms_include_items" "all" > END > 'fhour_validation_pattern' '^[][_a-zA-Z0-9]+$' > # testing > DUMP TRUE > HEADER "../templates/test_header.html" > TEMPLATE "../templates/test_body.html" > FOOTER "../templates/test_footer.html" > > PROJECTION > "proj=lcc" > "lat_1=25" > "lat_2=25" > "lat_0=0" > "lon_0=-95" > "x_0=0" > "y_0=0" > "a=6371200" > "es=0.0" > "+no_defs" > END > > PROCESSING "NODATA=32129" > PROCESSING "BANDS=01" > PROCESSING "SCALE=0,11200" > LABELITEM "[pixel]" > > CLASS > NAME "< 1/4" > EXPRESSION ([pixel] < 400 ) > STYLE > COLOR 100 0 100 > END > END > > > > END # End of mosaic layer > > END > > But this results in: > > "loadLayer(): Unknown identifier. Parsing error near (%):(line 90) > msOutputFormatValidate():" > > I tried a few variations: > - using RTS for the entire file name > - specifying the entire path > - quotes/no quotes around the full file path name (different error with > quotes) > > to no avail. I tried others these either ended up in other errors. Pretty > much hitting walls everywhere and winding up with some of the same > variations. So, thought it was time to ask what I might be doing wrong or > if this is even possible. I've used RTS successfully with Postgres/PostGIS, > so I thought this should work as well. And it's the DATA statement where I > thought this would most likely work. > > Appreciate any thoughts/help! > > Dave M > > -- > View this message in context: > http://osgeo-org.1560.n6.nabble.com/Run-time-Substitution-and-Raster-file-problem-tp4626749p4626749.html > Sent from the Mapserver - User mailing list archive at Nabble.com. > ___ > mapserver-users mailing list > mapserver-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Run time substitution - Like instead of =
Hi, Perhaps someone can tell if you could use the default value to "NOT something_very_off", which would then select everything for you. -Jukka Rahkonen- tellett wrote: > Hi All, > I'm using runtime substitution to replace the value of an expression and thats working fine, however, if I don't set the expression value in the url, I want the layer to show all the records. For example my class looks likes this: CLASS NAME 'FKB-A' EXPRESSION '%pn%' STYLE COLOR 254 150 254 OUTLINECOLOR 1 1 1 END END and when I use this request: .REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&LAYERS=fkb_prosjektstandard&STYLES=&FORMAT=image/png&BGCOLOR=0xFF&TRANSPARENT=TRUE&CRS=EPSG:4326&BBOX=58.9930983171506,9.40049150322111,59.8470137571506,10.904184647298&WIDTH=1650&HEIGHT=937&pn=LACHVE11 I get back 1 record which is correct. However, if I drop the &pn=LACHVE11 of course I get no results back. Is there any way of changing this so that I can get all the records of the table returned? I thought about using the 'default_pn' option in the metadata and using wildcards but as this is an '=' expression rather than a 'LIKE' expression wildcards are useless. Maybe its just because its friday afternoon, but I just can't see a way of doing this, help!!! Best Regards Tom -- View this message in context: http://osgeo-org.1560.n6.nabble.com/Run-time-substitution-Like-instead-of-tp4362317p4362317.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Run time substitution - Like instead of =
Tom, What I am using with a database connection is a default value of "1=1" so that is always true, it returns all records. Mike -- Michael Smith Remote Sensing/GIS Center US Army Corps of Engineers On 2/3/12 11:30 AM, "tellett" wrote: >Hi All, > >I'm using runtime substitution to replace the value of an expression and >thats working fine, however, if I don't set the expression value in the >url, >I want the layer to show all the records. For example my class looks likes >this: > >CLASS > NAME 'FKB-A' > EXPRESSION '%pn%' > STYLE >COLOR 254 150 254 >OUTLINECOLOR 1 1 1 > END > END > >and when I use this request: > >.REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&LAYERS=fkb_prosjektstandard& >STYLES=&FORMAT=image/png&BGCOLOR=0xFF&TRANSPARENT=TRUE&CRS=EPSG:4326&B >BOX=58.9930983171506,9.40049150322111,59.8470137571506,10.904184647298&WID >TH=1650&HEIGHT=937&pn=LACHVE11 > >I get back 1 record which is correct. However, if I drop the &pn=LACHVE11 >of >course I get no results back. Is there any way of changing this so that I >can get all the records of the table returned? > >I thought about using the 'default_pn' option in the metadata and using >wildcards but as this is an '=' expression rather than a 'LIKE' expression >wildcards are useless. Maybe its just because its friday afternoon, but I >just can't see a way of doing this, help!!! > >Best Regards > >Tom > >-- >View this message in context: >http://osgeo-org.1560.n6.nabble.com/Run-time-substitution-Like-instead-of- >tp4362317p4362317.html >Sent from the Mapserver - User mailing list archive at Nabble.com. >___ >mapserver-users mailing list >mapserver-users@lists.osgeo.org >http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Run-time substitution
Alright, thank you for confirming run-time substitution's lack of LAYER NAME support. My setup involves MapServer 5.0, OpenLayers 2.7, and TileCache 2.1. Maps are WMS and not all layers (including the ~50 in my first post) are cached. I've written a small javascript library that handles feature queries, loads custom tools, and does the communication between client interaction and MS/OL/TC. Most maps are in html pages for partner and sponsor projects. Mapscript intrigues me and I should understand it better, but I'm still not clear on the topic in general (even after going through the documentation). It sounds like instead of OL doing direct MS requests it would hit a (Python, etc) CGI that handled MS requests and generated the relevant images? An OL mailing list search for mapscript just returned a bunch of results, I'll research some more. Thank you. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Run-time substitution
It's not (and won't be) supported. There may be other ways to structure things but you'd need to tell the list a bit more about your setup. Steve >>> On 3/18/2009 at 12:58 PM, in message <5b61c6c50903181058t1e90456gf70858e15eb57...@mail.gmail.com>, Ian wrote: > Hello, > > I have ~50 layers/shapefiles that are the same datasets scaled to various > values, used in OpenLayers. My map file for this data is quickly growing > (3000+ lines) and I was hoping to use run-time substitution to reduce this, > changing the LAYER NAME and DATA. I've read the documentation on run-time > substitution which didn't mention LAYER NAME as being supported (other posts > made it sound like it specifically was not supported), and which I would > need to change for OpenLayers. I want to confirm that LAYER NAME is not > supported in run-time substitution before I re-work everything. Thank you. > > Ian ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Run-time substitution
I want to confirm that LAYER NAME is not supported in run-time substitution before I re-work everything. It sure isn't, confirmed. A recompile, though, should be able to enable it. If you have elementary C skills and are used to compiling MapServer from source, that may present little difficulty. -- HostGIS, Open Source solutions for the global GIS community Greg Allensworth - SysAdmin, Programmer, GIS Person, Security Network+ Server+ A+ Security+ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Run-time Substitution vs. Variable Substitutionand what are the Parameters Supported?
Variable substitution refers to those parameters that can have part of their value changed remotely. The supported parameters are: LAYER: data, tileindex, connection and filter CLASS: expression Setting up parameter validation is STRONGLY encouraged. In your layer metadata you'd define keys based on variable names to do validation. For example, if your variable was called 'foo' and you wanted to allow a single digit integer from 1 to 9 as a value you'd do: METADATA ... 'foo_validation_pattern' '^[1-9]$' ... END The value of 'foo' would have to pass the supplied regex before the parameter would be altered. It is up to you to author the correct validation pattern. MapServer also supports some URL-based configuration. This is different than substitution in that you are completely changing values of object parameters or even creating new objects. That is, you can change a class color or create a new point feature. Support here (at the moment) is limited to parameters that are validated as part of mapfile parsing. For example, MapServer checks to make sure a color is of the correct format, that a double is a double and so on. The only two exceptions are layer DATA and TEMPLATE properties and they are required to validate against DATAPATTERN or TEMPLATEPATTERN before being used. This is all going to be generalized and improved in 5.4. Steve >>> On 9/9/2008 at 2:42 PM, in message <[EMAIL PROTECTED]>, "John Mitchell" <[EMAIL PROTECTED]> wrote: > Hi, > > What is the difference between Run-time Substitution vs. Variable > Substitution within a map file? > They look like they are the same thing. > > Also what are the Parameters Supported? > >>From documentation that is almost 3 years old it lists the following > parametes (listed below) is this list complete? > > >- LAYER: DATA (must validate against DATAPATTERN) >- LAYER: TILEINDEX >- LAYER: CONNECTION >- LAYER: FILTER >- CLASS EXPRESSION > > > Thanks, ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users