Re: [mapserver-users] Runtime Substitution Not Working

2012-05-21 Thread Helen San Segundo Navazo

hi Ryan,
try to add the validation pattern inside the layer tag

METADATA
 'file_validation_pattern'"[A-Z0-9._%+-|'\(\)]"
 'default_file'"ultima_imatge" #---> this is to give a 
value when you don't put the &file=value in the url call

 END

 VALIDATION
 'file'"[A-Z0-9._%+-|'\(\)]"
 END

DATA '%file%'


Helen


El 21/05/12 17:55, Ryan Dussiaume escribió:


Hi,

I'm trying to use runtime substitution to replace the DATA setting of 
the Mapfile at runtime.  I'm running in tile mode and using GRD raster 
format.


Here's the mapfile:

MAP

NAME Blah2

STATUS ON

SHAPEPATH "C:/Contours/FSGrids"

PROJECTION "init=epsg:26918" END

LAYER

NAME Contour

TYPE RASTER

STATUS ON

DATA '%file%'

CLASS

NAME "Contour"

END

PROJECTION "init=epsg:26918" END

END # Layer

END

And here is a sample request for one of the tiles that I've copied 
from Fiddler ...


http://server>/cgi-bin/mapserv.exe?map=C:/ms4w/Maps/mapfile2.map&file=Site_1_1_1_Total.grd&mode=tile&layers=Contour&tilemode=ve&tile=03023032203031 



If I put the filename directly in the DATA setting of the mapfile it 
works fine and I see the grid in Virtual Earth.  If I try to use 
runtime substitution to put the file name it just produces blank tiles.


Any help is very much appreciated, thanks!

Ryan



___
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] Runtime Substitution Not Working

2012-05-21 Thread Ryan Dussiaume
Worked like a charm, thanks!

Ryan

From: mapserver-users-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Helen San Segundo 
Navazo
Sent: May 21, 2012 12:23
To: mapserver-users@lists.osgeo.org
Subject: Re: [mapserver-users] Runtime Substitution Not Working

hi Ryan,
try to add the validation pattern inside the layer tag

METADATA
 'file_validation_pattern'"[A-Z0-9._%+-|'\(\)]"
 'default_file'"ultima_imatge" #---> this is to give a value when 
you don't put the &file=value in the url call
 END

 VALIDATION
 'file'"[A-Z0-9._%+-|'\(\)]"
 END

DATA '%file%'


Helen


El 21/05/12 17:55, Ryan Dussiaume escribió:
Hi,

I'm trying to use runtime substitution to replace the DATA setting of the 
Mapfile at runtime.  I'm running in tile mode and using GRD raster format.

Here's the mapfile:
MAP
NAME Blah2
STATUS ON
SHAPEPATH "C:/Contours/FSGrids"
PROJECTION "init=epsg:26918" END
LAYER
NAME Contour
TYPE RASTER
STATUS ON
DATA '%file%'
CLASS
NAME "Contour"
END
PROJECTION "init=epsg:26918" END
END # Layer
END

And here is a sample request for one of the tiles that I've copied from Fiddler 
...

http:///cgi-bin/mapserv.exe?map=C:/ms4w/Maps/mapfile2.map&file=Site_1_1_1_Total.grd&mode=tile&layers=Contour&tilemode=ve&tile=03023032203031<http://%3cmy%20server%3e/cgi-bin/mapserv.exe?map=C:/ms4w/Maps/mapfile2.map&file=Site_1_1_1_Total.grd&mode=tile&layers=Contour&tilemode=ve&tile=03023032203031>

If I put the filename directly in the DATA setting of the mapfile it works fine 
and I see the grid in Virtual Earth.  If I try to use runtime substitution to 
put the file name it just produces blank tiles.

Any help is very much appreciated, thanks!

Ryan




___

mapserver-users mailing list

mapserver-users@lists.osgeo.org<mailto: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] runtime substitution not working

2010-03-12 Thread Lime, Steve D (DNR)
I don't see anything obvious. You can test at the command-line with the CGI 
(shp2img won't work). Syntax is like so:

  mapserv -nh "QUERY_STRING=map=/srv/www/htdocs/mapdata/catch.map&spp=TAR"

The -nh switch suppresses the HTTP headers which helps if you're creating an 
image.

Steve

-Original Message-
From: mapserver-users-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of pcr...@pcreso.com
Sent: Thursday, March 11, 2010 10:22 PM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] runtime substitution not working

Hi,

I'm obviously doing something wrong, but can't see what it is... I have a 
Postgis table of species occurences & I want to pass a variable to the mapfile 
to select which speciesusing runtime substitution.

The relevant DATA statement (joining species in the catch to locations in the 
station) in the mapfile is: 

DATA "startp from (select c.id, s.startp, s.trip_code, 
  s.station_no, c.species,
  c.weight 
   from t_station s, catch c
   where s.station_no=c.station_no
 and c.species ilike '%%spp%%') 
   as myquery
   using unique id using srid=4326"


The query works in Postgis & in the mapfile (via QGIS) when I hard code the 
%spp% (eg, to 'TAR')

I'm using QGIS to open the layer, with the URL:
http://wms-dev/cgi-bin/mapserv?map=/srv/www/htdocs/mapdata/catch.map&spp=TAR

QGIS appends the request type, etc & it works with the hard coded "spp"

The mapfile also has:
METADATA
  "wms_title" "species"
  "wms_srs"   "epsg:4326"
  "wfs_title" "species"
  "wfs_version" "1.0.0"
  "wfs_typename" "species"
  "wfs_request_method" "GET"
  "wfs_service" "WFS"
  "spp_validation_pattern" '^[A-Z0-9][A-Z0-9][A-Z0-9]$'
END

The version I'm running is MapServer version 5.4.1
(so no default supported)

The docs say I can use shp2img to test runtime substitution in a mapfile, but I 
can't see how to invoke the substitution with the equivalent of a spp=TAR 
statement to test this. 


Any suggestions? 

  Thanks

Brent Wood

___
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] runtime substitution not working

2010-03-13 Thread Ben Madin
G'day Brent,

It might not matter, but you have double %% in the DATA statement you have 
passed, 

and for whatever reason - I recevied advice from this list or OpenLayers list - 
I have all my variable names capitalised in the query:

WHERE transferdate >= '%STARTDATE%' AND 
transferdate <= '%ENDDATE%'
AND line_geom IS NOT NULL
AND sourceshire NOT LIKE 
destinationshire
AND sourceshire LIKE 
'%SOURCESHIRE%'

So I hope these might help if Steve's solution didn't

cheers

Ben



On 13/03/2010, at 24:00 , mapserver-users-requ...@lists.osgeo.org wrote:

> I'm obviously doing something wrong, but can't see what it is... I have a 
> Postgis table of species occurences & I want to pass a variable to the 
> mapfile to select which speciesusing runtime substitution.
> 
> The relevant DATA statement (joining species in the catch to locations in the 
> station) in the mapfile is: 
> 
> DATA "startp from (select c.id, s.startp, s.trip_code, 
>  s.station_no, c.species,
>  c.weight 
>   from t_station s, catch c
>   where s.station_no=c.station_no
> and c.species ilike '%%spp%%') 
>   as myquery
>   using unique id using srid=4326"
> 
> 
> The query works in Postgis & in the mapfile (via QGIS) when I hard code the 
> %spp% (eg, to 'TAR')
> 
> I'm using QGIS to open the layer, with the URL:
> http://wms-dev/cgi-bin/mapserv?map=/srv/www/htdocs/mapdata/catch.map&spp=TAR
> 
> QGIS appends the request type, etc & it works with the hard coded "spp"
> 
> The mapfile also has:
>METADATA
>  "wms_title" "species"
>  "wms_srs"   "epsg:4326"
>  "wfs_title" "species"
>  "wfs_version" "1.0.0"
>  "wfs_typename" "species"
>  "wfs_request_method" "GET"
>  "wfs_service" "WFS"
>  "spp_validation_pattern" '^[A-Z0-9][A-Z0-9][A-Z0-9]$'
>END
> 
> The version I'm running is MapServer version 5.4.1
> (so no default supported)
> 
> The docs say I can use shp2img to test runtime substitution in a mapfile, but 
> I can't see how to invoke the substitution with the equivalent of a spp=TAR 
> statement to test this. 
> 
> 
> Any suggestions? 
> 
>  Thanks
> 
>Brent Wood

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] runtime substitution not working

