[Mapserver-users] Troubles w/ Dynamic Symbols in PHP/Mapscript

Dan Barron dbarron at ddive.com
Wed Aug 13 18:27:47 PDT 2003


--=====================_12641328==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Hello,

I'm trying to change a symbol for a point layer dynamically within 
PHP/Mapscript v4.0 on W2K.  After searching the mail archive and trying a 
few variations of what seemed correct, I'm not having much luck.  I've 
included a simplified look into the pertinent pieces of my map file, symbol 
file, and php/mapscript code.  Anyone have any experience with this and 
willing to provide some insight as to what I am doing wrong?

Thanks!

Dan



 >>>Map File<<<

symbolset "./symbols/symbols.list"

...

LAYER
   name 'mylayer'
   type POINT
   class
     name 'symbol'
     style
       symbol 'symbol_1'
     end
   end
END


 >>>symbols.list<<<

SYMBOL
   name'symbol_1'
   type PIXMAP
   image '..\graphics\symbol_1.gif'
END

SYMBOL
   name'symbol_2'
   type PIXMAP
   image '..\graphics\symbol_2.gif'
END

 >>>PHP Mapscript<<<

$layer = $map->getLayerByName('myLayer');
$symbolClass = $layer->getClass(0);
$symbolStyle = $symbolClass->getStyle(0);
$symbolStyle->set('symbolname', 'symbol_2');

..also tried...

$layer = $map->getLayerByName('myLayer');
$symbolClass = $layer->getClass(0);
$symbolStyle = $symbolClass->getStyle(0);
$symbolStyle->set('symbol', 'symbol_2');

..and this...

$layer = $map->getLayerByName('myLayer');
$symbolClass = $layer->getClass(0);
$symbolStyle = $symbolClass->getStyle(0);
$symbolStyle->set('symbol', 1);

...and this...

$map->setSymbolSet('symbols.list');
$layer = $map->getLayerByName('myLayer');
$symbolClass = $layer->getClass(0);
$symbolStyle = $symbolClass->getStyle(0);
$symbolStyle->set('symbol', 1);

--=====================_12641328==.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<body>
Hello,<br><br>
I'm trying to change a symbol for a point layer dynamically within
PHP/Mapscript v4.0 on W2K.  After searching the mail archive and
trying a few variations of what seemed correct, I'm not having much
luck.  I've included a simplified look into the pertinent pieces of
my map file, symbol file, and php/mapscript code.  Anyone have any
experience with this and willing to provide some insight as to what I am
doing wrong?<br><br>
Thanks!<br><br>
Dan<br><br>
<br><br>
<tt>>>>Map File<<<<br><br>
symbolset "./symbols/symbols.list"<br><br>
...<br><br>
LAYER<br>
  name 'mylayer'<br>
  type POINT<br>
  class<br>
    name 'symbol'<br>
    style<br>
      symbol 'symbol_1'<br>
    end<br>
  end<br>
END<br><br>
<br>
>>>symbols.list<<<<br><br>
SYMBOL<br>
  name'symbol_1'<br>
  type PIXMAP<br>
  image '..\graphics\symbol_1.gif'<br>
END<br><br>
SYMBOL<br>
  name'symbol_2'<br>
  type PIXMAP<br>
  image '..\graphics\symbol_2.gif'<br>
END<br><br>
>>>PHP Mapscript<<<<br><br>
$layer = $map->getLayerByName('myLayer');<br>
$symbolClass = $layer->getClass(0);<br>
$symbolStyle = $symbolClass->getStyle(0);<br>
$symbolStyle->set('symbolname', 'symbol_2');<br><br>
..also tried...<br><br>
$layer = $map->getLayerByName('myLayer');<br>
$symbolClass = $layer->getClass(0);<br>
$symbolStyle = $symbolClass->getStyle(0);<br>
$symbolStyle->set('symbol', 'symbol_2');<br><br>
..and this...<br><br>
$layer = $map->getLayerByName('myLayer');<br>
$symbolClass = $layer->getClass(0);<br>
$symbolStyle = $symbolClass->getStyle(0);<br>
$symbolStyle->set('symbol', 1);<br><br>
...and this...<br><br>
$map->setSymbolSet('symbols.list');<br>
$layer = $map->getLayerByName('myLayer');<br>
$symbolClass = $layer->getClass(0);<br>
$symbolStyle = $symbolClass->getStyle(0);<br>
$symbolStyle->set('symbol', 1);<br>
</body>
</html>

--=====================_12641328==.ALT--




More information about the MapServer-users mailing list