[Mapserver-users] extrange problem with colors and size in createLegendIcon

Guillermo Felipe gfmb at tutopia.com
Tue May 18 07:35:49 EDT 2004


Hello Everybody,

I got the same legend Icon for two different line layers with different colors 
but with the SAME symbol and size, for example:

LAYER 1 with COLOR 0 0 255,  SYMBOL "circ" and SIZE 2 gives me an icon with 
color 0 0 255

LAYER 2 with COLOR 255 0 0,  SYMBOL "circ" and SIZE 2 gives me an icon with 
color 0 0 255  too!!!!

(With different size betwen layers the colors are OK)

I've been tried with different options, but I didn't find which can be the 
source of the problem.

Is it a bug o am I doing something wrong?

I simplified my code to show the problem, please try to reproduce and tell me:

<pre>
<?php
$map = ms_newMapObj("map.map");
$img = $map->draw();
$url = $img->saveWebImage(MS_PNG, 1, 1, 0);

$layer1=$map->getlayerbyname("1");
$layer2=$map->getlayerbyname("2");

$class1=$layer1->getclass(0);
$class2=$layer2->getclass(0);

$img1 = $class1->createLegendIcon($map->keysizex, $map->keysizey);
$img2 = $class2->createLegendIcon($map->keysizex, $map->keysizey);

$img1->saveImage("ima1.png", MS_PNG, 0, 0, 0);
$img2->saveImage("ima2.png", MS_PNG, 0, 0, 0);

print("Image 1: <img src=ima1.png>\n");
print("Image 2: <img src=ima2.png>\n")

?>
</pre>

map.map file:

MAP
  SYMBOLSET "sim.sim"
  EXTENT 924865 943176 947242 965553
  IMAGECOLOR 255 255 255
  IMAGETYPE png
  SIZE 360 360
  STATUS ON
  UNITS METERS
  NAME "test"

LEGEND
  KEYSIZE 18 12
END


LAYER
 NAME "1"
 TYPE line
 DATA line1 #please put any line shape
 CLASS
  COLOR 0 0 255 #blue
  SYMBOL "circ"
  SIZE 2
 END
END

LAYER
 NAME "2"
 TYPE line
 DATA line1
 CLASS
  COLOR 255 0 0 #red
  SYMBOL "circ"
  SIZE 2
 END
END

END

sim.sim file:

SYMBOL
 NAME "circ"
 TYPE ellipse
 POINTS 1 1 END
 FILLED TRUE
END

Thank you,

Guillermo Felipe
Bogotá. Colombia






More information about the mapserver-users mailing list