2010-03-14 Thread pcreso

Hi Ben...

I have it working in other setups fine - just this one won't behave.

If I use "like '%spp%'" & pass &spp=TAR, then the query that gets run is
"like 'TAR', which is basically an un-indexed =

I need a "like '%TAR%'" in the SQL hence the double % sign. I have this working 
elsewhere fine (but with different versions of mapserver & Postgis)

Capitalisation might be the problem... I'll try that...


Thanks,

   Brent
 

--- On Sun, 3/14/10, Ben Madin  wrote:

> From: Ben Madin 
> Subject: Re: [mapserver-users] runtime substitution not working
> To: mapserver-users@lists.osgeo.org
> Cc: pcr...@pcreso.com
> Date: Sunday, March 14, 2010, 1:25 PM
> G'day Brent,
>
> It might not matter, but you have double %% in the DATA
> statement you have passed,
>
> and for whatever reason - I recevied advice from this list
> or OpenLayers list - I have all my variable names
> capitalised in the query:
>
>
> WHERE transferdate
> >= '%STARTDATE%' AND transferdate <= '%ENDDATE%'
>
> AND
> line_geom IS NOT NULL
>
> AND
> sourceshire NOT LIKE destinationshire
>
> AND
> sourceshire LIKE '%SOURCESHIRE%'
>
> So I hope these might help if Steve's solution didn't
>
> cheers
>
> Ben
>
>
>
> On 13/03/2010, at 24:00 , mapserver-users-requ...@lists.osgeo.org
> wrote:
>
> > I'm obviously doing something wrong, but can't see
> what it is... I have a Postgis table of species occurences
> & I want to pass a variable to the mapfile to select
> which speciesusing runtime substitution.
> >
> > The relevant DATA statement (joining species in the
> catch to locations in the station) in the mapfile is:
> >
> > DATA "startp from (select c.id, s.startp, s.trip_code,
>
> >   
>  
> s.station_no, c.species,
> >   
>   c.weight
> >   
>from t_station s, catch c
> >   
>where
> s.station_no=c.station_no
> >   
>  and c.species ilike
> '%%spp%%')
> >   
>as myquery
> >   
>using unique id using
> srid=4326"
> >
> >
> > The query works in Postgis & in the mapfile (via
> QGIS) when I hard code the %spp% (eg, to 'TAR')
> >
> > I'm using QGIS to open the layer, with the URL:
> > http://wms-dev/cgi-bin/mapserv?map=/srv/www/htdocs/mapdata/catch.map&spp=TAR
> >
> > QGIS appends the request type, etc & it works with
> the hard coded "spp"
> >
> > The mapfile also has:
> >METADATA
> >  "wms_title" "species"
> > 
> "wms_srs"   "epsg:4326"
> >  "wfs_title" "species"
> >  "wfs_version" "1.0.0"
> >  "wfs_typename" "species"
> >  "wfs_request_method" "GET"
> >  "wfs_service" "WFS"
> >  "spp_validation_pattern"
> '^[A-Z0-9][A-Z0-9][A-Z0-9]$'
> >END
> >
> > The version I'm running is MapServer version 5.4.1
> > (so no default supported)
> >
> > The docs say I can use shp2img to test runtime
> substitution in a mapfile, but I can't see how to invoke the
> substitution with the equivalent of a spp=TAR statement to
> test this.

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] runtime substitution not working

2010-03-14 Thread Joshua Hevenor
I see what Ben was worried about and what you're trying to do. I haven't done a 
lot of variable substitution but I have done a lot of head scratching to when 
queries don't work as expected. A couple things that might shed some light you 
could try:

"like '%spp%'"    and  pass &spp=%TAR%

If you're looking for a string containing TAR.  It might confirm that the 
double %% are being misinterpreted. 

