This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Set or query geographic limits


[latitudeLimits,longitudeLimits] = geolimits
[latitudeLimits,longitudeLimits] = geolimits(___)
___ = geolimits(gx,___)



geolimits(latlim,lonlim) adjusts the geographic limits of the current geographic axes or chart to include latitudes ranging from latlim(1) to latlim(2) and longitudes from lonlim(1) to lonlim(2). If there is no current geographic axes or chart, geolimits constructs a default GeographicAxes and sets its limits.


[latitudeLimits,longitudeLimits] = geolimits returns the latitude limits and longitude limits of the current geographic axes or chart.

geolimits('auto') lets the geographic axes or chart choose its geographic limits based on its data locations.

geolimits('manual') requests that the axes or chart preserve its current limits as closely as possible when the map is resized or when its data locations change.

[latitudeLimits,longitudeLimits] = geolimits(___) adjusts the geographic limits and returns the actual limits of the map.


Typically, the actual limits chosen by geolimits are greater in extent than the requested limits because geolimits manages the limits to maintain a correct north-south/east-west aspect.

___ = geolimits(gx,___) operates on the geographic axes or chart specified by gx.


collapse all

Read tsunami data from a spreadsheet into a table.

tsunamis = readtable('tsunamis.xlsx');

Get the latitude and longitude data from the table. This data specifies the locations of the tsunamis. In addition, get data about the size of the tsunami from the table.

lat = tsunamis.Latitude;
lon = tsunamis.Longitude;
sizedata = tsunamis.MaxHeight;

Create a geographic bubble chart with the tsunami data. The example sets the title of the size legend.

gb = geobubble(lat,lon,sizedata,'SizeLegendTitle','Maximum Height');

Get the current geographic limits of the chart. By default, geobubble sets the map limits large enough to encompass all the locations in the data.

[latlim, lonlim] = geolimits
latlim = 1×2

  -86.4016   86.4016

lonlim = 1×2

 -295.8338   37.8079

Modify the geographic limits to get a closer look at tsunami activity in Alaska. The example also specifies a title for the geographic bubble chart.

geolimits([50 65],[-175 -130])
gb.Title = 'Tsunamis in Alaska'

gb = 
  GeographicBubbleChart with properties:

          Basemap: 'darkwater'
        MapLayout: 'normal'
     LatitudeData: [162x1 double]
    LongitudeData: [162x1 double]
         SizeData: [162x1 double]
        ColorData: []

  Show all properties

Get the actual geographic limits used by the chart. Due to zoom level quantization and aspect ratio preservation, the actual limits may differ from the requested limits.

[latlim, lonlim] = geolimits
latlim = 1×2

   41.2573   69.8011

lonlim = 1×2

 -175.0000 -130.0000

Input Arguments

collapse all

Limits of the geographic axes or chart in latitude, specified as a two-element vector.

Example: [50 65]

Data Types: single | double

Limits of the geographic axes or chart in longitude, specified as a two-element vector.

Example: [-175 -130]

Data Types: single | double

Geographic axes or chart, specified as a GeographicAxes object or GeographicBubbleChart object.

Output Arguments

collapse all

Actual latitude limits of map, returned as two-element vector.

Actual longitude limits of map, returned as two-element vector.

Introduced in R2017b