[mapserver-users] Question about python mapscript and point style.

Seth G sethg at geographika.co.uk
Fri Nov 22 12:34:48 PST 2019


Hi Vladimir,

Could you try the following syntax?

new_style = new mapscript.styleObj()
new_style.symbolname = 'circle'
new_style.size = 10
the_class.insertStyle(new_style)


Also make sure your variables aren't overriding the class names - e.g. maybe use different variable names than classObj. 

Regards,

Seth

--
web:http://geographika.co.uk
twitter: @geographika


On Fri, Nov 15, 2019, at 6:12 PM, Vladimir wrote:
> Hi all!
> 
> I unsuccessfully try to style ‘Point’ layer with following code:
> (first)
>  style = mapscript.styleObj(classObj)
>  style.symbolname = 'circle'
>  style.size = 10
>  style.color = mapscript.colorObj(255, 0, 0)
> 
> No error, no picture as result of using this method.
> But similar approach works for ‘Line’ and ‘Polygon’ layers.
> 
> Also I figured out working method for the ‘Point’ layer:
> (second)
> classObj.updateFromString("CLASS STYLE COLOR 255 0 0 SIZE 10 SYMBOL 'circle' END END")
> 
> Output of ‘layer.convertToString()’ is the same for both methods:
> LAYER
>  CONNECTION \"dbname='db' host='db' user='user' password='1'\"
>  CONNECTIONTYPE POSTGIS 
>  DATA \"value FROM (SELECT value FROM points WHERE ST_Intersects(value, !BOX!)) AS subquery USING UNIQUE id USING srid = 3857\"
>  LABELITEM \"name\"
>  NAME \"points\"
>  STATUS ON
>  TYPE POINT
>  UNITS METERS
>  CLASS
>  NAME \"points\"
>  STYLE 
>  COLOR 255 0 0
>  SIZE 10 
>  SYMBOL \"circle\"
>  END # STYLE
>  END # CLASS
>  END # LAYER
> 
> How to get working ‘Point’ style using first method?
> MapServer version: 7.2.1
> 
> Thanks!
> 

> --
>  Regards, Vladimir.
> 

> 

> _______________________________________________
> 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/20191122/02750b12/attachment.htm>


More information about the MapServer-users mailing list