[maplab-users] how to stop maplab querying raster layers

Zak James zak-ms at hoppsan.org
Tue Nov 23 13:43:38 EST 2004


Joanne,

I checked the mapbrowser code and it will only add a layer to the 
queryable set if the layer has status set to ON or DEFAULT. Mapserver 
will only generate query results for layers with the TEMPLATE set, but 
it is possible those layers are causing a slowdown just because they 
are being added to the list - I'm not sure why.

If you are prepared to modify the source code, you could edit the 
maplab/htdocs/mapbrowser/query.phtml file so that it ignored raster 
layers.

Around line 140, you would need to add a clause to the code that checks 
the status:
     for ( $i=0; $i<$nCount; $i++ )
     {
         // get layer name
         $oLayer = $oMap->getLayer( $i );

         // only add if on
         if (( $oLayer->status == MS_ON || $oLayer->status == 
MS_DEFAULT) &&
               $oLayer->type != MS_LAYER_RASTER)         //<-----ignore 
rasters
         {
             array_push( $aszLayers, $oLayer->name );
         }
     }

If you would like more control over which layers are ignored, you might 
try doing something with the layer metadata or connectiontype. Details 
on the available elements can be found here:

http://mapserver.gis.umn.edu/doc/phpmapscript-class-guide.html

zak
--
Zak James
Applications and Software Development
DM Solutions Group Inc.
http://www.dmsolutions.ca

On Tue, 23 Nov 2004 17:18:02 -0000, joanne cook 
<j.cook at oxfordarch.co.uk> wrote:
 > Hi Zak,
 >
 > Thanks for your advice. Unfortunately I am still having the same 
