• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python mapnik.render函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mapnik.render函数的典型用法代码示例。如果您正苦于以下问题:Python render函数的具体用法?Python render怎么用?Python render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了render函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: render_tile

    def render_tile(self, z, x, y):
        """
        :param z: Zoom level
        :param x: Tile horizontal position
        :param y: Tile vertical position
        """

        topleft = num2deg(x, y, z)
        bottomright = num2deg(x + 1, y + 1, z)

        # Bounding box for the tile
        bbox = mapnik.Box2d(topleft, bottomright)

        bbox = DATA_PROJECTION.forward(bbox)

        print("Bouding box: ", bbox)

        # self.m.resize(TILE_WIDTH, TILE_WIDTH)
        self.m.zoom_to_box(bbox)

        MIN_BUFFER = 256
        self.m.buffer_size = max(self.m.buffer_size, MIN_BUFFER)

        # Render image with default Agg renderer
        im = mapnik.Image(TILE_WIDTH, TILE_WIDTH)
        mapnik.render(self.m, im)
        return im
开发者ID:rshk,项目名称:render-tiles,代码行数:27,代码来源:tileserver.py


示例2: test_pre_multiply_status_of_map2

def test_pre_multiply_status_of_map2():
    m = mapnik.Map(256,256)
    m.background = mapnik.Color(1,1,1,255)
    im = mapnik.Image(m.width,m.height)
    eq_(validate_pixels_are_not_premultiplied(im),True)
    mapnik.render(m,im)
    eq_(validate_pixels_are_not_premultiplied(im),True)
开发者ID:NeilvB,项目名称:mapnik,代码行数:7,代码来源:compositing_test.py


示例3: test_background_image_with_alpha_and_background_color

def test_background_image_with_alpha_and_background_color():
    m = mapnik.Map(10,10)
    m.background = mapnik.Color('rgba(255,255,255,.5)')
    m.background_image = '../data/images/yellow_half_trans.png'
    im = mapnik.Image(m.width,m.height)
    mapnik.render(m,im)
    eq_(get_unique_colors(im),['rgba(255,255,85,191)'])
开发者ID:NeilvB,项目名称:mapnik,代码行数:7,代码来源:compositing_test.py


示例4: test_background_image_and_background_color

def test_background_image_and_background_color():
    m = mapnik.Map(8,8)
    m.background = mapnik.Color('rgba(255,255,255,.5)')
    m.background_image = '../data/images/stripes_pattern.png'
    im = mapnik.Image(m.width,m.height)
    mapnik.render(m,im)
    eq_(get_unique_colors(im),['rgba(255,255,255,128)', 'rgba(74,74,74,255)'])
开发者ID:sebastic,项目名称:python-mapnik,代码行数:7,代码来源:compositing_test.py


示例5: _render_mapfile

    def _render_mapfile(self, mapfile, query):
        start_time = time.time()

        m = self.map_obj(mapfile)
        m.resize(query.size[0], query.size[1])
        m.srs = '+init=%s' % str(query.srs.srs_code.lower())
        envelope = mapnik.Box2d(*query.bbox)
        m.zoom_to_box(envelope)
        data = None

        try:
            if self.layers:
                i = 0
                for layer in m.layers[:]:
                    if layer.name != 'Unkown' and layer.name not in self.layers:
                        del m.layers[i]
                    else:
                        i += 1

            img = mapnik.Image(query.size[0], query.size[1])
            if self.scale_factor:
                mapnik.render(m, img, self.scale_factor)
            else:
                mapnik.render(m, img)
            data = img.tostring(str(query.format))
        finally:
            size = None
            if data:
                size = len(data)
            log_request('%s:%s:%s:%s' % (mapfile, query.bbox, query.srs.srs_code, query.size),
                status='200' if data else '500', size=size, method='API', duration=time.time()-start_time)

        return ImageSource(BytesIO(data), size=query.size,
            image_opts=ImageOptions(format=query.format))
开发者ID:LKajan,项目名称:mapproxy,代码行数:34,代码来源:mapnik.py


示例6: renderArea

    def renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom):
        """
        """
        start_time = time()

        #
        # Mapnik can behave strangely when run in threads, so place a lock on the instance.
        #
        if global_mapnik_lock.acquire():
            try:
                if self.mapnik is None:
                    self.mapnik = get_mapnikMap(self.mapfile)
                    logging.debug('TileStache.Mapnik.ImageProvider.renderArea() %.3f to load %s', time() - start_time, self.mapfile)

                self.mapnik.width = width
                self.mapnik.height = height
                self.mapnik.zoom_to_box(Box2d(xmin, ymin, xmax, ymax))

                img = mapnik.Image(width, height)
                mapnik.render(self.mapnik, img)
            except:
                self.mapnik = None
                raise
            finally:
                # always release the lock
                global_mapnik_lock.release()

        img = Image.frombytes('RGBA', (width, height), img.tostring())

        logging.debug('bbox:%lf,%lf,%lf,%lf', xmin, ymin, xmax, ymax)
        logging.debug('TileStache.Mapnik.ImageProvider.renderArea() %dx%d in %.3f from %s', width, height, time() - start_time, self.mapfile)

        return img
开发者ID:FormatNani,项目名称:django-ugeo,代码行数:33,代码来源:Mapnik.py


示例7: test_raster_warping

def test_raster_warping():
    lyrSrs = "+init=epsg:32630"
    mapSrs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
    lyr = mapnik.Layer('dataraster', lyrSrs)
    if 'gdal' in mapnik.DatasourceCache.instance().plugin_names():
        lyr.datasource = mapnik.Gdal(
            file = '../data/raster/dataraster.tif',
            band = 1,
            )
        sym = mapnik.RasterSymbolizer()
        sym.colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_DISCRETE, mapnik.Color(255,255,0))
        rule = mapnik.Rule()
        rule.symbols.append(sym)
        style = mapnik.Style()
        style.rules.append(rule)
        _map = mapnik.Map(256,256, mapSrs)
        _map.append_style('foo', style)
        lyr.styles.append('foo')
        _map.layers.append(lyr)
        prj_trans = mapnik.ProjTransform(mapnik.Projection(mapSrs),
                                          mapnik.Projection(lyrSrs)) 
        _map.zoom_to_box(prj_trans.backward(lyr.envelope()))

        im = mapnik.Image(_map.width,_map.height)
        mapnik.render(_map, im)
        # save a png somewhere so we can see it
        save_data('test_raster_warping.png', im.tostring('png'))
        imdata = im.tostring()
        assert contains_word('\xff\xff\x00\xff', imdata)
开发者ID:PierceCountyWA,项目名称:mapnik,代码行数:29,代码来源:raster_symbolizer_test.py


示例8: render

    def render(self, filename, tile_x, tile_y, zoom):
        """
        Render a single tile to a given filename.
        """
        print 'Rendering %s' % (filename)

        # Calculate pixel positions of bottom-left & top-right
        half_width = self.width / 2
        half_height = self.height / 2
        px0 = (tile_x * self.width, (tile_y + 1) * self.height)
        px1 = ((tile_x + 1) * self.width, tile_y * self.height)

        # Convert tile coords to LatLng
        ll0 = self.tile_projection.fromPixelToLL(px0, zoom);
        ll1 = self.tile_projection.fromPixelToLL(px1, zoom);
        
        # Convert LatLng to map coords
        c0 = self.map_projection.forward(mapnik.Coord(ll0[0], ll0[1]))
        c1 = self.map_projection.forward(mapnik.Coord(ll1[0], ll1[1]))

        # Create bounding box for the render
        bbox = mapnik.Box2d(c0.x, c0.y, c1.x, c1.y)

        self.mapnik_map.zoom_to_box(bbox)
        self.mapnik_map.buffer_size = self.buffer_size 

        # Render image with default renderer
        image = mapnik.Image(self.width, self.height)
        mapnik.render(self.mapnik_map, image)
        image.save(filename, self.filetype)
开发者ID:JoeGermuska,项目名称:invar,代码行数:30,代码来源:renderer.py


示例9: renderPage

