alpha transparency and querymap
Steve Lime
Steve.Lime at DNR.STATE.MN.US
Mon Dec 18 09:41:50 PST 2006
How many search results are you seeing on average? There are a couple
of
work arounds:
1 - one would be to use the result set to craft a filter for the
layer(s) in question
so that only those features that match the filter get drawn
2 - another would be to add the features to the layer or a copy of the
layer (e.g.
use inline features instead of the datasource)
In both cases you'd use $map->draw() instead of drawQuery() and would
avoid
the alpha blending problem. Option one would work nicely if you have
relatively
few (less than 20) features, while the other would work well in any
case.
Steve
>>> Jim White <jbw2003 at earthlink.net> 12/17/2006 10:16 PM >>>
Steve,
Here are the querymap and symbol portions of the mapfile. I think that
is what you mean by type.
SYMBOL
NAME 'hatch-lines'
TYPE HATCH
END
QUERYMAP
STATUS ON
STYLE SELECTED
END
Jim
Steve Lime wrote:
> Jim: What does the querymap def look like? What TYPE are you using?
>
> Steve
>
>
>>>> Jim White <jbw2003 at earthlink.net> 12/13/2006 8:29:28 PM >>>
>>>>
> 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
>
>
>
--
Jim White
Biodiversity and Spatial Information Center
North Carolina State University
http://www.basic.ncsu.edu/
More information about the MapServer-users
mailing list