Skip to content

Commit 6853c21

Browse files
committed
Update rundemo.py [WIP] [skip ci]
1 parent 8ac6c1e commit 6853c21

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

demo/python/rundemo.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# -*- coding: utf-8 -*-
33
#
44
#
5-
#
65
# This file is part of Mapnik (c++ mapping toolkit)
76
# Copyright (C) 2005 Jean-Francois Doyon
8-
#
7+
# Copyright (C) 2024 Artem Pavlenko
8+
99
# Mapnik is free software; you can redistribute it and/or
1010
# modify it under the terms of the GNU General Public License
1111
# as published by the Free Software Foundation; either version 2
@@ -92,14 +92,14 @@
9292

9393
sym = mapnik.PolygonSymbolizer()
9494
sym.fill = mapnik.Color(250, 190, 183);
95-
provpoly_rule_on.symbols.append(sym)
95+
provpoly_rule_on.symbolizers.append(sym)
9696
provpoly_style.rules.append(provpoly_rule_on)
9797

9898
provpoly_rule_qc = mapnik.Rule()
9999
provpoly_rule_qc.filter = mapnik.Expression("[NOM_FR] = 'Québec'")
100100
sym = mapnik.PolygonSymbolizer()
101101
sym.fill = 'rgb(217, 235, 203)'
102-
provpoly_rule_qc.symbols.append(sym)
102+
provpoly_rule_qc.symbolizers.append(sym)
103103
provpoly_style.rules.append(provpoly_rule_qc)
104104

105105
# Add the style to the map, giving it a name. This is the name that will be
@@ -132,7 +132,7 @@
132132
sym = mapnik.PolygonSymbolizer()
133133
sym.fill = 'rgba(153, 204, 255, 255)'
134134
sym.smooth = 1.0 # very smooth
135-
qcdrain_rule.symbols.append(sym)
135+
qcdrain_rule.symbolizers.append(sym)
136136
qcdrain_style.rules.append(qcdrain_rule)
137137

138138
m.append_style('drainage', qcdrain_style)
@@ -166,7 +166,7 @@
166166
sym.stroke = 'black'
167167
sym.stroke_width = 1
168168
sym.stroke_dasharray="8 4 2 2 2 2"
169-
provlines_rule.symbols.append(sym)
169+
provlines_rule.symbolizers.append(sym)
170170
provlines_style.rules.append(provlines_rule)
171171

172172
m.append_style('provlines', provlines_style)
@@ -200,7 +200,7 @@
200200
sym.stroke_width = 2
201201
sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP
202202

203-
roads34_rule.symbols.append(sym)
203+
roads34_rule.symbolizers.append(sym)
204204
roads34_style.rules.append(roads34_rule)
205205

206206
m.append_style('smallroads', roads34_style)
@@ -222,7 +222,7 @@
222222
sym.stroke = 'rgb(171,158,137)' #mapnik.Color(R=171,G=158,B=137,A=255)
223223
sym.stroke_width = 4
224224
sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP
225-
roads2_rule_1.symbols.append(sym)
225+
roads2_rule_1.symbolizers.append(sym)
226226
roads2_style_1.rules.append(roads2_rule_1)
227227

228228
m.append_style('road-border', roads2_style_1)
@@ -234,7 +234,7 @@
234234
sym.stroke = 'rgb(100%,98%,45%)' #mapnik.Color(R=255,G=250,B=115,A=255)
235235
sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP
236236
sym.stroke_width = 2
237-
roads2_rule_2.symbols.append(sym)
237+
roads2_rule_2.symbolizers.append(sym)
238238
roads2_style_2.rules.append(roads2_rule_2)
239239

240240
m.append_style('road-fill', roads2_style_2)
@@ -257,7 +257,7 @@
257257
sym.stroke = mapnik.Color(188,149,28)
258258
sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP
259259
sym.stroke_width = 7
260-
roads1_rule_1.symbols.append(sym)
260+
roads1_rule_1.symbolizers.append(sym)
261261
roads1_style_1.rules.append(roads1_rule_1)
262262
m.append_style('highway-border', roads1_style_1)
263263

@@ -267,7 +267,7 @@
267267
sym.stroke = mapnik.Color(242,191,36)
268268
sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP
269269
sym.stroke_width = 5
270-
roads1_rule_2.symbols.append(sym)
270+
roads1_rule_2.symbolizers.append(sym)
271271
roads1_style_2.rules.append(roads1_rule_2)
272272

273273
m.append_style('highway-fill', roads1_style_2)
@@ -291,7 +291,7 @@
291291
# text to label with. Then there is font size in points (I think?), and colour.
292292

293293
# TODO - currently broken: https://github.com/mapnik/mapnik/issues/2324
294-
popplaces_text_sym = mapnik.TextSymbolizer() #mapnik.Expression("[GEONAME]"),
294+
#popplaces_text_sym = mapnik.TextSymbolizer() #mapnik.Expression("[GEONAME]"),
295295

296296
#finder = mapnik.PlacementFinder()
297297
#finder.face_name = 'DejaVu Sans Book'
@@ -301,13 +301,13 @@
301301
#finder.fill = mapnik.Color("black")
302302
#finder.format_expression = "[GEONAME]"
303303

304-
popplaces_text_sym.placement_finder = mapnik.PlacementFinder()
305-
popplaces_text_sym.placement_finder.face_name = 'DejaVu Sans Book'
306-
popplaces_text_sym.placement_finder.text_size = 10
307-
popplaces_text_sym.placement_finder.halo_fill = 'rgba(100%,100%,78.5%,1.0)' #mapnik.Color(R=255,G=255,B=200,A=255)
308-
popplaces_text_sym.placement_finder.halo_radius = 1.0
309-
popplaces_text_sym.placement_finder.fill = "black"
310-
popplaces_text_sym.placement_finder.format_expression = "[GEONAME]"
304+
# popplaces_text_sym.placement_finder = mapnik.PlacementFinder()
305+
# popplaces_text_sym.placement_finder.face_name = 'DejaVu Sans Book'
306+
# popplaces_text_sym.placement_finder.text_size = 10
307+
# popplaces_text_sym.placement_finder.halo_fill = 'rgba(100%,100%,78.5%,1.0)' #mapnik.Color(R=255,G=255,B=200,A=255)
308+
# popplaces_text_sym.placement_finder.halo_radius = 1.0
309+
# popplaces_text_sym.placement_finder.fill = "black"
310+
# popplaces_text_sym.placement_finder.format_expression = "[GEONAME]"
311311

312312

313313
# We set a "halo" around the text, which looks like an outline if thin enough,
@@ -318,7 +318,8 @@
318318
#popplaces_text_sym.avoid_edges = True
319319
#popplaces_text_sym.minimum_padding = 30
320320

321-
popplaces_rule.symbols.append(popplaces_text_sym)
321+
#popplaces_rule.symbolizers.append(popplaces_text_sym)
322+
322323
popplaces_style.rules.append(popplaces_rule)
323324

324325
m.append_style('popplaces', popplaces_style)

0 commit comments

Comments
 (0)