xoa.core.plot.get_webmercator_pixels

xoa.core.plot.get_webmercator_pixels#

xoa.core.plot.get_webmercator_pixels(lon, lat, zoom, tile_size=256)[source]#

Get the pixel coordinates of points on a web map at a zoom level

These are the “global” pixel coordinates of web Mercator maps like those of Leaflet or OpenLayers: the world is tile_size * 2**zoom pixels wide, with x increasing eastward from the dateline and y increasing southward from the north.

Parameters:
  • lon (array_like) – Longitudes and latitudes in degrees

  • lat (array_like) – Longitudes and latitudes in degrees

  • zoom (float) – Zoom level

  • tile_size (int) – Size of the tiles in pixels

Returns:

numpy.ndarray – Array of shape lon.shape + (2,) with the x and y pixel coordinates