Or you could try if this is the case and you want to force the wildcards at the 
mapfile level. 
"like '%' || '%spp%' || '%"'

Josh

--- On Sun, 3/14/10, pcr...@pcreso.com  wrote:

From: pcr...@pcreso.com 
Subject: Re: [mapserver-users] runtime substitution not working
To: mapserver-users@lists.osgeo.org
Date: Sunday, March 14, 2010, 1:29 PM


Hi Ben...

I have it working in other setups fine - just this one won't behave.

If I use "like '%spp%'" & pass &spp=TAR, then the query that gets run is
"like 'TAR', which is basically an un-indexed =

I need a "like '%TAR%'" in the SQL hence the double % sign. I have this working 
elsewhere fine (but with different versions of mapserver & Postgis)

Capitalisation might be the problem... I'll try that...


Thanks,

   Brent
 

--- On Sun, 3/14/10, Ben Madin  wrote:

> From: Ben Madin 
> Subject: Re: [mapserver-users] runtime substitution not working
> To: mapserver-users@lists.osgeo.org
> Cc: pcr...@pcreso.com
> Date: Sunday, March 14, 2010, 1:25 PM
> G'day Brent,
>
> It might not matter, but you have double %% in the DATA
> statement you have passed,
>
> and for whatever reason - I recevied advice from this list
> or OpenLayers list - I have all my variable names
> capitalised in the query:
>
>            
>         WHERE transferdate
> >= '%STARTDATE%' AND transferdate <= '%ENDDATE%'
>            
>             AND
> line_geom IS NOT NULL
>            
>             AND
> sourceshire NOT LIKE destinationshire
>            
>             AND
> sourceshire LIKE '%SOURCESHIRE%'
>
> So I hope these might help if Steve's solution didn't
>
> cheers
>
> Ben
>
>
>
> On 13/03/2010, at 24:00 , mapserver-users-requ...@lists.osgeo.org
> wrote:
>
> > I'm obviously doing something wrong, but can't see
> what it is... I have a Postgis table of species occurences
> & I want to pass a variable to the mapfile to select
> which speciesusing runtime substitution.
> >
> > The relevant DATA statement (joining species in the
> catch to locations in the station) in the mapfile is:
> >
> > DATA "startp from (select c.id, s.startp, s.trip_code,
>
> >               
>              
> s.station_no, c.species,
> >               
>               c.weight
> >               
>        from t_station s, catch c
> >               
>        where
> s.station_no=c.station_no
> >               
>          and c.species ilike
> '%%spp%%')
> >               
>        as myquery
> >               
>        using unique id using
> srid=4326"
> >
> >
> > The query works in Postgis & in the mapfile (via
> QGIS) when I hard code the %spp% (eg, to 'TAR')
> >
> > I'm using QGIS to open the layer, with the URL:
> > http://wms-dev/cgi-bin/mapserv?map=/srv/www/htdocs/mapdata/catch.map&spp=TAR
> >
> > QGIS appends the request type, etc & it works with
> the hard coded "spp"
> >
> > The mapfile also has:
> >    METADATA
> >      "wms_title" "species"
> >     
> "wms_srs"   "epsg:4326"
> >      "wfs_title" "species"
> >      "wfs_version" "1.0.0"
> >      "wfs_typename" "species"
> >      "wfs_request_method" "GET"
> >      "wfs_service" "WFS"
> >      "spp_validation_pattern"
> '^[A-Z0-9][A-Z0-9][A-Z0-9]$'
> >    END
> >
> > The version I'm running is MapServer version 5.4.1
> > (so no default supported)
> >
> > The docs say I can use shp2img to test runtime
> substitution in a mapfile, but I can't see how to invoke the
> substitution with the equivalent of a spp=TAR statement to
> test this.

___
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] runtime substitution not working

2010-03-14 Thread Robert Sanson
Use double %%
 
"like '%%spp%%'" and pass &spp=TAR
 
Regards,
 
Robert

>>> Joshua Hevenor  15/03/2010 1:03 p.m. >>>

I see what Ben was worried about and what you're trying to do. I haven't done a 
lot of variable substitution but I have done a lot of head scratching to when 
queries don't work as expected. A couple things that might shed some light you 
could try:

