pysepal.mapping.bounds.viewport_pixels_from_map#

pysepal.mapping.bounds.viewport_pixels_from_map(map_widget)[source]#

Derive the map viewport (width, height) in pixels from synced bounds+zoom.

Longitude is linear in Web Mercator pixels (360° == 256 * 2**zoom), so the east-west bounds span gives width directly. Latitude is non-linear (Mercator stretches toward the poles), so height is computed via the Mercator Y formula.

Returns (None, None) if bounds/zoom are not yet available.