def renderPage(ll,file):

        z = 2
        #imgx = 987 * z
        #imgy = 801 * z
        imgx = int(987 * z )
        imgy = int(987 * z *0.77 )
        m = mapnik.Map(imgx,imgy)
        mapnik.load_map(m,mapfile)
        prj = mapnik.Projection("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m [email protected] +no_defs +over")
        c0 = prj.forward(mapnik.Coord(ll[0],ll[1]))
        c1 = prj.forward(mapnik.Coord(ll[2],ll[3]))
        if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
            bbox = mapnik.Box2d(c0.x,c0.y,c1.x,c1.y)
        else:
            bbox = mapnik.Envelope(c0.x,c0.y,c1.x,c1.y)
            m.zoom_to_box(bbox)
            im = mapnik.Image(imgx,imgy)
            mapnik.render(m, im)
            view = im.view(0,0,imgx,imgy) # x,y,width,height
            map_uri=file + '.png'
            view.save(map_uri,'png')
        
        
            file=open(file+'.svg' ,'w')
            surface=cairo.SVGSurface(file.name,imgx,imgy)
            mapnik.render(m,surface)
            #c = cairo.Context(surface)
            #c.move_to(50,50)
            #c.show_text('testing')

            surface.finish();
开发者ID:ssinger,项目名称:cake-maker,代码行数:32,代码来源:cake-maker.py


示例10: test_raster_warping

def test_raster_warping():
    lyrSrs = "+init=epsg:32630"
    mapSrs = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
    lyr = mapnik.Layer("dataraster", lyrSrs)
    if "gdal" in mapnik.DatasourceCache.plugin_names():
        lyr.datasource = mapnik.Gdal(file="../data/raster/dataraster.tif", band=1)
        sym = mapnik.RasterSymbolizer()
        sym.colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_DISCRETE, mapnik.Color(255, 255, 0))
        rule = mapnik.Rule()
        rule.symbols.append(sym)
        style = mapnik.Style()
        style.rules.append(rule)
        _map = mapnik.Map(256, 256, mapSrs)
        _map.append_style("foo", style)
        lyr.styles.append("foo")
        _map.layers.append(lyr)
        map_proj = mapnik.Projection(mapSrs)
        layer_proj = mapnik.Projection(lyrSrs)
        prj_trans = mapnik.ProjTransform(map_proj, layer_proj)
        _map.zoom_to_box(prj_trans.backward(lyr.envelope()))

        im = mapnik.Image(_map.width, _map.height)
        mapnik.render(_map, im)
        imdata = im.tostring()
        assert contains_word("\xff\xff\x00\xff", imdata)
开发者ID:olt,项目名称:mapnik,代码行数:25,代码来源:raster_symbolizer_test.py


示例11: render_tile

def render_tile(mapfile, tile_uri, x, y, z):
	m = mapnik.Map(256, 256)

	# Load style XML
	mapnik.load_map(m, mapfile, True)

	# Obtain <Map> projection
	prj = mapnik.Projection(m.srs)

	# Projects between tile pixel co-ordinates and LatLong (EPSG:4326)
	tileproj = GoogleProjection(z+1)

	# Calculate pixel positions of bottom-left & top-right
	p0 = (x * 256, (y + 1) * 256)
	p1 = ((x + 1) * 256, y * 256)

	# Convert to LatLong (EPSG:4326)
	l0 = tileproj.fromPixelToLL(p0, z);
	l1 = tileproj.fromPixelToLL(p1, z);

	# Convert to map projection (e.g. mercator co-ords EPSG:900913)
	c0 = prj.forward(mapnik.Coord(l0[0],l0[1]))
	c1 = prj.forward(mapnik.Coord(l1[0],l1[1]))

	# Bounding box for the tile
	bbox = mapnik.Envelope(c0.x,c0.y, c1.x,c1.y)
	render_size = 256
	m.resize(render_size, render_size)
	m.zoom_to_box(bbox)
	m.buffer_size = 128

	# Render image with default Agg renderer
	im = mapnik.Image(render_size, render_size)
	mapnik.render(m, im)
	im.save(tile_uri, 'png256')
开发者ID:shujaatak,项目名称:luckygps2,代码行数:35,代码来源:generate_tiles.py


示例12: test_that_coordinates_do_not_overflow_and_polygon_is_rendered

