Documentation Center

  • Trial Software
  • Product Updates

geoquadpt

Geographic quadrangle bounding scattered points

Syntax

  • [latlim,lonlim] = geoquadpt(lat,lon) example

Description

example

[latlim,lonlim] = geoquadpt(lat,lon) returns the limits of the tightest possible geographic quadrangle that bounds a set of points with geographic coordinates lat and lon.

In most cases, tf = ingeoquad(lat,lon,latlim,lonlim) will return true, but tf may be false for points on the edges of the quadrangle, due to round off. tf will also be false for elements of lat that fall outside the interval [-90 90] and elements of lon that are not finite.

Examples

expand all

Bounding Quadrangle Including Tokyo and Honolulu.

In this case the output quadrangle straddles the 180-degree meridian, hence the elements of lonlim are in descending numerical order, although they are ordered from west to east.

Read a set of points and then create a bounding box around the points.

cities = shaperead('worldcities.shp','Selector',{@(name) any(strcmp(name,{'Tokyo','Honolulu'})),'Name'}, 'UseGeoCoords',true);
[latlim,lonlim] = geoquadpt([cities.Lat],[cities.Lon])
latlim =

   21.3178   35.7082


lonlim =

  139.6401 -157.8291

Input Arguments

expand all

lat — Point latitudesvector | matrix | N-D array

Point latitudes, specified as a vector, matrix, or N-D array, in units of degrees.

Data Types: single | double

lon — Point longitudesvector | matrix | N-D array

Point longitudes, specified as a vector, matrix, or N-D array, in units of degrees.

Data Types: single | double

Output Arguments

expand all

latlim — Latitude limits1–by-2 vector

Latitude limits of a geographic quadrangle, returned as a 1-by-2 vector of the form [southern_limit northern_limit], in units of degrees. The elements are in ascending order, and both lie in the closed interval [-90 90].

lonlim — Latitude limits1–by-2 vector

Longitude limits of a geographic quadrangle, returned as a 1-by-2 vector of the form [western_limit eastern_limit], in units of degrees. The limits are wrapped to the interval [-180 180]. They are not necessarily in numerical ascending order.

See Also

| | |

Was this topic helpful?