aoicircle
Syntax
Description
Numeric Data
defines an area of
interest (AOI) by creating circles with the specified radius that are
centered at the specified geographic coordinates. aoi
= aoicircle(lat
,lon
,radius
)
Examples
Define Circular AOI from Geographic Coordinates
Read the geographic coordinates of European capitals into the workspace. Specify the geographic CRS as the World Geodetic System of 1984, which has the EPSG code 4326
.
[lat,lon] = readvars("european_capitals.txt");
gcrs = geocrs(4326);
Create an AOI of circles from the geographic coordinates. Specify the radius of each circle as 2 degrees. When you pass geographic coordinates to the aoicircle
function, the function represents the AOI using a scalar polygon shape in geographic coordinates.
aoi = aoicircle(lat,lon,2,gcrs)
aoi = geopolyshape with properties: NumRegions: 6 NumHoles: 0 Geometry: "polygon" CoordinateSystemType: "geographic" GeographicCRS: [1×1 geocrs]
Display the AOI and the capitals on a map.
geobasemap topographic geoplot(aoi) hold on geoplot(lat,lon,"k.",MarkerSize=10)
Define Circular AOI from Projected Coordinates
Specify the projected coordinates for several places in Boston. Specify the projected CRS for the points as NAD83 / Massachusetts Mainland, which has the EPSG code 26986
.
x = [236266 235743 234685 232989 236536 234591 235741 237114 235741 236548]; y = [900974 900355 901429 901884 901901 901892 900663 900670 900725 899587]; pcrs = projcrs(26986);
When you pass projected coordinates to the aoicircle
function, you must specify the radius of each circle using the length unit of the projected CRS. Find the length unit. The result indicates that you must specify radius in meters.
pcrs.LengthUnit
ans = "meter"
Create an AOI of circles. Specify the circle centers using the projected coordinates, and specify the radius of each circle as 200 meters. When you pass projected coordinates to the aoicircle
function, the function represents the AOI using a scalar polygon shape in projected coordinates.
aoi = aoicircle(x,y,200,pcrs)
aoi = mappolyshape with properties: NumRegions: 8 NumHoles: 0 Geometry: "polygon" CoordinateSystemType: "planar" ProjectedCRS: [1×1 projcrs]
Display the AOI on a map.
geobasemap streets
geoplot(aoi)
Define Circular AOI from Geospatial Table
Create a geospatial table by geocoding several Australian cities. The table represents the cities using point shapes in geographic coordinates.
cities = ["Adelaide","Melbourne","Canberra","Sydney","Brisbane"]; GT = geocode(cities,"city"); GT.Shape
ans = 5×1 geopointshape array with properties: NumPoints: [5×1 double] Latitude: [5×1 double] Longitude: [5×1 double] Geometry: "point" CoordinateSystemType: "geographic" GeographicCRS: [1×1 geocrs]
Create an AOI of circles from the shapes in the geospatial table. Specify the radius of each circle as 3 degrees. When you pass data in geographic coordinates to the aoicircle
function, the function represents the AOI using a scalar polygon shape in geographic coordinates.
aoi = aoicircle(GT,3)
aoi = geopolyshape with properties: NumRegions: 2 NumHoles: 0 Geometry: "polygon" CoordinateSystemType: "geographic" GeographicCRS: [1×1 geocrs]
Display the AOI and the cities on a map.
geoplot(aoi) hold on geoplot(GT,"k.",MarkerSize=20)
Define Circular AOI from Point Shapes
Specify the projected coordinates for several places in Boston. Specify the projected CRS for the points as NAD83 / Massachusetts Mainland, which has the EPSG code 26986
.
x = [236266 235743 234685 232989 236536 234591 235741 237114 235741 236548]; y = [900974 900355 901429 901884 901901 901892 900663 900670 900725 899587]; pcrs = projcrs(26986);
Create a point shape object from the coordinates and projected CRS.
shape = mappointshape(x,y); shape.ProjectedCRS = pcrs;
When you pass projected coordinates to the aoicircle
function, you must specify the radius of each circle using the length unit of the projected CRS. Find the length unit. The result indicates that you must specify the radius in meters.
pcrs.LengthUnit
ans = "meter"
Create an AOI of circles from the point shape. 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.
aoi = aoicircle(shape,300)
aoi = mappolyshape with properties: NumRegions: 6 NumHoles: 0 Geometry: "polygon" CoordinateSystemType: "planar" ProjectedCRS: [1×1 projcrs]
Display the AOI and the places on a map.
geoplot(aoi) hold on geobasemap topographic geoplot(shape,".k",MarkerSize=10)
Export Circular AOI to Shapefile
Create a point shape in geographic coordinates that represents Paris, France. Specify the geographic CRS as the World Geodetic System of 1984, which has the EPSG code 4326
.
shape = geopointshape(48.86,2.35); shape.GeographicCRS = geocrs(4326);
Create an AOI from the point shape. Specify the radius as 0.5 degrees.
aoi = aoicircle(shape,0.5);
Create a geospatial table from the AOI. Then, export the geospatial table to a shapefile by using the shapewrite
function.
aoiGT = table(aoi,VariableName="Shape"); filename = "parisAOI.shp"; shapewrite(aoiGT,filename)
Read the shapefile into the workspace, and view the AOI.
GT = readgeotable(filename);
geobasemap topographic
geoplot(GT)
Input Arguments
lat
— Latitudes of center points in degrees
numeric array with elements in range [–90, 90]
Latitudes of the center points in degrees, specified as a numeric array with
elements in the range [–90, 90]. The sizes of lat
and
lon
must match.
lon
— Longitudes of center points in degrees
numeric array
Longitudes of the center points in degrees, specified as a numeric array. The
sizes of lat
and lon
must match.
radius
— Radius of circles
numeric scalar
Radius of the circles, specified as a numeric scalar.
The units you use to specify radius
and the way the
function interprets radius
depends on the type of coordinates
you use to specify the center points of the circles.
Type of Coordinates  Units  Interpretation 

