[mapserver-users] Can the PROCESSING layer attribute be set dynamically through (PHP) MapScript?
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
Re: [mapserver-users] Can the PROCESSING layer attribute be set dynamically through (PHP) MapScript?
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?
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] itemquery and validation
Correct. We do it this way since many drivers don't require a QITEM. For example, you could author a qstring that leverages multiple columns. Steve -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Eichner, Andreas - SID Sent: Monday, May 26, 2014 7:15 AM To: 'Leehan'; mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] itemquery and validation here s the part of the mapfile : LAYER NAME emprise STATUS on TYPE POLYGON CONNECTIONTYPE POSTGIS CONNECTION host=10.3.1.51 dbname=xxx user=xxx password=xxx port=5432 DATA geom from activite.emprise using unique gid using srid = 2154 TOLERANCE 1 #tampon autour du clic souris TOLERANCEUNITS kilometers VALIDATION numope ^[A-Z]{1}[0-9]{6}$ END #end validation CLASSITEM tpeope According to the source you need to define a validation pattern for qstring on LAYER or in WEB section, too. This looks a bit weird to me as you specify the QITEM. Therefore a single validation pattern for QSTRING must cover all possible QITEM values... I've never used such modes but may be some else can shed some light on 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