alpha transparency and querymap

Jim White jbw2003 at EARTHLINK.NET
Wed Dec 13 18:29:28 PST 2006


Steve,

First some of the mapfile:

 OUTPUTFORMAT
         NAME mypng
         DRIVER "GD/PNG"
         MIMETYPE "image/png"
         IMAGEMODE rgba
         EXTENSION "png"
         TRANSPARENT ON
 END

  LAYER
          CONNECTIONTYPE postgis
          NAME "counties_q"
          CONNECTION "user=postgres  dbname=mydb host=localhost"
          DATA "wkb_geometry FROM county"
          STATUS OFF
          TYPE POLYGON
          TRANSPARENCY alpha
          CLASS
               STYLE
             SYMBOL 'hatch-lines'
             COLOR 255 0 0      
                   ANGLE 60
                   SIZE 10
               END     
               STYLE
                  WIDTH 2
                  OUTLINECOLOR 255 0 0
               END              
               TEMPLATE "dummy.html"
          END         
      END

Here's the PHP/mapscript for one of the layers that's used to display 
items the user selects from a select box. The idea is to create a 
transparent hatch pattern over a user created area of interest before it 
is submitted. This is currently working with the maps we have but we 
might like to add a satellite background or a shaded dem background, 
which I imagine will look better in true color.

$this_layer = $map->getLayerByName('counties_q');
$this_layer->set('status', MS_OFF);
if (isset($key_counties)) $this_layer->set('status', MS_ON);
$layer_index = $this_layer->index;
for($i=0; $i<count($key_counties); $i++){
   @$map->queryByIndex($layer_index,1,$key_counties[$i], MS_TRUE);

and followed eventually by:

$queryimage = $map->drawQuery();
$queryimage->saveImage($maploc);



The counties_q layer will properly display in rgba mode if I just set it 
to default and don't use the queryByIndex method to select particular 
elements in the layer. It will also display properly in 256 color mode 
using queryByIndex. However, when I use queryByIndex in rgba mode the 
hatch pattern is not transparent and has the white background.

Thanks,
Jim

Steve Lime wrote:
> My guess is it's a bug in the querymap code. On occasion developers will
> update
> the main drawing code and forget about that other path.
>
> Tell me more about your setup (PHP,CGI or ?, what type of querymap?).
> There may
> be a workaround (almost always is) using standard maps...
>
> Steve
>
>   
>>>> Jim White <jbw2003 at EARTHLINK.NET> 12/12/06 9:19 PM >>>
>>>>         
> I am having a continuing problem using alpha transparency and querymap. 
> I want to display my map in true color, so have set imagemode to rgba. 
> Additionally, I have defined a hatch-lines symbol that I want to display
>
> in transparent mode. I am using the queryByIndex method  to select the 
> items to display in the layer. I have tried many combinations, but still
>
> get a white background behind the hatch-lines instead of the background
> map.
>
> Will appreciate any help to find a fix or to determine whether this is a
>
> bug in querymap.
>
> Thanks,
>
> Jim
>
>   


-- 
Jim White
Biodiversity and Spatial Information Center
North Carolina State University
http://www.basic.ncsu.edu/



More information about the MapServer-users mailing list