4.4.2. ProjectionDataMap

class pyprom.lib.datamap.ProjectionDataMap(numpy_map, upperLeftY, upperLeftX, resolutionY, resolutionX, span_y, span_x, linear_unit, unit, nodata, transform, reverse_transform, filename)[source]

ProjectionDataMap is a pyprom.lib.datamap.DataMap object for projection style datasets from GDAL.

__init__(numpy_map, upperLeftY, upperLeftX, resolutionY, resolutionX, span_y, span_x, linear_unit, unit, nodata, transform, reverse_transform, filename)[source]
GDAL Native coordiante system oriented:
Y: east/west
X: north/south

numpy_map is oriented:
Y: north/south
X: east/west

called like:
numpy_map[x][y]
Parameters
  • numpy_map (numpy.ndarray) – numpy_array multidimensional array of data numpy_map[x][y]

  • upperLeftY (int) – Upper Left Y native coordinate from GDAL. This is the X axis for Numpy.

  • upperLeftX (int) – Upper Left X native coordinate from GDAL. This is the Y axis for Numpy

  • resolutionY (int) – Number of units per pixel on GDAL native Y axis. This is the X axis for Numpy

  • resolutionX (int) – Number of units per pixel on GDAL native X axis. This is the Y axis for Numpy

  • span_y (int) – number of units along GDAL native Y axis. This is the X axis for Numpy

  • span_x (int) – number of units along GDAL native X axis. This is the Y axis for Numpy

  • unit (str) – Linear unit

  • nodata (str) – raster point value indicating a NULL Value

  • transform (osr.CoordinateTransformation) – CoordinateTransformation from GDAL native to selected units (degrees)

  • reverse_transform (osr.CoordinateTransformation) – CoordinateTransformation from selected units degrees scale to GDAL native

__repr__()[source]
Returns

String representation of this object

__str__()
Returns

String representation of this object

__unicode__()
Returns

String representation of this object

_leftmost_absolute()[source]
Returns

the Leftmost GDAL Native X coordinate (Y for numpy_map).

Return type

int

_lowermost_absolute()[source]
Returns

the Lowermost GDAL Native Y coordinate (X for numpy_map).

Return type

int

_rightmost_absolute()[source]
Returns

the Rightmost GDAL Native X coordinate (Y for numpy_map).

Return type

int

_uppermost_absolute()[source]
Returns

the Uppermost GDAL Native Y coordinate

(X for numpy_map). :rtype: int

elevation(latitude, longitude)[source]

This function returns the elevation at a certain lat/long in Meters.

Parameters
  • latitude – latitude in dotted decimal notation

  • longitude – longitude in dotted decimal notation.

Returns

elevation of coordinate in meters.

latlong_to_xy(latitude, longitude)[source]

This function converts a lat/long coordinate set to numpy[x][y].

Parameters
  • latitude (int) –

  • longitude (int) –

Returns

(x,y)

property lower_left

Produce the upper leftmost coordinate value in degrees.

property lower_right

Produce the upper leftmost coordinate value in degrees.

point_geom(x, y)[source]
Parameters
  • x – x coordinate

  • y – y coordinate

Returns

shapely.geometry.polygon.Polygon of this point

subset(x, y, xSpan, ySpan)[source]

Subset produces a subset of the parent (self) map. Uses numpy X,Y axis where X,Y are the upper left coordinates.

Parameters
  • x (int) – NW corner x coordinate (latitude)

  • y (int) – NW corner y coordinate (longitude)

  • xSpan (int) – depth of subset in points (latitude)

  • ySpan (int) – width of subset in points (longitude)

Returns

Projection Data Map

Return type

ProjectionDataMap

property upper_left

Produce the upper leftmost coordinate value in degrees.

property upper_right

Produce the upper leftmost coordinate value in degrees.

x_to_native_x(x)[source]

Converts a numpy X coordinate to the gdal native Y :return: the gdal native Y coordinate :rtype: int

xy_to_latlong(x, y)[source]

This function converts a numpy[x][y] coordinate to lat/long coordinates.

Parameters
  • x (int) – x location in numpy_map

  • y (int) – y location in numpy_map

Returns

(latitude, longitude)

y_to_native_y(y)[source]

Converts a numpy Y coordinate to the gdal native X (Y for numpy_map). :return: the gdal native X coordinate :rtype: int