Skip to content

morecantile.utils

morecantile.utils

morecantile utils.

_parse_tile_arg

_parse_tile_arg(*args) -> Tile

Parse the *tile arg of module functions

Copy from github.com/mapbox/mercantile/blob/master/mercantile/__init__.py

Parameters

tile : Tile or sequence of int May be be either an instance of Tile or 3 ints, X, Y, Z.

Returns

Tile

Raises

TileArgParsingError

bbox_to_feature

bbox_to_feature(west: float, south: float, east: float, north: float) -> Dict

Create a GeoJSON feature from a bbox.

check_quadkey_support

check_quadkey_support(tms: List) -> bool

Check if a Tile Matrix Set supports quadkeys

is_power_of_two

is_power_of_two(number: int) -> bool

Check if a number is a power of 2

lons_contain_antimeridian

lons_contain_antimeridian(lon1: float, lon2: float) -> bool

Check if the antimeridian (180th meridian) is between two longitude points

Parameters

lon1: float The first longitude. lon2: float The second longitude

Returns

A bool representing whether two longs contain the 180th meridian.

meters_per_unit

meters_per_unit(crs: CRS) -> float

Coefficient to convert the coordinate reference system (CRS) units into meters (metersPerUnit).

From note g in docs.opengeospatial.org/is/17-083r2/17-083r2.html#table_2: If the CRS uses meters as units of measure for the horizontal dimensions, then metersPerUnit=1; if it has degrees, then metersPerUnit=2pa/360 (a is the Earth maximum radius of the ellipsoid).

point_in_bbox

point_in_bbox(point: Coords, bbox: BoundingBox, precision: int = 5) -> bool

Check if a point is in a bounding box.

to_rasterio_crs

to_rasterio_crs(incrs: CRS)

Convert a pyproj CRS to a rasterio CRS