mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-29 08:56:27 +02:00
Get use of CairoSVG for rasterization.
This commit is contained in:
parent
7c43448275
commit
0cf935e599
4 changed files with 15 additions and 44 deletions
|
@ -6,7 +6,8 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
|
|||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from roentgen.raster import rasterize
|
||||
import cairosvg
|
||||
|
||||
from roentgen.tile import Tile
|
||||
from roentgen.workspace import workspace
|
||||
|
||||
|
@ -42,7 +43,8 @@ class Handler(BaseHTTPRequestHandler):
|
|||
if not svg_path.exists():
|
||||
tile = Tile(x, y, zoom)
|
||||
tile.draw(tile_path, self.cache)
|
||||
rasterize(svg_path, png_path)
|
||||
cairosvg.svg2png(file_obj=svg_path, write_to=str(png_path))
|
||||
logging.info(f"SVG file is rasterized to {png_path}.")
|
||||
if zoom != 18:
|
||||
return
|
||||
if png_path.exists():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue