class mapscript.rectObj(minx: double = -1.0, miny: double = -1.0, maxx: double = -1.0, maxy: double = -1.0, imageunits: int = 0)

A rectObj represents a rectangle or bounding box. A rectObj may be a lone object or an attribute of another object and has no other associations.



double Maximum easting


double Maximum northing


double Minimum easting


double Minimum northing


The membership flag


__init__(minx: double = -1.0, miny: double = -1.0, maxx: double = -1.0, maxy: double = -1.0, imageunits: int = 0)[source]

Create new instance. The four easting and northing arguments are optional and default to -1.0. Note the new optional fifth argument which allows creation of rectangles in image (pixel/line) units which are also tested for validity.

draw(map: mapObj, layer: layerObj, image: imageObj, classindex: int, text: char) int[source]

Draw rectangle into img using style defined by the classindex class of layer. The rectangle is labeled with the string text. Returns MS_SUCCESS or MS_FAILURE

fit(width: int, height: int) double[source]

Adjust the rect to fit the width and height. Returns cellsize of rect.

getCenter() pointObj[source]

Return the center point of the rectangle.

project(projin: projectionObj, projout: projectionObj) int[source]

Reproject rectangle from proj_in to proj_out. Transformation is done in place. Returns MS_SUCCESS or MS_FAILURE

toPolygon() shapeObj[source]

Convert to a polygon of five vertices.

toString() char[source]

Return a string formatted like: { 'minx': %f , 'miny': %f , 'maxx': %f , 'maxy': %f } with the bounding values substituted appropriately. Python users can get the same effect via the rectObj __str__ method:

>>> r = mapscript.rectObj(0, 0, 1, 1)
>>> str(r)
{ 'minx': 0 , 'miny': 0 , 'maxx': 1 , 'maxy': 1 }