export
export
Map export functionality (HTML, PNG, SVG).
export.capture_screenshot
capture_screenshot(
html_path: str,
width: int = 1200,
height: int = 800,
delay: float = 2.0,
scale: float = 1.0,
) -> bytes
Capture a screenshot of an HTML file using a headless browser.
Uses Chrome/Chromium if available, otherwise falls back to Microsoft Edge.
Parameters:
-
html_path(str) –Path to the HTML file.
-
width(int, default:1200) –Viewport width in pixels.
-
height(int, default:800) –Viewport height in pixels.
-
delay(float, default:2.0) –Seconds to wait for tile loading.
-
scale(float, default:1.0) –Device pixel ratio.
scale=2.0renders at 2× pixel density (Retina), producing awidth * 2×height * 2pixel image while keeping the map layout identical toscale=1.0.
Returns:
-
bytes–PNG image bytes.
Source code in mapyta/export.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
export.check_selenium
check_selenium() -> None
Verify Selenium and a supported browser are available.
Raises:
-
ImportError–If selenium is not installed.
-
RuntimeError–If no Chromium-based browser (Chrome, Chromium, or Edge) is installed.
Source code in mapyta/export.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |