geopointshape
R2026bPoint shape in geographic coordinates
Description
A geopointshape object represents a point or multipoint in
geographic coordinates. A multipoint is an individual point shape that
contains a set of point locations.
To represent a point or multipoint in planar coordinates, use a mappointshape object
instead.
Creation
To create geopointshape objects, either:
Import point data in geographic coordinates as a geospatial table using the
readgeotablefunction, and then query theShapevariable of the table.Use the
geopointshapefunction (described here).
Syntax
Description
shape = geopointshape(___,GeographicCRS=
specifies the geographic CRS for the points, in addition to any combination of input
arguments from previous syntaxes. (since R2026b)gcrs)
Input Arguments
Latitude coordinates, specified as a numeric array or a cell array of numeric arrays.
Create a point by specifying a scalar, such as
39.Create a multipoint by specifying an array within a cell, such as
{[38 -30 29]}.Create an array of points by specifying an array, such as
[38 -30 29].Create an array of points and multipoints by specifying a cell array of numeric arrays, such as
{39,[38 -30 29]}.
Create placeholders for points with missing data by including
NaN values. The NaN values in
lat must correspond to the NaN values in
lon.
The size of lat must match the size of
lon. For cell arrays, the size of the array in each cell of
lat must match the size of the array in the corresponding cell
of lon.
Data Types: double | cell
Longitude coordinates, specified as a numeric array or a cell array of numeric arrays.
Create a point by specifying a scalar, such as
-113.Create a multipoint by specifying an array within a cell, such as
{[-66 -31 42]}.Create an array of points by specifying an array, such as
[-66 -31 42].Create an array of points and multipoints by specifying a cell array of numeric arrays, such as
{-113,[-66 -31 42]}.
Create placeholders for points with missing data by including
NaN values. The NaN values in
lat must correspond to the NaN values in
lon.
The size of lat must match the size of
lon. For cell arrays, the size of the array in each cell of
lat must match the size of the array in the corresponding cell
of lon.
Data Types: double | cell
Since R2026b
Height coordinates, specified as a numeric array or a cell array of numeric arrays.
Create a 3-D point by specifying a scalar, such as
100.Create a 3-D multipoint by specifying an array within a cell, such as
{[100 200 300]}.Create an array of 3-D points by specifying an array, such as
[100 200 300].Create an array of 3-D points and multipoints by specifying a cell array of numeric arrays, such as
{100,[200 300 400]}.
Create placeholders for points with missing data by including
NaN values. The NaN values in
h must correspond to the NaN values in
lat and lon.
The size of h must match the size of lat
and lon. For cell arrays, the size of the array in each cell of
h must match the size of the array in the corresponding cell of
lat and lon.
Data Types: double | cell
Geographic coordinate reference system (CRS), specified as a geocrs
object.
Properties
This property is read-only.
Number of points, returned as an array of nonnegative integers.
For a scalar geopointshape object, the value of
NumPoints is 1 when the
geopointshape object represents a single point and more than
1 when the object represents a multipoint.
For an array of geopointshape objects, the size of
NumPoints matches the size of the array.
Data Types: double
Latitude coordinates, specified as an array.
For a scalar
geopointshapeobject, the size ofLatitudematches the value ofNumPoints.For an array of
geopointshapeobjects, the size ofLatitudematches the size ofNumPoints. If the array contains multipoints, then accessing theLatitudeproperty of the array is not supported. Instead, access theLatitudeproperty of individual objects within the array. You can determine whether the array contains multipoints by using theismultipointfunction.
This property is read-only for arrays when any element of
NumPoints is greater than 1.
Latitude and Longitude must be the same
size.
Data Types: double
Longitude coordinates, specified as an array.
For a scalar
geopointshapeobject, the size ofLongitudematches the value ofNumPoints.For an array of
geopointshapeobjects, the size ofLongitudematches the size ofNumPoints. If the array contains multipoints, then accessing theLongitudeproperty of the array is not supported. Instead, access theLongitudeproperty of individual objects within the array. You can determine whether the array contains multipoints by using theismultipointfunction.
This property is read-only for arrays when any element of
NumPoints is greater than 1.
Latitude and Longitude must be the same
size.
Data Types: double
Since R2026b
Height coordinates, specified as an array or an empty array ([]).
For a scalar
geopointshapeobject that represents a 3-D point, the size ofHeightmatches the value ofNumPoints.For an array of
geopointshapeobjects that represent 3-D points, the size ofHeightmatches the size ofNumPoints. If the array contains multipoints, then accessing theHeightproperty of the array is not supported. Instead, access theHeightproperty of individual objects within the array. You can determine whether the array contains multipoints by using theismultipointfunction.For
geopointshapeobjects that represent 2-D points, the value ofHeightis an empty array.
This property is read-only for arrays when any element of
NumPoints is greater than 1.
Height must be empty or be of the same size as
Latitude and Longitude.
Data Types: double
This property is read-only.
Geometric type, returned as "point".
Data Types: string
This property is read-only.
Coordinate system type, returned as "geographic".
Data Types: string
Geographic coordinate reference system (CRS), specified as a geocrs
object.
Object Functions
geoplot | Plot points, lines, and polygons on map |
bounds | Bounds of shape in geographic or planar coordinates |
ismultipoint | Determine which array elements are multipoint shapes |
Examples
Import a GPX file containing the coordinates of locations in Boston as a geospatial table. The GPX file represents the locations using points. Get information about the points by querying the Shape variable of the table.
GT = readgeotable("boston_placenames.gpx");
GT.Shapeans =
13×1 geopointshape array with properties:
NumPoints: [13×1 double]
Latitude: [13×1 double]
Longitude: [13×1 double]
Height: []
Geometry: "point"
CoordinateSystemType: "geographic"
GeographicCRS: [1×1 geocrs]
Display the locations on a road map by passing the geospatial table to the geoplot function.
figure geoplot(GT,"o",MarkerFaceColor="#0072BD") geobasemap streets

Create an individual point as a geopointshape scalar. Specify the geographic CRS as the World Geodetic System of 1984, which has the EPSG code 4326.
gcrs = geocrs(4326); point = geopointshape(39,-113,GeographicCRS=gcrs)
point =
geopointshape with properties:
NumPoints: 1
Latitude: 39
Longitude: -113
Height: []
Geometry: "point"
CoordinateSystemType: "geographic"
GeographicCRS: [1×1 geocrs]
Create a multipoint as a geopointshape scalar.
multipoint = geopointshape({[38 -30 29]},{[-66 -31 42]}, ...
GeographicCRS=gcrs)multipoint =
geopointshape with properties:
NumPoints: 3
Latitude: [38 -30 29]
Longitude: [-66 -31 42]
Height: []
Geometry: "point"
CoordinateSystemType: "geographic"
GeographicCRS: [1×1 geocrs]
Create three individual points as a 1-by-3 geopointshape vector.
pointVector = geopointshape([38 -20 29],[-66 -31 42], ...
GeographicCRS=gcrs)pointVector =
1×3 geopointshape array with properties:
NumPoints: [1 1 1]
Latitude: [38 -20 29]
Longitude: [-66 -31 42]
Height: []
Geometry: "point"
CoordinateSystemType: "geographic"
GeographicCRS: [1×1 geocrs]
Create one individual point and one multipoint as a 1-by-2 geopointshape vector.
pointMultipoint = geopointshape({39,[38 -30 29]},{-113,[-66 -31 42]}, ...
GeographicCRS=gcrs)pointMultipoint =
1×2 geopointshape array with properties:
NumPoints: [1 3]
Geometry: "point"
CoordinateSystemType: "geographic"
GeographicCRS: [1×1 geocrs]
Version History
Introduced in R2021bSpecify the geographic CRS of a geopointshape object during creation by
using the geocrs argument.
Use geopointshape objects to represent 3-D points. Create 3-D points
from coordinate data by specifying latitude, longitude, and height coordinates. Query or set
the height coordinates using the Height property.
When a point shape has missing coordinate data, its NumPoints
property has a value of 0 and its Latitude and
Longitude properties each have a value of NaN.
When you create a point by specifying both coordinates as
NaNvalues, itsNumPointsproperty has a value of0. In the previous release, the property had a value of1.When a point has no coordinate data, its
LatitudeandLongitudeproperties each have a value ofNaN. In the previous release, the properties were each emptydoublevalues.
These changes make it easier to create and access the properties of
geopointshape arrays when the input coordinates contain missing data. For
example, you can now access the coordinates of a geopointshape array when
the array contains a combination of points with coordinate data
(NumPoints is 1) and without coordinate data
(NumPoints is 0). In the previous release,
MATLAB® issued an error.
See Also
Functions
Objects
Topics
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)