Main Content

Define Areas of Interest

Since R2024b

An area of interest (AOI) is a type of region of interest (ROI) that defines a focus area for geospatial analysis and visualization. For example, you can use AOIs to indicate the boundaries of a city, to represent the footprint of an elevation data file, or to define a wireless coverage zone.

Mapping Toolbox™ represents AOIs using polygon shape objects.

  • Represent an AOI with coordinates in a geographic coordinate reference system (CRS) by using a scalar geopolyshape object.

  • Represent an AOI with coordinates in a projected CRS by using a scalar mappolyshape object.

Because AOIs are geopolyshape and mappolyshape objects, you can examine and modify AOIs by using the corresponding object functions. For example, you can find the area of an AOI by using the area function, buffer an AOI by using the buffer function, and find the bounds of an AOI by using the bounds function.

You can define AOIs in several ways. You can:

  • Define a quadrangular or rectangular AOI by using the aoiquad function.

  • Define a circular AOI by using the aoicircle function.

  • Define an AOI from vertices by using the geopolyshape or mappolyshape function.

  • Define an AOI from a region or state name by using the geocode function.

These examples show how to define AOIs using each of the listed processes.

Quadrangular or Rectangular AOI

Define a quadrangular or rectangular AOI by using the aoiquad function. The function defines the AOI by finding the bounds of the specified data. The AOI is a quadrangle when the data is in geographic coordinates and a rectangle when the data is in projected coordinates.

Get information about a raster data file by creating a RasterInfo object. Extract the spatial reference from the object. The spatial reference indicates that the raster is a grid of rectangular cells referenced to projected coordinates.

info = georasterinfo("MountDartmouth-ft.grd");
R = info.RasterReference
R = 
  MapCellsReference with properties:

            XWorldLimits: [300390 310770]
            YWorldLimits: [4902150 4916340]
              RasterSize: [473 346]
    RasterInterpretation: 'cells'
        ColumnsStartFrom: 'north'
           RowsStartFrom: 'west'
      CellExtentInWorldX: 30
      CellExtentInWorldY: 30
    RasterExtentInWorldX: 10380
    RasterExtentInWorldY: 14190
        XIntrinsicLimits: [0.5 346.5]
        YIntrinsicLimits: [0.5 473.5]
      TransformationType: 'rectilinear'
    CoordinateSystemType: 'planar'
            ProjectedCRS: [1×1 projcrs]


Create a rectangular AOI from the spatial reference. When you pass data in projected coordinates to the aoiquad function, the function represents the AOI using a scalar polygon shape in projected coordinates.

aoiR = aoiquad(R)
aoiR = 
  mappolyshape with properties:

              NumRegions: 1
                NumHoles: 0
                Geometry: "polygon"
    CoordinateSystemType: "planar"
            ProjectedCRS: [1×1 projcrs]

Display the AOI on a map. The AOI represents the footprint of the raster data file.

figure
geobasemap topographic
geoplot(aoiR)

Figure contains an axes object with type geoaxes. The geoaxes object contains an object of type polygon.

The aoiquad function also enables you to create AOIs from vector data. For more examples, see the aoiquad reference page.

Circular AOI

Define a circular AOI by using the aoicircle function. The function defines the AOI by creating circles with a specified radius that are centered at the specified coordinates.

Read a shapefile containing the coordinates of locations in Boston into a geospatial table. The table represents the locations using point shapes in projected coordinates.

places = readgeotable("boston_placenames.shp");
shape = places.Shape
shape = 
  13×1 mappointshape array with properties:

               NumPoints: [13×1 double]
                       X: [13×1 double]
                       Y: [13×1 double]
                Geometry: "point"
    CoordinateSystemType: "planar"
            ProjectedCRS: [1×1 projcrs]

Create an AOI of circles from the point shapes. Specify the radius of each circle as 300 meters. When you pass data in projected coordinates to the aoicircle function, the function represents the AOI using a scalar polygon shape in projected coordinates.