def test_that_coordinates_do_not_overflow_and_polygon_is_rendered():
  expected_color = mapnik.Color('white')
  ds = mapnik.MemoryDatasource()
  context = mapnik.Context()
  ds.add_feature(mapnik.Feature.from_geojson(json.dumps(geojson),context))
  s = mapnik.Style()
  r = mapnik.Rule()
  sym = mapnik.PolygonSymbolizer()
  sym.fill = expected_color
  sym.clip = False
  r.symbols.append(sym)
  s.rules.append(r)
  lyr = mapnik.Layer('Layer')
  lyr.datasource = ds
  lyr.styles.append('style')
  m = mapnik.Map(256,256)
  m.background_color = mapnik.Color('black')
  m.append_style('style',s)
  m.layers.append(lyr)
  # 17/20864/45265.png
  m.zoom_to_box(mapnik.Box2d(-13658379.710221574,6197514.253362091,-13657768.213995293,6198125.749588372))
  # works 15/5216/11316.png
  #m.zoom_to_box(mapnik.Box2d(-13658379.710221574,6195679.764683247,-13655933.72531645,6198125.749588372))
  im = mapnik.Image(256,256)
  mapnik.render(m,im)
  eq_(im.get_pixel(128,128),expected_color.packed())
开发者ID:1060460048,项目名称:mapnik,代码行数:26,代码来源:agg_rasterizer_integer_overflow_test.py


示例13: GetMap

 def GetMap(self, params):
     if params["bbox"][0] >= params["bbox"][2]:
         raise OGCException("BBOX values don't make sense.  minx is greater than maxx.")
     if params["bbox"][1] >= params["bbox"][3]:
         raise OGCException("BBOX values don't make sense.  miny is greater than maxy.")
     if params.has_key("styles") and len(params["styles"]) != len(params["layers"]):
         raise OGCException("STYLES length does not match LAYERS length.")
     m = Map(params["width"], params["height"])
     if params.has_key("transparent") and params["transparent"] == "FALSE":
         m.background = params["bgcolor"]
     else:
         m.background = Color(0, 0, 0, 0)
     maplayers = self.mapfactory.layers
     mapstyles = self.mapfactory.styles
     for layername in params["layers"]:
         try:
             layer = maplayers[layername]
         except KeyError:
             raise OGCException('Layer "%s" not defined.' % layername, "LayerNotDefined")
         for stylename in layer.styles:
             if stylename in mapstyles.keys():
                 m.append_style(stylename, mapstyles[stylename])
             else:
                 raise ServerConfigurationError(
                     'Layer "%s" refers to non-existent style "%s".' % (layername, stylename)
                 )
         m.layers.append(layer)
     m.zoom_to_box(Envelope(params["bbox"][0], params["bbox"][1], params["bbox"][2], params["bbox"][3]))
     im = Image(params["width"], params["height"])
     render(m, im)
     im = fromstring("RGBA", (params["width"], params["height"]), rawdata(im))
     fh = StringIO()
     im.save(fh, PIL_TYPE_MAPPING[params["format"]], quality=100)
     fh.seek(0)
     return Response(params["format"], fh.read())
开发者ID:BackupTheBerlios,项目名称:mapnik-svn,代码行数:35,代码来源:common.py


示例14: render_tile

    def render_tile(self, x, y, z, utf_grid):

        # Calculate pixel positions of bottom-left & top-right
        p0 = (x * 256, (y + 1) * 256)
        p1 = ((x + 1) * 256, y * 256)

        # Convert to LatLong (EPSG:4326)
        l0 = self.tileproj.fromPixelToLL(p0, z);
        l1 = self.tileproj.fromPixelToLL(p1, z);

        # Convert to map projection (e.g. mercator co-ords EPSG:900913)
        c0 = self.prj.forward(mapnik.Coord(l0[0],l0[1]))
        c1 = self.prj.forward(mapnik.Coord(l1[0],l1[1]))

        # Bounding box for the tile
        if hasattr(mapnik,'mapnik_version') and mapnik.mapnik_version() >= 800:
            bbox = mapnik.Box2d(c0.x,c0.y, c1.x,c1.y)
        else:
            bbox = mapnik.Envelope(c0.x,c0.y, c1.x,c1.y)
        render_size = 256
        self.m.resize(render_size, render_size)
        self.m.zoom_to_box(bbox)
        if(self.m.buffer_size < 128):
            self.m.buffer_size = 128

        if utf_grid is True:
            grid = mapnik.Grid(self.m.width,self.m.height)
            mapnik.render_layer(self.m, grid, layer=0, fields=['html_exp'])
            utfgrid = grid.encode('utf', resolution=4)
            return json.dumps(utfgrid);
        else:
            im = mapnik.Image(render_size, render_size)
            mapnik.render(self.m, im)
            return im.tostring('png');
