[mapserver-users] Can the PROCESSING layer attribute be set dynamically through (PHP) MapScript?
Dan Little
theduckylittle at gmail.com
Tue May 27 07:09:34 PDT 2014
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
<mandschulz at 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.Goddijn at 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.goddijn at meteogroup.com
>>
>> MeteoGroup
>>
>>
>>
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
>
> --
> -----------------------------------------------------------
> Michael Schulz
>
> Bahnhofstr. 62
> D-63477 Maintal
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list