"like '%spp%'"and  pass &spp=%TAR%

If you're looking for a string containing TAR.  It might confirm that the 
double %% are being misinterpreted. 

Or you could try if this is the case and you want to force the wildcards at the 
mapfile level. 
"like '%' || '%spp%' || '%"'

Josh

--- On Sun, 3/14/10, pcr...@pcreso.com  wrote:



From: pcr...@pcreso.com 
Subject: Re: [mapserver-users] runtime substitution not working
To: mapserver-users@lists.osgeo.org 
Date: Sunday, March 14, 2010, 1:29 PM


Hi Ben...

I have it working in other setups fine - just this one won't behave.

If I use "like '%spp%'" & pass &spp=TAR, then the query that gets run is
"like 'TAR', which is basically an un-indexed =

I need a "like '%TAR%'" in the SQL hence the double % sign. I have this working 
elsewhere fine (but with different versions of mapserver & Postgis)

Capitalisation might be the problem... I'll try that...


Thanks,

   Brent


--- On Sun, 3/14/10, Ben Madin  wrote:

> From: Ben Madin  /mc/compose?to=li...@remoteinformation.com.au )>
> Subject: Re: [mapserver-users] runtime substitution not working
> To: mapserver-users@lists.osgeo.org ( 
> /mc/compose?to=mapserver-us...@lists.osgeo.org )
> Cc: pcr...@pcreso.com ( /mc/compose?to=pcr...@pcreso.com )
> Date: Sunday, March 14, 2010, 1:25 PM
> G'day Brent,
>
> It might not matter, but you have double %% in the DATA
> statement you have passed,
>
> and for whatever reason - I recevied advice from this list
> or OpenLayers list - I have all my variable names
> capitalised in the query:
>
>
> WHERE transferdate
> >= '%STARTDATE%' AND transferdate <= '%ENDDATE%'
>
> AND
> line_geom IS NOT NULL
>
> AND
> sourceshire NOT LIKE destinationshire
>
> AND
> sourceshire LIKE '%SOURCESHIRE%'
>
> So I hope these might help if Steve's solution didn't
>
> cheers
>
> Ben
>
>
>
> On 13/03/2010, at 24:00 , mapserver-users-requ...@lists.osgeo.org ( 
> /mc/compose?to=mapserver-users-requ...@lists.osgeo.org )
> wrote:
>
> > I'm obviously doing something wrong, but can't see
> what it is... I have a Postgis table of species occurences
> & I want to pass a variable to the mapfile to select
> which speciesusing runtime substitution.
> >
> > The relevant DATA statement (joining species in the
> catch to locations in the station) in the mapfile is:
> >
> > DATA "startp from (select c.id, s.startp, s.trip_code,
>
> >   
>  
> s.station_no, c.species,
> >   
>   c.weight
> >   
>from t_station s, catch c
> >   
>where
> s.station_no=c.station_no
> >   
>  and c.species ilike
> '%%spp%%')
> >   
>as myquery
> >   
>using unique id using
> srid=4326"
> >
> >
> > The query works in Postgis & in the mapfile (via
> QGIS) when I hard code the %spp% (eg, to 'TAR')
> >
> > I'm using QGIS to open the layer, with the URL:
> > http://wms-dev/cgi-bin/mapserv?map=/srv/www/htdocs/mapdata/catch.map&spp=TAR
> >  
> >
> > QGIS appends the request type, etc & it works with
> the hard coded "spp"
> >
> > The mapfile also has:
> >METADATA
> >  "wms_title" "species"
> > 
> "wms_srs"   "epsg:4326"
> >  "wfs_title" "species"
> >  "wfs_version" "1.0.0"
> >  "wfs_typename" "species"
> >  "wfs_request_method" "GET"
> >  "wfs_service" "WFS"
> >  "spp_validation_pattern"
> '^[A-Z0-9][A-Z0-9][A-Z0-9]$'
> >END
> >
> > The version I'm running is MapServer version 5.4.1
> > (so no default supported)
> >
> > The docs say I can use shp2img to test runtime
> substitution in a mapfile, but I can't s