开发者ID:orfon,项目名称:ringo-mapnik,代码行数:34,代码来源:render_tile.py


示例15: test_raster_warping_does_not_overclip_source

def test_raster_warping_does_not_overclip_source():
    lyrSrs = "+init=epsg:32630"
    mapSrs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
    lyr = mapnik.Layer('dataraster', lyrSrs)
    if 'gdal' in mapnik.DatasourceCache.plugin_names():
        lyr.datasource = mapnik.Gdal(
            file = '../data/raster/dataraster.tif',
            band = 1,
            )
        sym = mapnik.RasterSymbolizer()
        sym.colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_DISCRETE, mapnik.Color(255,255,0))
        rule = mapnik.Rule()
        rule.symbols.append(sym)
        style = mapnik.Style()
        style.rules.append(rule)
        _map = mapnik.Map(256,256, mapSrs)
        _map.background=mapnik.Color('white')
        _map.append_style('foo', style)
        lyr.styles.append('foo')
        _map.layers.append(lyr)
        _map.zoom_to_box(mapnik.Box2d(3,42,4,43))

        im = mapnik.Image(_map.width,_map.height)
        mapnik.render(_map, im)
        expected_file = './images/support/raster_warping_does_not_overclip_source.png'
        actual_file = '/tmp/' + os.path.basename(expected_file)
        im.save(actual_file,'png32')
        if not os.path.exists(expected_file) or os.environ.get('UPDATE'):
            im.save(expected_file,'png32')
        actual = mapnik.Image.open(actual_file)
        expected = mapnik.Image.open(expected_file)
        eq_(actual.tostring('png32'),expected.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual_file,expected_file))
开发者ID:1060460048,项目名称:mapnik,代码行数:32,代码来源:raster_symbolizer_test.py


示例16: render_to_file

 def render_to_file(self,*args):
     """
     Routine to render the requested AGG format.
     """
     format = args[2]
     if format in ('tif','tiff'):
         self.timer()
         (handle, png_tmp) = tempfile.mkstemp('.png', 'nik2img-tmp')
         os.close(handle)
         self.world_file_ext = 'wld'
         self.write_wld(png_tmp)
         im = mapnik.Image(args[0].width,self.m.height)
         if self.scale_factor:
             mapnik.render(args[0],im,self.scale_factor)
         else:
             mapnik.render(args[0],im)
         im.save(png_tmp,'png')
         # todo - figure out more reasonable defaults
         opts = ' -ot Byte -co COMPRESS=JPEG -co JPEG_QUALITY=100'
         base_cmd = 'gdal_translate %s %s -a_srs "%s" %s'
         cmd = base_cmd % (png_tmp,args[1],args[0].srs,opts)
         #print call(cmd,fail=True)
         os.system(cmd)
         self.stop()
     else:
         self.timer()
         if self.scale_factor:
             args = args + (self.scale_factor,)
         mapnik.render_to_file(*args)
         if self.world_file_ext:
             self.write_wld(args[1])
         self.stop()
     if self.zip_compress:
         self.zip_up(args[1])
开发者ID:hitzi,项目名称:nik2img,代码行数:34,代码来源:renderer.py


示例17: render_map

def render_map(map, bbox, width, height):
    """Render a map within a given bounding box and size"""
    map.resize(width, height)
    map.zoom_to_box(bbox)
    image = Image(width, height)
    render(map, image)
    return image.tostring('png')
开发者ID:mishok13,项目名称:writings,代码行数:7,代码来源:atlanta.py


示例18: wms

