Re: [mapserver-users] Can the PROCESSING layer attribute be set dynamically through (PHP) MapScript?

2014-05-28 Thread Jorrit Goddijn
Hi Dan, 

Yes I only just saw that you can load layer definitions from strings. This 
would be indeed much less  cumbersome than using mapscript. We'll have a look 
at this for our next project/. 

Thanks for your input!
Jorrit

-Original Message-
From: Dan Little [mailto:theduckylit...@gmail.com] 
Sent: dinsdag 27 mei 2014 16:10
To: Michael Schulz
Cc: Jorrit Goddijn; mapserver-users@lists.osgeo.org
Subject: Re: [mapserver-users] Can the PROCESSING layer attribute be set 
dynamically through (PHP) MapScript?

You might want to reconsider how your script is built.  Instead of loading up 
the Mapfile and tweaking small parameters with MapScript, consider converting 
your mapfile to a template language.  This way you can forumulate the mapfile, 
load it as a string, do the appropriate substitutions, then use PHP to serve it 
as WxS.

This usually ends up being faster, easier to maintain, and more flexible over 
the long term.

On Tue, May 27, 2014 at 6:33 AM, Michael Schulz mandsch...@googlemail.com 
wrote:
 Hi Jorrit,

 maybe it's just a type in the second setprocessing line of your example:

 $current_layer-setprocessing('BANDS=1,2');  #removed second bracket

 Cheers, Michael


 2014-05-27 11:50 GMT+02:00 Jorrit Goddijn jorrit.godd...@meteogroup.com:

 Hi all,



 I’m drawing layers based on GRIB data files. Each file contains 
 several bands (datasets). I can access these datasets by setting the 
 PROCESSING attribute on the LAYER object. As in this example:



 #

 LAYER

   NAME current_grid

   TYPE POINT

   CONNECTIONTYPE uvraster

   DATA
 /var/www/mapserver/data/grib/routeguard/4nwwin99_2013110412.grb2#v and
 u-component of current

   PROCESSING BANDS=1,2

   PROCESSING UV_SPACING=20

   CLASS

 STYLE

   SYMBOL arrow

   ANGLE [uv_angle]

   SIZE [uv_length]

   COLOR 255 0 0

 END # style

   END # class



   PROJECTION

   #init=epsg:4326

   +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +pm=-360

   END

 END # layer

 



 This works fine. But I need to set the PROCESSING values dynamically 
 through mapscript. If I add this code to my script (which works fine 
 without these lines):



 

 $map = ms_newMapObj($_GET['MAP']);

 $current_layer = $map-getlayerbyname('current_grid');

 // both of these do not work

//$current_layer-set('processing', 'BANDS=1,2'));

 //$current_layer-setprocessing('BANDS=1,2'));

 $request = createRequest();

$result = $map-owsdispatch($request);

 



 I get an internal server error (500). It seems that setting any 
 attribute via the layer-set() method causes this behavior. I’m 
 migrating from MS 5.4, does the set method still work as expected?



 Thank you



 Jorrit Goddijn

 jorrit.godd...@meteogroup.com

 MeteoGroup




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




 --
 ---
 Michael Schulz

 Bahnhofstr. 62
 D-63477 Maintal


 ___
 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] Can the PROCESSING layer attribute be set dynamically through (PHP) MapScript?

2014-05-28 Thread Rahkonen Jukka (Tike)
Hi,

It would be easier to play with PROCESSING attributes if they could be changed 
with runtime substitution. Thomas Bonfort has written that any favorite 
MapServer provider can do the addition.

http://lists.osgeo.org/pipermail/mapserver-users/2013-September/075342.html

-Jukka Rahkonen-