problem. I checked the map file in a text editor, and only the vector 
layers have any kind of template attached, with the exception of the 
legend object (and I've even tried getting rid of that). I'm getting 
the problem with MapBrowser rather than the preview in MapEdit (which I 
can't get to work for other reasons). Is it possible that MapBrowser is 
also automatically adding the Template setting to Layers in the loaded 
map file, and how could I check this?
 >
 > Thanks again
 >
 > Jo
 >
 > -------------------------------------------
 > Joanne Cook
 > Oxford Archaeology North
 > -------------------------------------------
 >
 > ________________________________
 >
 > From: Zak James [mailto:zak-ms at hoppsan.org]
 > Sent: Tue 23/11/2004 16:14
 > To: joanne cook
 > Cc: maplab-users at maptools.org
 > Subject: [maplab-users] how to stop maplab querying raster 
layers[Scanned for Viruses and Spam]
 >
 > Joanne,
 >
 > Ordinarily, LAYERS that contain no TEMPLATE keyword will not be
 > queried. You may need to edit the mapfile in a text editor to remove
 > these because mapedit may still retain them even if they are empty in
 > the LAYER form. Note that CLASSes within LAYERS may also have a
 > TEMPLATE which would make the entire layer subject to queries.
 >
 > Also, while gmapfactory will respect the TEMPLATE settings, the 
preview
 > inside mapedit may not (i.e. it might add the TEMPLATE setting to all
 > layers in the loaded mapfile to allow queries in the preview).
 >
 > zak
 >
 > --
 > Zak James
 > Applications and Software Development
 > DM Solutions Group Inc.
 > http://www.dmsolutions.ca
 >
 > On Tue, 23 Nov 2004 09:04:13 -0000, joanne cook
 > <j.cook at oxfordarch.co.uk> wrote:
 >  > Hi List,
 >  >
 >  > I have a simple map with two vector layers and a background basemap
 > consisting of several tiled rasters. When I use the query tool in
 > mapbrowser it tries to give me results from every layer in my map,
 > including all of the rasters. If I have all of the rasters on, this
 > process takes so long that my php session actually times out! I don't
 > think I have a global template set anywhere in my map file, just in 
the
 > two vector layers, so why is maplab trying to query every layer and 
how
 > can I stop it?
 >  >
 >  > I am using maplab 2.2, with mapserver version 4.1, php 4.3.4, 
apache
 > 2 on a windows 2000 system. I have included my map file, with some of
 > the raster layers taken out for brevity's sake!
 >  >
 >  > Hope you can help,
 >  >
 >  > Jo Cook
 >  >
 >  > -------------------------------------Map
 > File--------------------------------------------------
 >  >
 >  > MAP
 >  >   NAME "OS Coverage"
 >  >   STATUS ON
 >  >   EXTENT -299000 0 999000 1300000
 >  >   SIZE 400 400
 >  >   SHAPEPATH "data"
 >  >   SYMBOLSET "C:/Program Files/Apache
 > Group/Apache2/htdocs/OS_Coverage/symbols35.sym"
 >  >   FONTSET "./fonts/fonts.txt"
 >  >   IMAGETYPE JPEG
 >  >   IMAGECOLOR 255 255 255
 >  >   UNITS METERS
 >  >   DEBUG ON
 >  >   WEB
 >  >     IMAGEPATH "C:/Program Files/Apache
 > Group/Apache2/htdocs/tmp/ms_tmp/"
 >  >     IMAGEURL "/tmp/ms_tmp/"
 >  >     LOG "C:/Program Files/Apache 
Group/Apache2/htdocs/tmp/mapserv.log"
 >  >     METADATA
 >  >       "WMS_SRS"    "EPSG:BNG"
 >  >       "WMS_ONLINERESOURCE"
 > "http://pc242-lancs/cgi-bin/mapserv.exe?map=C:/Program
 > <http://pc242-lancs/cgi-bin/mapserv.exe?map=C:/Program>  Files/Apache
 > Group/Apache2/htdocs/OS_Coverage/Sites3.map&"
 >  >       "WMS_ABSTRACT"    "List of OA North Sites"
 >  >       "WMS_FORMATLIST"    
"image/gif,image/png,image/jpeg,image/wbmp"
 >  >       "WMS_FORMAT"    "image/jpeg"
 >  >       "WMS_ACCESSCONSTRAINTS"    "none"
 >  >       "WMS_TITLE"    "OA North Sites Map"
 >  >     END
 >  >   END
 >  >   REFERENCE
 >  >     STATUS ON
 >  >     IMAGE "C:/Program Files/Apache
 > Group/Apache2/htdocs/OS_Coverage/data/reference/outlinesm.jpg"
 >  >     SIZE 100 185
 >  >     EXTENT 0 0 700000 1.3e+006
 >  >     COLOR -1 -1 -1
 >  >     OUTLINECOLOR 255 0 0
 >  >     MINBOXSIZE 10
 >  >     MAXBOXSIZE 100
 >  >     MARKER "star"
 >  >     MARKERSIZE 8
 >  >   END
 >  >   QUERYMAP
 >  >     STATUS ON
 >  >     SIZE 100 100
 >  >     COLOR 255 0 0
 >  >     STYLE HILITE
 >  >   END
 >  >   PROJECTION
 >  >     "proj=tmerc"
 >  >     "ellps=airy"
 >  >     "lat_0=49"
 >  >     "long_0=-2"
 >  >     "k=0.999601"
 >  >     "x_0=400000"
 >  >     "y_0=-100000"
 >  >     "units=m"
 >  >     "no_defs"
 >  >   END
 >  >   LEGEND
 >  >     STATUS OFF
 >  >     IMAGECOLOR 255 255 255
 >  >     POSITION LL
 >  >     KEYSIZE 20 10
 >  >     KEYSPACING 5 5
 >  >     TEMPLATE "C:/Program Files/Apache
 > 
Group/Apache2/htdocs/maplab-2.2/htdocs/mapbrowser/legend_template.html"
 >  >     LABEL
 >  >       TYPE BITMAP
 >  >       SIZE MEDIUM
 >  >       OFFSET 0 0
 >  >       BUFFER 0
 >  >       MINDISTANCE -1
 >  >       MINFEATURESIZE -1
 >  >       COLOR 0 0 0
 >  >       PARTIALS TRUE
 >  >       FORCE FALSE
 >  >     END
 >  >   END
 >  >   SCALEBAR
 >  >     STATUS ON
 >  >     COLOR 0 0 0
 >  >     OUTLINECOLOR 0 0 0
 >  >     IMAGECOLOR 255 255 255
 >  >     TRANSPARENT FALSE
 >  >     UNITS KILOMETERS
 >  >     INTERVALS 7
 >  >     SIZE 250 4
 >  >     STYLE 0
 >  >     POSITION LL
 >  >     LABEL
 >  >       TYPE BITMAP
 >  >       SIZE TINY
 >  >       POSITION CC
 >  >       OFFSET 0 0
 >  >       BUFFER 0
 >  >       MINDISTANCE -1
 >  >       MINFEATURESIZE -1
 >  >       COLOR 0 0 0
 >  >       PARTIALS TRUE
 >  >       FORCE FALSE
 >  >     END
 >  >   END
 >  >   OUTPUTFORMAT
 >  >     NAME "jpeg"
 >  >     MIMETYPE "image/jpeg"
 >  >     DRIVER "GD/JPEG"
 >  >     EXTENSION "jpeg"
 >  >     IMAGEMODE PC256
 >  >     TRANSPARENT TRUE
 >  >     FORMATOPTION    "QUALITY=100"
 >  >   END
 >  >   LAYER
 >  >     NAME "HP"
 >  >     STATUS ON
 >  >     DATA "HP.tif"
 >  >     TYPE RASTER
 >  >     UNITS METERS
 >  >     SIZEUNITS PIXELS
 >  >     TOLERANCE 0
 >  >     TOLERANCEUNITS PIXELS
 >  >     METADATA
 >  >       "WMS_TITLE"    "map"
 >  >     END
 >  >   END
 >  >   LAYER
 >  >     NAME "HT"
 >  >     STATUS ON
 >  >     DATA "HT.tif"
 >  >     TYPE RASTER
 >  >     UNITS METERS
 >  >     SIZEUNITS PIXELS
 >  >     TOLERANCE 0
 >  >     TOLERANCEUNITS PIXELS
 >  >     METADATA
 >  >       "WMS_TITLE"    "map"
 >  >     END
 >  >   END
 >  >    LAYER
 >  >     NAME "CALevents"
 >  >     STATUS ON
 >  >     DATA "event"
 >  >     TYPE POINT
 >  >     UNITS METERS
 >  >     SIZEUNITS PIXELS
 >  >     LABELITEM "SiteCode"
 >  >     LABELMAXSCALE 200000
 >  >     TOLERANCE 1
 >  >     TOLERANCEUNITS PIXELS
 >  >     TEMPLATE "./templates/calsites.html"
 >  >     DEBUG ON
 >  >     METADATA
 >  >       "WMS_SRS"    "EPSG:BNG"
 >  >       "WMS_TITLE"    "CALevents"
 >  >     END
 >  >     PROJECTION
 >  >       "proj=tmerc"
 >  >       "ellps=airy"
 >  >       "lat_0=49"
 >  >       "long_0=-2"
 >  >       "k=0.999601"
 >  >       "x_0=400000"
 >  >       "y_0=-100000"
 >  >       "units=m"
 >  >       "no_defs"
 >  >     END
 >  >     CLASS
 >  >       NAME "CALevents"
 >  >       TEMPLATE "./templates/calsites.html"
 >  >       LABEL
 >  >         TYPE BITMAP
 >  >         SIZE SMALL
 >  >         POSITION CL
 >  >         OFFSET 0 0
 >  >         BUFFER 4
 >  >         MINDISTANCE 300
 >  >         MINFEATURESIZE -1
 >  >         COLOR 0 0 0
 >  >         PARTIALS TRUE
 >  >         FORCE FALSE
 >  >       END
 >  >       STYLE
 >  >         SYMBOL 7
 >  >         COLOR 0 0 192
 >  >         SIZE 7
 >  >         MINSIZE 1
 >  >         MAXSIZE 100
 >  >       END
 >  >     END
 >  >   END
 >  >   LAYER
 >  >     NAME "OANSites"
 >  >     STATUS ON
 >  >     TYPE POINT
 >  >     CONNECTIONTYPE OGR
 >  >     CONNECTION "virtual.ovf"
 >  >     UNITS METERS
 >  >     SIZEUNITS PIXELS
 >  >     LABELITEM "ProjectSiteCode"
 >  >     LABELMAXSCALE 200000
 >  >     TOLERANCE 1
 >  >     TOLERANCEUNITS PIXELS
 >  >     TEMPLATE "./templates/sites.html"
 >  >     DEBUG ON
 >  >     METADATA
 >  >       "WMS_TITLE"    "OA North Sites"
 >  >     END
 >  >     PROJECTION
 >  >       "proj=tmerc"
 >  >       "ellps=airy"
 >  >       "lat_0=49"
 >  >       "long_0=-2"
 >  >       "k=0.999601"
 >  >       "x_0=400000"
 >  >       "y_0=-100000"
 >  >       "units=m"
 >  >       "no_defs"
 >  >     END
 >  >     CLASS
 >  >       NAME "OANSites"
 >  >       TEMPLATE "./templates/sites.html"
 >  >       LABEL
 >  >         TYPE BITMAP
 >  >         SIZE SMALL
 >  >         POSITION CL
 >  >         OFFSET 0 0
 >  >         BUFFER 4
 >  >         MINDISTANCE 300
 >  >         MINFEATURESIZE -1
 >  >         COLOR 0 0 0
 >  >         PARTIALS TRUE
 >  >         FORCE FALSE
 >  >       END
 >  >       STYLE
 >  >         SYMBOL 7
 >  >         COLOR 155 0 255
 >  >         SIZE 7
 >  >         MINSIZE 1
 >  >         MAXSIZE 100
 >  >       END
 >  >     END
 >  >   END
 >  > END
 >  > ---------------------------End map
 > file--------------------------------------------
 >  >
 >  > -------------------------------------------
 >  > Joanne Cook
 >  > Oxford Archaeology North
 >  > -------------------------------------------
 >  >
 >  > _______________________________________________
 >  > Maplab-users mailing list
 >  > Maplab-users at lists.maptools.org
 >  > http://lists.maptools.org/mailman/listinfo/maplab-users
 >  >
 >
 > _______________________________________________
 > Maplab-users mailing list
 > Maplab-users at lists.maptools.org
 > http://lists.maptools.org/mailman/listinfo/maplab-users
 >



More information about the Maplab-users mailing list