[Live-demo] [OSGeo] #1751: Mapnik python demo error

OSGeo trac_osgeo at osgeo.org
Thu Jul 14 08:31:48 PDT 2016


#1751: Mapnik python demo error
-------------------------------------+----------------------------
 Reporter:  darkblueb                |       Owner:  live-demo@…
     Type:  defect                   |      Status:  new
 Priority:  normal                   |   Milestone:  OSGeoLive10.0
Component:  LiveDVD                  |  Resolution:
 Keywords:  mapnik, python, jupyter  |
-------------------------------------+----------------------------

Comment (by sebastic):

 Replacing source in the problematic cell with the following works on build
 197:
 {{{
 import mapnik

 BASE_FOLDER = '/home/user/data/north_carolina/shape'
 c_shapefile = os.path.join(BASE_FOLDER, 'nc_state.shp')

 m = mapnik.Map(600, 600)

 layer = mapnik.Layer('contour')
 layer.datasource = mapnik.Shapefile(file=c_shapefile)

 style = mapnik.Style()
 rule = mapnik.Rule()

 line_symbolizer = mapnik.LineSymbolizer()
 line_symbolizer.stroke = mapnik.Color('green')
 line_symbolizer.stroke_width = 0.4
 rule.symbols.append(line_symbolizer)

 m.layers.append(layer)
 style.rules.append(rule)
 m.append_style('My Style', style)
 layer.styles.append('My Style')

 m.layers.append(layer)
 m.zoom_all()
 show_mapnik(m)

 }}}

--
Ticket URL: <https://trac.osgeo.org/osgeo/ticket/1751#comment:4>
OSGeo <http://www.osgeo.org/>
OSGeo committee and general foundation issue tracker.


More information about the Live-demo mailing list