Main Content

mapbbox

(Removed) Compute bounding box of georeferenced image or data grid

mapbbox has been removed. Instead, create a map raster reference object, and query its XWorldLimits and YWorldLimits properties. For more information, see Version History.

Syntax

bbox = mapbbox(R,height,width)
bbox = mapbbox(R, sizea)
BBOX = mapbbox(info)

Description

bbox = mapbbox(R,height,width) computes the 2-by-2 bounding box of a georeferenced image or regular gridded data set. R is either a 3-by-2 referencing matrix defining a 2-dimensional affine transformation from intrinsic pixel coordinates to map coordinates, or a MapCellsReference object. (If you are using a raster reference object, you can calculate the bounding box from the object limit properties of the object rather than using this function.) height and width are the image dimensions. bbox bounds the outer edges of the image in map coordinates:

[minX minY
 maxX maxY]

bbox = mapbbox(R, sizea) accepts sizea = [height, width, ...] instead of height and width.

BBOX = mapbbox(info) accepts a scalar structure array with the fields

'RefMatrix'

3-by-2 referencing matrix

'Height'

Scalar number

'Width'

Scalar number

Version History

Introduced before R2006a

expand all

R2023b: Removed

Some functions that accept referencing matrices as input have been removed, including the mapbbox function. Instead, create a map raster reference object, and query its XWorldLimits and YWorldLimits properties. Reference objects have several advantages over referencing matrices.

  • Unlike referencing matrices, reference objects have properties that document the size of the associated raster, its world limits, and the direction of its rows and columns. For more information about reference object properties, see the MapCellsReference and MapPostingsReference objects.

  • You can manipulate the limits of rasters associated with reference objects using the mapcrop function.

  • You can manipulate the size and resolution of rasters associated with reference objects using the mapresize function.

To update your code, first create a reference object for either a raster of cells using the maprefcells function or a raster of regularly posted samples using the maprefpostings function. Alternatively, convert from a referencing matrix to a reference object using the refmatToMapRasterReference function.

Then, find the limits of the raster by querying the XWorldLimits and YWorldLimits properties of the reference object, R. Create a bounding box matrix using the property values.

xlimits = R.XWorldLimits;
ylimits = R.YWorldLimits;
bbox = [xlimits' ylimits'];