aoiC = aoicircle(shape,300)
aoiC = 
  mappolyshape with properties:

              NumRegions: 7
                NumHoles: 1
                Geometry: "polygon"
    CoordinateSystemType: "planar"
            ProjectedCRS: [1×1 projcrs]

Display the AOI and the locations on a map.

figure
geoplot(aoiC)
hold on
geobasemap topographic
geoplot(shape,"k",MarkerSize=10)

Figure contains an axes object with type geoaxes. The geoaxes object contains 2 objects of type polygon, point.

The aoicircle function also enables you to create AOIs from numeric coordinates. For more examples, see the aoicircle reference page.

AOI from Vertices

Define an AOI from vertices by using the geopolyshape or mappolyshape function. These functions define the AOI by creating polygons with vertices at the specified coordinates.

Create an AOI from vertices in geographic coordinates by using the geopolyshape function.

View satellite imagery for a region surrounding the MathWorks Apple Hill campus in Natick, MA.

figure
geobasemap satellite
geolimits([42.2971 42.3024],[-71.3551 -71.3464])

Figure contains an axes object with type geoaxes. The geoaxes object is empty.

Identify the vertices of a seven-sided polygon that surrounds the campus. To use predefined vertices, specify interactivelySelectVertices as false. To interactively select the vertices, specify interactivelySelectVertices as true.

interactivelySelectVertices = false;
if interactivelySelectVertices
    [lat,lon] = ginput(7);
else
    lat = [42.3005 42.2993 42.2992 42.2987 42.2984 42.2986 42.3012];
    lon = [-71.3537 -71.3536 -71.3528 -71.3528 -71.3511 -71.3482 -71.3481];
end

Close the polygon by appending the first vertex to the end of the list of vertices.

lat(end+1) = lat(1);
lon(end+1) = lon(1);

Create an AOI from the vertices. Specify the geographic CRS as the World Geodetic System of 1984, which has the EPSG code 4326.

aoiP = geopolyshape(lat,lon);
aoiP.GeographicCRS = geocrs(4326)
aoiP = 
  geopolyshape with properties:

              NumRegions: 0
                NumHoles: 1
                Geometry: "polygon"
    CoordinateSystemType: "geographic"
           GeographicCRS: [1×1 geocrs]

Display the boundary of the AOI on the map.

geoplot(aoiP,FaceColor="none",LineWidth=3,EdgeColor="#EDB120")

Figure contains an axes object with type geoaxes. The geoaxes object contains an object of type polygon.

Create an AOI from vertices in projected coordinates by using the mappolyshape function. For more examples, see the mappolyshape reference page.

AOI from Region or State Placename

Define an AOI from a world region or US state placename by using the geocode function. The function gets the AOI by converting the placename into a polygon shape.

Get an AOI for the world region of Europe. The geocode function creates a geospatial table that contains the AOI and the name of the matched placename. Extract the AOI from the table.

europeGT = geocode("Europe");
aoiE = europeGT.Shape
aoiE = 
  geopolyshape with properties:

              NumRegions: 1
                NumHoles: 0
                Geometry: "polygon"
    CoordinateSystemType: "geographic"
           GeographicCRS: []

When you geocode the name of a world region, the AOI depicts either a bounding box or an outline of the region. Display the boundary of the AOI on a map. Provide more geographic context for the AOI by zooming out.

figure
geobasemap topographic
geoplot(aoiE,LineWidth=2,EdgeColor="#7E2F8E",FaceColor="none")
geolimits([15 75],[-54 75])

Figure contains an axes object with type geoaxes. The geoaxes object contains an object of type polygon.

By default, the geocode function finds matches for the specified placenames by searching an installed list of world regions, US states, and world cities. To view the placenames in the installed list, use the placenames function.

The geocode function also enables you to get AOIs from custom tables. For more examples, see the geocode reference page.

See Also

Functions

Objects

Related Topics