Geographic coordinates  Specify 

Projected coordinates  Specify For
example, for a 

gcrs
— Geographic CRS of coordinates
geocrs
object
Geographic CRS of the coordinates, specified as a geocrs
object.
pcrs
— Projected CRS of coordinates
projcrs
object
Projected CRS of the coordinates, specified as a projcrs
object.
GT
— Geospatial table
geospatial table
Geospatial table. A geospatial table is a table
or timetable
object with a
Shape
variable that contains point, line, or polygon shapes.
For more information about geospatial tables, see Create Geospatial Tables.
The aoicircle
function requires the
Shape
variable to contain only geopointshape
or only mappointshape
objects. The ProjectedCRS
property
of mappointshape
objects must not be empty.
shape
— Point shapes
array of geopointshape
objects  array of mappointshape
objects
Point shapes, specified as one of these options:
An array of
geopointshape
objects — Point shapes in geographic coordinates.An array of
mappointshape
objects — Point shapes in projected coordinates. TheProjectedCRS
property of the objects must not be empty.
You can also specify this argument as a scalar point shape object.
Output Arguments
aoi
— AOI composed of circles
scalar geopolyshape
object  scalar mappolyshape
object
AOI composed of circles, returned as one of these options:
A scalar
geopolyshape
object, when you specify the input using geographic coordinates.A scalar
mappolyshape
object, when you specify the input using projected coordinates.
When you specify multiple center points, the AOI can contain multiple parts.
More About
Area of Interest
An area of interest (AOI) defines a focus
area for geospatial analysis and visualization. Mapping Toolbox™ represents AOIs using polygon shape objects. A scalar geopolyshape
object represents an AOI in geographic coordinates, and a scalar mappolyshape
object represents an AOI in projected coordinates.
Version History
Introduced in R2024b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)