Jorrit Goddijn wrote:

 
 Hi Dan,
 
 Yes I only just saw that you can load layer definitions from strings. This 
 would be
 indeed much less  cumbersome than using mapscript. We'll have a look at this
 for our next project/.
 
 Thanks for your input!
 Jorrit
 
 -Original Message-
 From: Dan Little [mailto:theduckylit...@gmail.com]
 Sent: dinsdag 27 mei 2014 16:10
 To: Michael Schulz
 Cc: Jorrit Goddijn; mapserver-users@lists.osgeo.org
 Subject: Re: [mapserver-users] Can the PROCESSING layer attribute be set
 dynamically through (PHP) MapScript?
 
 You might want to reconsider how your script is built.  Instead of loading up 
 the
 Mapfile and tweaking small parameters with MapScript, consider converting
 your mapfile to a template language.  This way you can forumulate the mapfile,
 load it as a string, do the appropriate substitutions, then use PHP to serve 
 it as
 WxS.
 
 This usually ends up being faster, easier to maintain, and more flexible over 
 the
 long term.
 
 On Tue, May 27, 2014 at 6:33 AM, Michael Schulz
 mandsch...@googlemail.com wrote:
  Hi Jorrit,
 
  maybe it's just a type in the second setprocessing line of your example:
 
  $current_layer-setprocessing('BANDS=1,2');  #removed second bracket
 
  Cheers, Michael
 
 
  2014-05-27 11:50 GMT+02:00 Jorrit Goddijn
 jorrit.godd...@meteogroup.com:
 
  Hi all,
 
 
 
  I’m drawing layers based on GRIB data files. Each file contains
  several bands (datasets). I can access these datasets by setting the
  PROCESSING attribute on the LAYER object. As in this example:
 
 
 
  #
 
  LAYER
 
NAME current_grid
 
TYPE POINT
 
CONNECTIONTYPE uvraster
 
DATA
  /var/www/mapserver/data/grib/routeguard/4nwwin99_2013110412.grb2
 #v and
  u-component of current
 
PROCESSING BANDS=1,2
 
PROCESSING UV_SPACING=20
 
CLASS
 
  STYLE
 
SYMBOL arrow
 
ANGLE [uv_angle]
 
SIZE [uv_length]
 
COLOR 255 0 0
 
  END # style
 
END # class
 
 
 
PROJECTION
 
#init=epsg:4326
 
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +pm=-360
 
END
 
  END # layer
 
  
 
 
 
  This works fine. But I need to set the PROCESSING values dynamically
  through mapscript. If I add this code to my script (which works fine
  without these lines):
 
 
 
  
 
  $map = ms_newMapObj($_GET['MAP']);
 
  $current_layer = $map-getlayerbyname('current_grid');
 
  // both of these do not work
 
 //$current_layer-set('processing', 'BANDS=1,2'));
 
  //$current_layer-setprocessing('BANDS=1,2'));
 
  $request = createRequest();
 
 $result = $map-owsdispatch($request);
 
  
 
 
 
  I get an internal server error (500). It seems that setting any
  attribute via the layer-set() method causes this behavior. I’m
  migrating from MS 5.4, does the set method still work as expected?
 
 
 
  Thank you
 
 
 
  Jorrit Goddijn
 
  jorrit.godd...@meteogroup.com
 
  MeteoGroup
 
 
 
 
  ___
  mapserver-users mailing list
  mapserver-users@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/mapserver-users
 
 
 
 
  --
  ---
  Michael Schulz
 
  Bahnhofstr. 62
  D-63477 Maintal
 
 
  ___
  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
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] Can the PROCESSING layer attribute be set dynamically through (PHP) MapScript?

2014-05-27 Thread Michael Schulz
Hi Jorrit,

maybe it's just a type in the second setprocessing line of your example:

$current_layer-setprocessing('BANDS=1,2');  #removed second bracket

Cheers, Michael


