Legend problems

Ferencik Ioan ferencik.ioan at PERSONAL.RO
Wed Apr 13 00:42:28 PDT 2005


Thanks Bart,
You were right....I see now the GIF legend....i wil try to create a HTML legend
now..I did
Many thanks,
Iano Ferencik



> Hi,
>
> only CLASSes which have a NAME will show up in the legend. Try that first.
>
> Best regards,
> Bart
>
> Bart van den Eijnden
> Syncera-ITSolutions
> Postbus 270
> 2600 AG  DELFT
>
> tel.nr.: 015-7512436
> email: BEN at Syncera-ITSolutions.nl
>
> >>> Ferencik Ioan <ferencik.ioan at PERSONAL.RO> 04/12/05 12:23pm >>>
> I am building a simple mapserver aplication....and i have problems with legend
> .....i created a LEGEND object in the map file and in the index.php with
> phpmapscript......the legend from mapscript produces a small PNG file where I
> see a little square...when i comment the legend lines from mapscript i seen
> nothing at all. Any suggestions(probably it is simple but i can't see it:)) )
>
> here is my map file:
>
> MAP
>         NAME "rosia"
>         STATUS ON
>         SHAPEPATH "date"
>         SIZE 800 600
>         IMAGETYPE PNG24
>         IMAGECOLOR 255 255 255
>         EXTENT  319780 522564 385192 575568
>                 PROJECTION
>                         "init=epsg:31700"
>                 END
>         FONTSET "fonts/fonts.list"
>         SYMBOLSET "simbol/simbol.sym"
>
>         REFERENCE
>                 EXTENT  319780 522564 385192 575568
>                 IMAGE "date/raster/dem.png"
>                 SIZE 100 100
>                 STATUS ON
>                 COLOR -1 -1 -1
>
>
>         END
>         LAYER
>                 NAME "dem"
>                 DATA 'raster/demback.tif'
>                 TYPE RASTER
>                         PROJECTION
>                                 "init=epsg:31700"
>                         END
>                 STATUS ON
>
>
>         END
>
>         #LAYER
>
>                 #AME "curbe"
>                 #DATA curbe
>                 #TYPE LINE
>                 #LABELITEM "COTA"
>                         #PROJECTION
>                                 #"init=epsg:31700"
>                         #END
>                 #STATUS DEFAULT
>                         #CLASS
>                                 #COLOR 160 81 45
>                         #END
>
>
>
>
>         #END
>
>
>
>         LAYER
>
>                 NAME "xysediment04"
>                 DATA xysediment04
>                 TYPE POINT
>                 #LABELITEM "COTA"
>                         PROJECTION
>                                 "init=epsg:31700"
>                         END
>                 STATUS DEFAULT
>                 CLASS
>                         COLOR 32 79 240 #albastru
>                         SYMBOL "star"
>                         EXPRESSION ([CD_114] < 1)
>                         SIZE 10
>                 END
>
>                 CLASS
>                         COLOR 240 11 16 #rosu
>                         SYMBOL "star"
>                         EXPRESSION ([CD_114] > 1)
>                         SIZE 10
>                 END
>
>
>
>         END
>
>         LAYER
>
>                 NAME "rauri"
>                 DATA retea
>                 TYPE LINE
>                 LABELITEM "DENUMIRE"
>                         PROJECTION
>                                 "init=epsg:31700"
>                         END
>                 STATUS DEFAULT
>                         CLASS
>                                 COLOR 35 57 214
>
>                                 STYLE
>                                         SIZE 50
>                                         SYMBOL "line1"
>                                 END
>                         LABEL
>                                 ANGLE AUTO
>                                 BUFFER 10
>                                 COLOR 35 57 214
>                                 FONT "Verdana"
>                                 TYPE TRUETYPE
>                                 SIZE 8
>                                 OFFSET 5 5
>                         END
>
>                         END
>
>
>
>
>         END
>
>         LAYER
>
>                 NAME "aries"
>                 DATA aries
>                 TYPE LINE
>
>                         PROJECTION
>                                 "init=epsg:31700"
>                         END
>                 STATUS DEFAULT
>                         CLASS
>                                 COLOR 35 57 214
>
>                                 STYLE
>                                         SIZE 50
>                                         SYMBOL "line1"
>                                 END
>
>                         END
>
>
>
>
>         END
>
>
>
>
>         SCALEBAR
>                 COLOR -1 -1 -1
>                 SIZE 100 3
>                 STYLE 1
>
>                 STATUS ON
>                 IMAGECOLOR 255 255 255
>                 INTERVALS 4
>                 UNITS KILOMETERS
>
>         END
>         LEGEND
>                 IMAGECOLOR 255 255 255
>                 OUTLINECOLOR 0 0 0
>                 KEYSIZE 15 15
>                 STATUS ON
>                 LABEL
>                         TYPE BITMAP
>                         SIZE MEDIUM
>                         COLOR 0 0 89
>                 END
>
>                 #TEMPLATE "legenda.html"
>         END
>         WEB
>                 TEMPLATE "rosia.htm"
>                 IMAGEPATH "/ms4w/tmp/ms_tmp/"
>                 IMAGEURL "/ms_tmp/"
>
>
>         END
>
>
>
>
>
> END
>
> and this is my index.php file(template)
>
>
>
>
> <?php
>
>                  dl('php_mapscript_44.dll');
>
>
>
>                  $val_zsize=2;
>                  $check_pan="CHECKED";
>                  $map_path="/ms4w/rosia/";
>                  $map_file="rosia.map";
>
>                  $map = ms_newMapObj($map_path.$map_file);
>
>
>                  if ( isset($HTTP_POST_VARS["mapa_x"]) && isset
($HTTP_POST_VARS
> ["mapa_y"])
>                       && !isset($HTTP_POST_VARS["full"]) ) {
>
>                       $extent_to_set = explode(" ",$HTTP_POST_VARS["extent"]);
>
>                       $map->setextent($extent_to_set[0],$extent_to_set[1],
>                                       $extent_to_set[2],$extent_to_set[3]);
>
>                       $my_point = ms_newpointObj();
>                       $my_point->setXY($HTTP_POST_VARS
["mapa_x"],$HTTP_POST_VARS
> ["mapa_y"]);
>
>                       $my_extent = ms_newrectObj();
>
>                       $my_extent->setextent($extent_to_set[0],$extent_to_set
[1],
>                                               $extent_to_set[2],$extent_to_set
> [3]);
>
>                       $zoom_factor = $HTTP_POST_VARS["zoom"]*$HTTP_POST_VARS
> ["zsize"];
>                       if ($zoom_factor == 0) {
>                               $zoom_factor = 1;
>                               $check_pan = "CHECKED";
>                               $check_zout = "";
>                               $check_zin = "";
>                       } else if ($zoom_factor < 0) {
>                              $check_pan = "";
>                               $check_zout = "CHECKED";
>                               $check_zin = "";
>                       } else {
>                               $check_pan = "";
>                               $check_zout = "";
>                               $check_zin = "CHECKED";
>                       }
>
>                       $val_zsize = abs($zoom_factor);
>
>                       $map->zoompoint($zoom_factor,$my_point,$map->width,$map-
> >height,
>                                       $my_extent);
>
>                  }
>
>
>                  $image=$map->draw();
>                  $image_url=$image->saveWebImage();
>
>                  $extent_to_html = $map->extent->minx." ".$map->extent-
>miny." "
>                               .$map->extent->maxx." ".$map->extent->maxy;
> //scara
>                  $map->scalebar->set(intervals, 2);
>                  $map->scalebar->set(width, 200);
>                  $map->scalebar->set(style, 0);
>                  $map->scalebar->color->setRGB( 255,255,255 );
>                  $map->scalebar->backgroundcolor->setRGB(0, 94, 53);
>                  $map->scalebar->outlinecolor->setRGB(0, 94, 53);
>                  $imgscara=$map->drawScaleBar();
>                  $scara=$imgscara->saveWebImage();
> //referinta
>                  $map->reference->set
(image, "/ms4w/rosia/date/raster/dem.png");
>                  $map->reference->set(width,100);
>                  $map->reference->set(height,100);
>                  $map->reference->set(status, 1);
>                  $map->reference->outlinecolor->setRGB(0, 94, 53);
>                  $imgref=$map->drawreferencemap();
>                  $ref=$imgref->saveWebImage();
> //legenda
>
>                  $map->legend->set(width, 200);
>                  $map->legend->set(height, 200);
>                  $map->legend->imagecolor->setRGB(255, 255, 255);
>                  $map->legend->set(keysizex, 15);
>                  $map->legend->set(keysizey, 15);
>                  $map->legend->set(status, OFF);
>                  //$map->legend->set(template, "/ms4w/rosia/legenda.html");
>                  $imgleg=$map->drawLegend();
>                  $leg=$imgleg->saveWebImage();
>
>
>
>
>
>
>                  ?>
> <HTML>
>         <HEAD>
>                 <TITLE>Rosia Montana Environmental Mapserver</TITLE>
>
>
> <script type='text/javascript' src='js/x/x_core.js'></script>
> <script type='text/javascript' src='js/x/x_event.js'></script>
> <script type='text/javascript' src='js/x/x_drag.js'></script>
>
> <script type='text/javascript'>
>
> var highZ = 3;
>
> window.onload = function()
> {
>   d1Setup();
>
> }
>
> // Demo 1
>
> function d1Setup()
> {
>   var d1 = xGetElementById('d1');
>   xMoveTo(d1, 830, 0 );
>   xEnableDrag(d1, d1OnDragStart, d1OnDrag, d1OnDragEnd);
>   xShow(d1);
> }
> function d1OnDragStart(ele, mx, my)
> {
>   window.status = 'Dragging....';
>   xZIndex(ele, highZ++);
>   ele.totalMX = 0;
>   ele.totalMY = 0;
> }
> function d1OnDrag(ele, mdx, mdy)
> {
>   xMoveTo(ele, xLeft(ele) + mdx, xTop(ele) + mdy);
>   ele.totalMX += mdx;
>   ele.totalMY += mdy;
> }
> function d1OnDragEnd(ele, mx, my)
> {
>   window.status =
>     ele.id +
>     ':  Thanks for the drag!  Total X movement: ' + ele.totalMX +
>     ',  Total Y movement: ' + ele.totalMY;
> }
>
>
> </script>
> <style>
> ..demoBox {
>   position:relative;
>   overflow:hidden;
>   visibility:hidden;
>   width:400px;
>
>   margin:0;
>   padding:0;
>   font-size:x-small;
>   color:#000;
>   background-color: rgb(229, 254, 255);
>   cursor:default;
>   border:1px solid #596380;
>   z-index:3
> }
> ..demoBar {
>   overflow:hidden;
>   font-size:x-small;
>   height:1.2em;
>   margin:0;
>   padding:1px;
>   font-weight:bold;
>   color:#fff;
>   background:#596380;
>   cursor:default;
>   z-index:3
> }
> ..demoBtn {
>   position:absolute;
>   overflow:hidden;
>   font-size:x-small;
>   width:1.2em;
>   height:1.2em;
>   margin:0;
>   padding:0;
>   color:#000;
>   background:#596380;
>   cursor:default;
>   z-index:3
> }
> ..demoContent {
>   margin:10px;
>   z-index:3
>   font: 8pt bold;
>   font-family: sans-serif;
>   font-size: 8pt;
>   color: red;
>   height: 35px;
> }
>
>
> </style>
>
>
>
>
>
>
>
>
>
>
>
>
>
>                  </HEAD>
>                  <BODY style="background:rgb(229, 254, 255); ">
>
>
> <span style=" color: #596380 ; font:  normal 14pt verdana,sans-serif; border-
> color: #596380;border-bottom: 0px dashed;" > <center>Rosia Montana Gold
> Corporation Environmental Mapserver</center></span>
> <hr/>
>
> <FORM METHOD=POST ACTION="<?php echo $HTTP_SERVER_VARS['PHP_SELF']?>" >
>
> <div style="z-index: 5; position: absolute; top: 624px; left:14 px; border:
0px
> solid green">
>
> <INPUT TYPE=IMAGE NAME="scara" SRC="<?php echo $scara?>" style= >
>
> </div>
>
> <div style="z-index: 5; position: absolute; top: 518px; left: 612px; border-
> left: 1px solid green; border-top: 1px solid green;">
>
> <INPUT TYPE=IMAGE NAME="ref" SRC="<?php echo $ref ?>" style= >
>
> </div>
> <p><p>
>
> <div name="harta" style= " position: absolute; border: 3px solid black; z-
> index: 1" >
>
>                               <INPUT TYPE=IMAGE NAME="mapa" SRC="<?php echo
> $image_url?>" style= >
> </div>
>
>
> <div name="legenda" style= " position: absolute; top: 200px; left: 830;border:
> 1px solid black; z-index: 2" >
>
>                 <img src="[legend]" />
>
> </div>
>
>
>
> <div id='d1' class='demoBox'>
>   <div class='demoBar'><center>Map Tools</center></div>
>   <div class='demoContent'>
>     <table>
>                                 <tr>
>                                         <td>
>                               <INPUT TYPE=RADIO NAME="zoom" VALUE=0 <?php echo
> $check_pan?>>
>                                         </td>
>                                         <td>
>                                                 <img
src="imagini/tool_pan.gif"
> height=20 alt="Click the radio button to pan" >
>                                         </td>
>
>                                         <td>
>
>                                         <td>
>                               <INPUT TYPE=RADIO NAME="zoom" VALUE=1 <?php echo
> $check_zin?>>
>                                         </td>
>                                         <td>
>                                                 <img
> src="imagini/tool_zoomin_off.gif" height=20 >
>
>                                         </td>
>
>                                         <td>
>
>                               <INPUT TYPE=RADIO NAME="zoom" VALUE=-1 <?php
echo
> $check_zout?>>
>                                         </td>
>
>                                         <td>
>
>                                                 <img
> src="imagini/tool_zoomout_off.gif" height=20 >
>                                         </td>
> <td>
>                               <font face="verdana" color="red" size=-2 >Zoom
> Size </font>
>
>
>                               <INPUT TYPE=TEXT NAME="zsize" VALUE="<?php echo
> $val_zsize?>"
>                               SIZE=2>
>
>                                 </td>
>
>
>                                 <td>
>
>                               <img src="imagini/tool_zoomfull.gif" height=20 >
>                                 </td>
>                                 <td>
>                              <INPUT TYPE=SUBMIT NAME="full" VALUE="Zoom full"
> SIZE=2 style=" color:#fff; background:#596380;">
>                                 </td>
>
>
>                  <INPUT TYPE=HIDDEN NAME="extent" VALUE="<?php echo
> $extent_to_html?>">
>
> </tr>
> </table>
> Check the radio buttons for navigation...
> </div>
>
>
>
>
>
>
> </FORM>
>
>
>                  </BODY>
>                  </HMTL>
>
>
>
> Normally i should see a graphic legend.....isn't it?
> Thanks in advance
> Iano Ferencik
>
>
> _____________________________________________
> Cinefil?Castiga o excursie la Venetia
> http://www.cineplus.ro/concurs
>




_____________________________________________
Cinefil?Castiga o excursie la Venetia
http://www.cineplus.ro/concurs



More information about the MapServer-users mailing list