/usr/share/doc/php5-mapscript/examples/test_draw_legend_icon.phtml is in php5-mapscript 6.4.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | <HTML>
<BODY BGCOLOR="#CCCCCC">
<CENTER>
<H1>PHP/MapScript module test</H1>
<P>
<?php
//
// This example opens a regular MapServer .MAP file, renders the main
// Map image (with the default layers enabled), the legend and the
// scale bar, and displays them in the HTML output.
//
//
// Load MapScript module.
//
if (PHP_OS == "WINNT" || PHP_OS == "WIN32")
{
dl("php_mapscript.dll");
}
else
{
dl("php_mapscript.so");
}
//
// Load MapServer .map file
//
// You can download the MapServer demo data from http://mapserver.gis.umn.edu/
//
$map = ms_newMapObj("gmap75.map");
// print $map->numlayers;
// phpinfo();
//
// RENDER MAIN MAP
//
// Note: If you get errors with the saveWebImage() call below, then make sure
// that the directory specified by IMAGEPATH in the .MAP file exists and is
// writable by the httpd user.
//
$img = $map->draw();
$url = $img->saveWebImage();
printf("<IMG SRC=%s WIDTH=%d HEIGHT=%d>\n", $url, $map->width, $map->height);
//
// LEGEND
//
$img = $map->drawLegend();
$url = $img->saveWebImage();
printf("<P>Draw into one picture.<BR><IMG SRC=%s>\n", $url);
// Draw all legend icon from all class in all layers
printf("<P>Draw each icon seperatly.<BR>");
printf("<TABLE BGCOLOR=WHITE>");
for ($i=0; $i<$map->numlayers; $i++)
{
$layer = $map->getLayer($i);
if ($layer->status != MS_OFF && $layer->type != MS_LAYER_QUERY)
for ($j=0; $j<$layer->numclasses; $j++)
{
$myClass = $layer->GetClass($j);
$img = $myClass->createLegendIcon($map->keysizex, $map->keysizey);
$url = $img->saveWebImage();
printf("<TR><TD><IMG SRC=%s></TD><TD>%s</TD></TR>", $url, $myClass->name);
}
}
printf("</TABLE>");
//
// SCALE BAR
//
$img = $map->drawScaleBar();
$url = $img->saveWebImage();
printf("<P><IMG SRC=%s>\n", $url);
?>
</BODY>
</HTML>
|