Problems using querymap with php/mapscript
Jim White
jbw2003 at EARTHLINK.NET
Fri Nov 3 09:30:44 PST 2006
I want to use a querymap to add transparent hatch symbols to a true
color WMS layer. I have been able to create transparent hatch symbols in
256 color mode that work as a regular map and also as a querymap. When I
change the outputformat to RGBA, then the regular output correctly
display transparent hatch symbols, but the hatch pattern produced by the
querymap is not transparent. Here is an example code amd mapfile:
$this_layer = $map->getLayerByName('gapman');
$this_layer->set('status', MS_OFF);
if (isset($key_gapman)) $this_layer->set('status', MS_ON);
$layer_index = $this_layer->index;
for($i=0; $i<count($key_gapman); $i++){
@$map->queryByIndex($layer_index,1,$key_gapman[$i], MS_TRUE);
}
LAYER
CONNECTIONTYPE postgis
NAME "gapman"
CONNECTION "user=postgres dbname=mydb host=localhost"
DATA "wkb_geometry FROM steward_gap_man"
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
I have a second problem related to displaying the WMS layer map. When I
output the standard map the WMS layer displays correctly. However, when
I display the querymap the WMS layer is not correct. When it is first
displayed it does not align with the other layers, and when I zoom it
gets worse. Here is my code:
//creating main map
$mapname = "map".rand(0,9999999).".png";
$mspath = "/var/www/html/temp/";
$maploc = "{$mspath}{$mapname}";
$map->setSize($win_w, $win_h);
$map->zoompoint($zoom, $click_point, $win_w, $win_h, $old_extent);
//creating querymap
//$map->querymap->set('width', $win_w);
//$map->querymap->set('height', $win_h);
$queryimage = $map->drawQuery();
$queryimage->saveImage($maploc);
//display main map, not used if querymap displayed
//$mapimage = $map->draw();
//$mapimage->saveImage($maploc);
--
Jim White
Biological and Spatial Information Center
North Carolina State University
http://www.basic.ncsu.edu/
More information about the MapServer-users
mailing list