def wms(request):
    global map_cache
    w,h = int(request.GET['WIDTH']), int(request.GET['HEIGHT'])
    mime = request.GET['FORMAT']
    p = mapnik.Projection('%s' % str("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") )
    mapfile = settings.MAPNIK_MAPFILE
    if not map_cache:
        map_cache = MapCache(mapfile,p.params())
    env = map(float,request.GET['BBOX'].split(','))
    # note: must be run without threading until #345 is closed
    # http://trac.mapnik.org/ticket/345
    # tile = deepcopy(map_cache.map)
    tile = map_cache.map
    tile.buffer_size = 128
    try:
        tile.resize(w,h)
    except:
        tile.width = w
        tile.height = h
    tile.zoom_to_box(mapnik.Envelope(*env))
    draw = mapnik.Image(tile.width, tile.height)
    mapnik.render(tile,draw)
    image = draw.tostring(str(mime.split('/')[1]))
    response = HttpResponse()
    response['Content-length'] = len(image)
    response['Content-Type'] = mime
    response.write(image)
    return response
开发者ID:oluka,项目名称:mapping_rapidsms,代码行数:28,代码来源:mapnik_engine.py


示例19: test_raster_with_alpha_blends_correctly_with_background

def test_raster_with_alpha_blends_correctly_with_background():
    WIDTH = 500
    HEIGHT = 500

    map = mapnik.Map(WIDTH, HEIGHT)
    WHITE = mapnik.Color(255, 255, 255)
    map.background = WHITE

    style = mapnik.Style()
    rule = mapnik.Rule()
    symbolizer = mapnik.RasterSymbolizer()
    symbolizer.scaling = mapnik.scaling_method.BILINEAR

    rule.symbols.append(symbolizer)
    style.rules.append(rule)

    map.append_style('raster_style', style)

    map_layer = mapnik.Layer('test_layer')
    filepath = '../data/raster/white-alpha.png'
    if 'gdal' in mapnik.DatasourceCache.instance().plugin_names():
        map_layer.datasource = mapnik.Gdal(file=filepath)
        map_layer.styles.append('raster_style')
        map.layers.append(map_layer)

        map.zoom_all()

        mim = mapnik.Image(WIDTH, HEIGHT)

        mapnik.render(map, mim)
        save_data('test_raster_with_alpha_blends_correctly_with_background.png',
                  mim.tostring('png'))
        imdata = mim.tostring()
        # All white is expected
        assert contains_word('\xff\xff\xff\xff', imdata)
开发者ID:PierceCountyWA,项目名称:mapnik,代码行数:35,代码来源:raster_symbolizer_test.py


示例20: test_that_coordinates_do_not_overflow_and_polygon_is_rendered_csv

def test_that_coordinates_do_not_overflow_and_polygon_is_rendered_csv():
    expected_color = mapnik.Color('white')
    projection = '+init=epsg:4326'
    ds = mapnik.MemoryDatasource()
    context = mapnik.Context()
    feat = mapnik.Feature.from_geojson(json.dumps(geojson), context)
    ds.add_feature(feat)
    geojson_string = "geojson\n'%s'" % json.dumps(geojson['geometry'])
    ds = mapnik.Datasource(**{'type': 'csv', 'inline': geojson_string})
    s = mapnik.Style()
    r = mapnik.Rule()
    sym = mapnik.PolygonSymbolizer()
    sym.fill = expected_color
    r.symbols.append(sym)
    s.rules.append(r)
    lyr = mapnik.Layer('Layer', projection)
    lyr.datasource = ds
    lyr.styles.append('style')
    m = mapnik.Map(256, 256, projection)
    m.background_color = mapnik.Color('green')
    m.append_style('style', s)
    m.layers.append(lyr)
    # 17/20864/45265.png
    m.zoom_to_box(mapnik.Box2d(-13658379.710221574,
                               6197514.253362091, -13657768.213995293, 6198125.749588372))
    # works 15/5216/11316.png
    # m.zoom_to_box(mapnik.Box2d(-13658379.710221574,6195679.764683247,-13655933.72531645,6198125.749588372))
    im = mapnik.Image(256, 256)
    mapnik.render(m, im)
    eq_(im.get_pixel(128, 128), expected_color.packed())
开发者ID:cbenz,项目名称:python-mapnik,代码行数:30,代码来源:agg_rasterizer_integer_overflow_test.py



注:本文中的mapnik.render函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mapnik.render_layer函数代码示例发布时间:2022-05-27
下一篇:
Python mapnik.mapnik_version函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap