MapScript SetSymbolSet

Christopher Condit condit at SDSC.EDU
Wed Feb 15 19:45:57 EST 2006


Argh - the map instance keeps this and works fine, but refuses to write
it out to the map file:

symbolObj circle = new symbolObj("circle", null);
circle.type = (int)MS_SYMBOL_TYPE.MS_SYMBOL_ELLIPSE;
circle.filled = mapscript.MS_TRUE;
lineObj line = new lineObj();
line.add(new pointObj(1, 1, 0, 0));
circle.sizex = 1;
circle.sizey = 1;				
map.symbolset.appendSymbol(circle);

later I use:

sty.symbol = map.symbolset.index("circle");	

which works fine - sets the index properly.  No symbols get written to
the mapfile, however.  Is there something special I need to do to get
the symbols to write out?

Thanks,

Chris

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Sean Gillies
Sent: Wednesday, February 15, 2006 4:16 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] MapScript SetSymbolSet

Oh, I see. Yeah, it's possible. Here's an example from one of my  
Python projects:

     circle = mapscript.symbolObj('circle')
     circle.type = mapscript.MS_SYMBOL_ELLIPSE
     circle.filled = mapscript.MS_TRUE
     line = mapscript.lineObj()
     line.add(mapscript.pointObj(1,1))
     circle.setPoints(line)
     circle.sizex = 1
     circle.sizey = 1
     mo.symbolset.appendSymbol(circle)

The "mo" name is bound to a mapObj. It's very important to get sizex  
and sizey right, should be the width and height of the symbol in the  
same units as the point and line coordinates used to construct the  
symbol.

To use this symbol

     style.symbol = mo.symbolset.index('circle')

Translate this into C# and you should be good to go.

cheers,
Sean

On Feb 15, 2006, at 5:03 PM, Christopher Condit wrote:

> Hi Sean-
> Is there a way to accomplish this with MapScript?  All I see is a  
> way to
> set the symbolset.
>
> Thanks,
>
> Chris
>
> -----Original Message-----
> From: UMN MapServer Users List [mailto:MAPSERVER- 
> USERS at LISTS.UMN.EDU] On
> Behalf Of Sean Gillies
> Sent: Wednesday, February 15, 2006 3:58 PM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-USERS] MapScript SetSymbolSet
>
> On Feb 15, 2006, at 3:19 PM, Christopher Condit wrote:
>
>> Hi Julien-
>> Thanks for your response.  Here are the contents of the symbol file:
>> SYMBOLSET
>>   SYMBOL
>>     NAME 'circle'
>>     TYPE ELLIPSE
>>     POINTS 1 1 END
>>     FILLED TRUE
>>   END
>> END
>>
>> The problem I'm having is intermittent and I can't reliably reproduce
>> it.  My only thought was that for some reason mapscript couldn't read
>> the file.  Is there any way to embed these symbols directly in the
>> mapfile instead of referencing the symbolset file?
>>
>> Thanks,
>>
>> Chris
>
> Yes, just add any SYMBOL block as a child of the top-level map.
>
> Sean
>

---
Sean Gillies
sgillies at frii dot com
http://zcologia.com/news



More information about the mapserver-users mailing list