Re: Question about python mapscript and p oint style.
"Seth G" <[email protected]> Fri, 22 Nov 2019 21:34:48 +0100
| Newsgroups | gmane.comp.gis.mapserver.user |
|---|---|
| Message-ID | <[email protected]> |
--===============0185960446418370401==
Content-Type: multipart/alternative;
boundary=257152c2fc974dd196a9a7cb7c60c3fc
--257152c2fc974dd196a9a7cb7c60c3fc
Content-Type: text/plain;charset=utf-8
Content-Transfer-Encoding: quoted-printable
Hi Vladimir,
Could you try the following syntax?
new_style =3D new mapscript.styleObj()
new_style.symbolname =3D 'circle'
new_style.size =3D 10
the_class.insertStyle(new_style)
Also make sure your variables aren't overriding the class names - e.g. m=
aybe use different variable names than classObj.=20
Regards,
Seth
--
web:http://geographika.co.uk
twitter: @geographika
On Fri, Nov 15, 2019, at 6:12 PM, Vladimir wrote:
> Hi all!
>=20
> I unsuccessfully try to style =E2=80=98Point=E2=80=99 layer with follo=
wing code:
> (first)
> style =3D mapscript.styleObj(classObj)
> style.symbolname =3D 'circle'
> style.size =3D 10
> style.color =3D mapscript.colorObj(255, 0, 0)
>=20
> No error, no picture as result of using this method.
> But similar approach works for =E2=80=98Line=E2=80=99 and =E2=80=98Pol=
ygon=E2=80=99 layers.
>=20
> Also I figured out working method for the =E2=80=98Point=E2=80=99 laye=
r:
> (second)
> classObj.updateFromString("CLASS STYLE COLOR 255 0 0 SIZE 10 SYMBOL 'c=
ircle' END END")
>=20
> Output of =E2=80=98layer.convertToString()=E2=80=99 is the same for bo=
th methods:
> LAYER
> CONNECTION \"dbname=3D'db' host=3D'db' user=3D'user' password=3D'1'\"=
> CONNECTIONTYPE POSTGIS=20
> DATA \"value FROM (SELECT value FROM points WHERE ST_Intersects(value=
, !BOX!)) AS subquery USING UNIQUE id USING srid =3D 3857\"
> LABELITEM \"name\"
> NAME \"points\"
> STATUS ON
> TYPE POINT
> UNITS METERS
> CLASS
> NAME \"points\"
> STYLE=20
> COLOR 255 0 0
> SIZE 10=20
> SYMBOL \"circle\"
> END # STYLE
> END # CLASS
> END # LAYER
>=20
> How to get working =E2=80=98Point=E2=80=99 style using first method?
> MapServer version: 7.2.1
>=20
> Thanks!
>=20
> --
> Regards, Vladimir.
>=20
>=20
> _______________________________________________
> mapserver-users mailing list
> [email protected]
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
--257152c2fc974dd196a9a7cb7c60c3fc
Content-Type: text/html;charset=utf-8
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE html><html><head><title></title><style type=3D"text/css">p.Mso=
Normal,p.MsoNoSpacing{margin:0}</style></head><body><div>Hi Vladimir,<br=
></div><div><br></div><div>Could you try the following syntax?<br></div>=
<div><br></div><pre><span class=3D"n">new_style</span> <span class=3D"o"=
>=3D</span> <span class=3D"n">new</span> <span class=3D"n">mapscript.sty=
leObj</span><span class=3D"p">()
</span><span class=3D"n">new_style</span>.symbolname =3D 'circle'
<span class=3D"p"></span><span class=3D"n">new_style</span>.size =3D 10
<span class=3D"n">the_class</span><span class=3D"o">.</span><span class=3D=
"n">insertStyle</span><span class=3D"p">(</span><span class=3D"n">new_st=
yle</span><span class=3D"p">)
</span><br></pre><div>Also make sure your variables aren't overriding th=
e class names - e.g. maybe use different variable names than classObj. <=
br></div><div><br></div><div>Regards,<br></div><div><br></div><div>Seth<=
br></div><div><br></div><div id=3D"sig62266145"><div class=3D"signature"=
>--<br></div><div class=3D"signature">web:http://geographika.co.uk<br></=
div><div class=3D"signature">twitter: @geographika<br></div></div><div><=
br></div><div><br></div><div>On Fri, Nov 15, 2019, at 6:12 PM, Vladimir =
wrote:<br></div><blockquote type=3D"cite" id=3D"qt"><div><div>Hi all!<br=
></div><div> <br></div><div>I unsuccessfully try to style =E2=80=98=
Point=E2=80=99 layer with following code:<br></div><div>(first)<br></div=
><div><div> style =3D mapscript.styleObj(classObj)<br></div=
><div> style.symbolname =3D 'circle'<br></div><div> =
style.size =3D 10<br></div><div> style.color =3D m=
apscript.colorObj(255, 0, 0)<br></div></div><div> <br></div><div>No=
error, no picture as result of using this method.<br></div><div>But sim=
ilar approach works for =E2=80=98Line=E2=80=99 and =E2=80=98Polygon=E2=80=
=99 layers.<br></div><div> <br></div><div><div>Also I figured out w=
orking method for the =E2=80=98Point=E2=80=99 layer:<br></div><div>(seco=
nd)<br></div><div style=3D"background-color:rgb(255, 255, 255);color:rgb=
(0, 0, 0);font-family:"Droid Sans Mono", "monospace"=
, monospace, "Droid Sans Fallback";font-size:14px;font-weight:=
normal;line-height:19px;white-space:pre;"><div>classObj.updateFromString=
("CLASS STYLE COLOR 255 0 0 SIZE 10 SYMBOL 'circle' END END")<br><=
/div></div><div> <br></div><div>O<span style=3D"color:rgb(0, 0, 0)"=
class=3D"colour">utput of =E2=80=98layer.convertToString()=E2=80=99 is =
the same </span>for both methods<span style=3D"color:rgb(0, 0, 0)" class=
=3D"colour">:</span><br></div></div><div><div style=3D"background-color:=
rgb(255, 255, 255);color:rgb(0, 0, 0);font-family:"Droid Sans Mono&=
quot;, "monospace", monospace, "Droid Sans Fallback"=
;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"><d=
iv><div>LAYER<br></div><div> CONNECTION \"dbname=3D'd=
b' host=3D'db' user=3D'user' password=3D'1'\"<br></div><div>  =
; CONNECTIONTYPE POSTGIS <br></div><div> =
DATA \"value FROM (SELECT value FROM points WHERE ST_Intersects(value, !=
BOX!)) AS subquery USING UNIQUE id USING srid =3D 3857\"<br></div><div> =
LABELITEM \"name\"<br></div><div> =
NAME \"points\"<br></div><div> STATUS ON<br></div><di=
v> TYPE POINT<br></div><div> UNITS=
METERS<br></div><div> CLASS<br></div><div> &nb=
sp; NAME \"points\"<br></div><div> &=
nbsp; STYLE <br></=
div><div> &n=
bsp; COLOR 255 0 0<br></div><div> &n=
bsp; SIZE 10 <br></div><=
div> =
SYMBOL \"circle\"<br></div><div> &nb=
sp; END # STYLE<br></div><div> END # CLASS<br></div><=
div> END # LAYER<br></div></div><div> <br></div><div>How to get wor=
king =E2=80=98Point=E2=80=99 style using first method?<br></div><div>Map=
Server version: 7.2.1<br></div><div> <br></div><div>Thanks!<br></di=
v></div></div><div><div><p><br></p><div>--<br></div><div> Regards, Vladi=
mir.<br></div><p><br></p><p> <br></p></div></div></div><div>_______=
________________________________________<br></div><div>mapserver-users m=
ailing list<br></div><div>[email protected]<br></div><div>=
https://lists.osgeo.org/mailman/listinfo/mapserver-users<br></div></bloc=
kquote><div><br></div></body></html>
--257152c2fc974dd196a9a7cb7c60c3fc--
--===============0185960446418370401==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KbWFwc2VydmVy
LXVzZXJzIG1haWxpbmcgbGlzdAptYXBzZXJ2ZXItdXNlcnNAbGlzdHMub3NnZW8ub3JnCmh0dHBz
Oi8vbGlzdHMub3NnZW8ub3JnL21haWxtYW4vbGlzdGluZm8vbWFwc2VydmVyLXVzZXJz
--===============0185960446418370401==--