2014-05-27 11:50 GMT+02:00 Jorrit Goddijn jorrit.godd...@meteogroup.com:

  Hi all,



 I'm drawing layers based on GRIB data files. Each file contains several
 bands (datasets). I can access these datasets by setting the PROCESSING
 attribute on the LAYER object. As in this example:



 #

 LAYER

   NAME current_grid

   TYPE POINT

   CONNECTIONTYPE uvraster

   DATA /var/www/mapserver/data/grib/routeguard/4nwwin99_2013110412.grb2
 #v and u-component of current

   PROCESSING BANDS=1,2

   PROCESSING UV_SPACING=20

   CLASS

 STYLE

   SYMBOL arrow

   ANGLE [uv_angle]

   SIZE [uv_length]

   COLOR 255 0 0

 END # style

   END # class



   PROJECTION

   #init=epsg:4326

   +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +pm=-360

   END

 END # layer

 



 This works fine. But I need to set the PROCESSING values dynamically
 through mapscript. If I add this code to my script (which works fine
 without these lines):



 

 $map = ms_newMapObj($_GET['MAP']);

 $current_layer = $map-getlayerbyname('current_grid');

 // both of these do not work

//$current_layer-set('processing', 'BANDS=1,2'));

 //$current_layer-setprocessing('BANDS=1,2'));

 $request = createRequest();

$result = $map-owsdispatch($request);

 



 I get an internal server error (500). It seems that setting any attribute
 via the layer-set() method causes this behavior. I'm migrating from MS
 5.4, does the set method still work as expected?



 Thank you



 Jorrit Goddijn

 jorrit.godd...@meteogroup.com

 MeteoGroup



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




-- 
---
Michael Schulz

Bahnhofstr. 62
D-63477 Maintal
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] Can the PROCESSING layer attribute be set dynamically through (PHP) MapScript?

2014-05-27 Thread Dan Little
You might want to reconsider how your script is built.  Instead of
loading up the Mapfile and tweaking small parameters with MapScript,
consider converting your mapfile to a template language.  This way you
can forumulate the mapfile, load it as a string, do the appropriate
substitutions, then use PHP to serve it as WxS.

This usually ends up being faster, easier to maintain, and more
flexible over the long term.

On Tue, May 27, 2014 at 6:33 AM, Michael Schulz
mandsch...@googlemail.com wrote:
 Hi Jorrit,

 maybe it's just a type in the second setprocessing line of your example:

 $current_layer-setprocessing('BANDS=1,2');  #removed second bracket

 Cheers, Michael


 2014-05-27 11:50 GMT+02:00 Jorrit Goddijn jorrit.godd...@meteogroup.com:

 Hi all,



 I’m drawing layers based on GRIB data files. Each file contains several
 bands (datasets). I can access these datasets by setting the PROCESSING
 attribute on the LAYER object. As in this example:



 #

 LAYER

   NAME current_grid

   TYPE POINT

   CONNECTIONTYPE uvraster

   DATA
 /var/www/mapserver/data/grib/routeguard/4nwwin99_2013110412.grb2#v and
 u-component of current

   PROCESSING BANDS=1,2

   PROCESSING UV_SPACING=20

   CLASS

 STYLE

   SYMBOL arrow

   ANGLE [uv_angle]

   SIZE [uv_length]

   COLOR 255 0 0

 END # style

   END # class



   PROJECTION

   #init=epsg:4326

   +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +pm=-360

   END

 END # layer

 



 This works fine. But I need to set the PROCESSING values dynamically
 through mapscript. If I add this code to my script (which works fine without
 these lines):



 

 $map = ms_newMapObj($_GET['MAP']);

 $current_layer = $map-getlayerbyname('current_grid');

 // both of these do not work

//$current_layer-set('processing', 'BANDS=1,2'));

 //$current_layer-setprocessing('BANDS=1,2'));

 $request = createRequest();

$result = $map-owsdispatch($request);

 



 I get an internal server error (500). It seems that setting any attribute
 via the layer-set() method causes this behavior. I’m migrating from MS 5.4,
 does the set method still work as expected?



 Thank you



 Jorrit Goddijn

 jorrit.godd...@meteogroup.com

 MeteoGroup




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




 --
 ---
 Michael Schulz

 Bahnhofstr. 62
 D-63477 Maintal


 ___
 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