|
2 | 2 | # -*- coding: utf-8 -*- |
3 | 3 | # |
4 | 4 | # |
5 | | -# |
6 | 5 | # This file is part of Mapnik (c++ mapping toolkit) |
7 | 6 | # Copyright (C) 2005 Jean-Francois Doyon |
8 | | -# |
| 7 | +# Copyright (C) 2024 Artem Pavlenko |
| 8 | + |
9 | 9 | # Mapnik is free software; you can redistribute it and/or |
10 | 10 | # modify it under the terms of the GNU General Public License |
11 | 11 | # as published by the Free Software Foundation; either version 2 |
|
92 | 92 |
|
93 | 93 | sym = mapnik.PolygonSymbolizer() |
94 | 94 | sym.fill = mapnik.Color(250, 190, 183); |
95 | | -provpoly_rule_on.symbols.append(sym) |
| 95 | +provpoly_rule_on.symbolizers.append(sym) |
96 | 96 | provpoly_style.rules.append(provpoly_rule_on) |
97 | 97 |
|
98 | 98 | provpoly_rule_qc = mapnik.Rule() |
99 | 99 | provpoly_rule_qc.filter = mapnik.Expression("[NOM_FR] = 'Québec'") |
100 | 100 | sym = mapnik.PolygonSymbolizer() |
101 | 101 | sym.fill = 'rgb(217, 235, 203)' |
102 | | -provpoly_rule_qc.symbols.append(sym) |
| 102 | +provpoly_rule_qc.symbolizers.append(sym) |
103 | 103 | provpoly_style.rules.append(provpoly_rule_qc) |
104 | 104 |
|
105 | 105 | # Add the style to the map, giving it a name. This is the name that will be |
|
132 | 132 | sym = mapnik.PolygonSymbolizer() |
133 | 133 | sym.fill = 'rgba(153, 204, 255, 255)' |
134 | 134 | sym.smooth = 1.0 # very smooth |
135 | | -qcdrain_rule.symbols.append(sym) |
| 135 | +qcdrain_rule.symbolizers.append(sym) |
136 | 136 | qcdrain_style.rules.append(qcdrain_rule) |
137 | 137 |
|
138 | 138 | m.append_style('drainage', qcdrain_style) |
|
166 | 166 | sym.stroke = 'black' |
167 | 167 | sym.stroke_width = 1 |
168 | 168 | sym.stroke_dasharray="8 4 2 2 2 2" |
169 | | -provlines_rule.symbols.append(sym) |
| 169 | +provlines_rule.symbolizers.append(sym) |
170 | 170 | provlines_style.rules.append(provlines_rule) |
171 | 171 |
|
172 | 172 | m.append_style('provlines', provlines_style) |
|
200 | 200 | sym.stroke_width = 2 |
201 | 201 | sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP |
202 | 202 |
|
203 | | -roads34_rule.symbols.append(sym) |
| 203 | +roads34_rule.symbolizers.append(sym) |
204 | 204 | roads34_style.rules.append(roads34_rule) |
205 | 205 |
|
206 | 206 | m.append_style('smallroads', roads34_style) |
|
222 | 222 | sym.stroke = 'rgb(171,158,137)' #mapnik.Color(R=171,G=158,B=137,A=255) |
223 | 223 | sym.stroke_width = 4 |
224 | 224 | sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP |
225 | | -roads2_rule_1.symbols.append(sym) |
| 225 | +roads2_rule_1.symbolizers.append(sym) |
226 | 226 | roads2_style_1.rules.append(roads2_rule_1) |
227 | 227 |
|
228 | 228 | m.append_style('road-border', roads2_style_1) |
|
234 | 234 | sym.stroke = 'rgb(100%,98%,45%)' #mapnik.Color(R=255,G=250,B=115,A=255) |
235 | 235 | sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP |
236 | 236 | sym.stroke_width = 2 |
237 | | -roads2_rule_2.symbols.append(sym) |
| 237 | +roads2_rule_2.symbolizers.append(sym) |
238 | 238 | roads2_style_2.rules.append(roads2_rule_2) |
239 | 239 |
|
240 | 240 | m.append_style('road-fill', roads2_style_2) |
|
257 | 257 | sym.stroke = mapnik.Color(188,149,28) |
258 | 258 | sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP |
259 | 259 | sym.stroke_width = 7 |
260 | | -roads1_rule_1.symbols.append(sym) |
| 260 | +roads1_rule_1.symbolizers.append(sym) |
261 | 261 | roads1_style_1.rules.append(roads1_rule_1) |
262 | 262 | m.append_style('highway-border', roads1_style_1) |
263 | 263 |
|
|
267 | 267 | sym.stroke = mapnik.Color(242,191,36) |
268 | 268 | sym.stroke_linecap = mapnik.stroke_linecap.ROUND_CAP |
269 | 269 | sym.stroke_width = 5 |
270 | | -roads1_rule_2.symbols.append(sym) |
| 270 | +roads1_rule_2.symbolizers.append(sym) |
271 | 271 | roads1_style_2.rules.append(roads1_rule_2) |
272 | 272 |
|
273 | 273 | m.append_style('highway-fill', roads1_style_2) |
|
291 | 291 | # text to label with. Then there is font size in points (I think?), and colour. |
292 | 292 |
|
293 | 293 | # 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]"), |
295 | 295 |
|
296 | 296 | #finder = mapnik.PlacementFinder() |
297 | 297 | #finder.face_name = 'DejaVu Sans Book' |
|
301 | 301 | #finder.fill = mapnik.Color("black") |
302 | 302 | #finder.format_expression = "[GEONAME]" |
303 | 303 |
|
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]" |
311 | 311 |
|
312 | 312 |
|
313 | 313 | # We set a "halo" around the text, which looks like an outline if thin enough, |
|
318 | 318 | #popplaces_text_sym.avoid_edges = True |
319 | 319 | #popplaces_text_sym.minimum_padding = 30 |
320 | 320 |
|
321 | | -popplaces_rule.symbols.append(popplaces_text_sym) |
| 321 | +#popplaces_rule.symbolizers.append(popplaces_text_sym) |
| 322 | + |
322 | 323 | popplaces_style.rules.append(popplaces_rule) |
323 | 324 |
|
324 | 325 | m.append_style('popplaces', popplaces_style) |
|
0 commit comments