Skip to content

MapProjection

Records the map projection and the size of the pixels in a layer.

Note: It is very common to find that round errors creep into pixel scale values in GeoTIFFs from different sources, and so MapProjection tolerates small amounts of difference between pixel scales that are below a single metre in resolution.

This superceeeds the old PixelScale class, which will be removed in version 2.0.

Parameters:

Name Type Description Default
name

The map projection used in WKT format, or as "epsg:xxxx" or "esri:xxxx".

required
xstep float

The number of units horizontal distance a step of one pixel makes in the map projection.

required
ystep float

The number of units vertical distance a step of one pixel makes in the map projection.

required

Attributes:

Name Type Description
name str

The map projection used in WKT format.

xstep

The number of units horizontal distance a step of one pixel makes in the map projection.

ystep

The number of units vertical distance a step of one pixel makes in the map projection.

Examples:

Create a map projection using an EPSG code:

>>> proj_wgs84 = MapProjection("epsg:4326", 0.001, -0.001)

Create a projection using an ESRI code:

>>> proj_esri = MapProjection("esri:54030", 1000, -1000)

round_up_pixels(x, y)

In general we round up pixels, as we don't want to lose range data, but floating point math means we will get errors where the value of pixel scale value rounds us to a tiny faction of a pixel up, and so math.ceil would round us up for microns worth of distance.