[MapServer-users] setting COLOR of SVG symbol ?

karsten karsten at terragis.net
Thu Mar 28 13:59:45 PDT 2024


Thanks,
looks like it.
 
In QGIS setting color and opacity plus stroke does only work if the *.svg is
edited to allow by setting variables such as these below:
style="fill:param(fill) #000000;fill-opacity:1;stroke:param(outline)
#000000;stroke-width:param(stroke-width) 1;fill-opacity:param(fill-opacity)
1;stroke-opacity:param(outline-opacity) "
 
I guess a simple approach could be to allow setting colors for svgs in
MapServer if the svg has the style color set to
fill="currentColor" 
in order to be styled 

For now seems that MapServer vector symbols seem to be the way to go 
 
Cheers
Karsten 
  _____  

From: Seth G [mailto:sethg at geographika.co.uk] 
Sent: Thursday, March 28, 2024 00:06
To: karsten; MapServer Users
Subject: Re: [MapServer-users] setting COLOR of SVG symbol ?


Hi,


Unfortunately, I don't think this is currently possible, based on a previous
reply from Steve Lime [1]:


> I don't believe you can muck with the SVG color since SVG can carry
multiple elements and colors. That complexity doesn't map very well to a
single color value in a styleObj. It's probably best to consider SVG as
immutable, same as an image symbol. You can use truetype fonts (or vector
symbols) if you want something scaleable where you can alter color.

I guess if it works in QGIS then it should be possible to implement this in
the MapServer codebase too. 


Seth


[1] https://lists.osgeo.org/pipermail/mapserver-users/2019-June/081218.html


--

web:https://geographika.net & https://mapserverstudio.net

twitter: @geographika


On Wed, Mar 27, 2024, at 10:45 PM, karsten via MapServer-users wrote:


Hi All,


 
for the first time trying to use svg symbols for a layer. The svgs I am
using can be styled in QGIS (have edited to allow). 
What is the status in MapServer should setting  the color via a style work ?


I had no luck setting the COLOR on the symbol so far

Here is my style

 
     STYLE
       SYMBOL "electric_point"
       SIZE 20
       COLOR 255 0 0
     END # STYLE 

 
symbol


 
SYMBOL
    NAME 'electric_point'
    TYPE svg
    image 'symbols/annotation/electric.svg'
END

 
So far this renders black symbols , any ideas how to fix this ?


 
Cheers

Karsten


 
Karsten Vennemann
 <http://www.terragis.net> www.terragis.net

 
_______________________________________________

MapServer-users mailing list

MapServer-users at lists.osgeo.org

https://lists.osgeo.org/mailman/listinfo/mapserver-users




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20240328/908f788c/attachment.htm>


More information about the MapServer-users mailing list