MapScript SetSymbolSet

Christopher Condit condit at SDSC.EDU
Thu Feb 16 13:47:32 PST 2006


But then I'll have an extra file lying around.

The original problem was that I wanted to use the same symbol set for
every user session.  I don't know why that failed.  But now I've got it
working - I hacked mapserver so that symbols always gets inMapFile set
TRUE.  This solves my problem for now.  I guess I should add a check to
see if symbolsetname is null.  If not, then write to mapfile, otherwise
write to symbolfile.  Or I guess you should be able to have both!
Symbols in the mapfile and external symbols...

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at lists.umn.edu] On
Behalf Of Tamas Szekeres
Sent: Thursday, February 16, 2006 1:36 PM
To: MAPSERVER-USERS at lists.umn.edu
Subject: Re: [UMN_MAPSERVER-USERS] MapScript SetSymbolSet

You should save the symbolset before saving the map

see

http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1670

for more details

Tamas


On Wed, 15 Feb 2006 16:45:57 -0800, Christopher Condit <condit at SDSC.EDU>
wrote:

>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