⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_draw_legend_icon.phtml

📁 Welcome to MS4W, the no fuss installer for setting up MapServer on Microsoft Windows platforms. The
💻 PHTML
字号:
<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("php3_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("/home/msapps/gmap/htdocs/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(MS_PNG, 0, 0, 0);printf("<IMG SRC=%s WIDTH=%d HEIGHT=%d>\n", $url, $map->width, $map->height); //// LEGEND//$img = $map->drawLegend();$url = $img->saveWebImage(MS_PNG, 0, 0, 0);printf("<P>Draw into one picture.<BR><IMG SRC=%s>\n", $url);// Draw all legend icon from all class in all layersprintf("<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(MS_PNG, 0, 0, 0);                    printf("<TR><TD><IMG SRC=%s></TD><TD>%s</TD></TR>", $url, $myClass->name);      }}printf("</TABLE>");//// SCALE BAR//$img = $map->drawScaleBar();$url = $img->saveWebImage(MS_PNG, 0, 0, 0);printf("<P><IMG SRC=%s>\n", $url); ?> </BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -