Interact with Geographic Axes - MATLAB & Simulink (original) (raw)

Main Content

This topic describes how to explore geographic axes and charts, how to interactively find the latitude-longitude coordinates of locations on maps, and how to interactively select the locations for text on maps.

Explore Geographic Axes and Charts

You can explore geographic axes and charts by panning and zooming. Panning and zooming can improve the visual display of your data or reveal additional information about your data.

For more information about controlling the interactivity of axes, see Control Chart Interactivity.

Geographic axes and charts use a Web Mercator projection. As a result:

Mapping Toolbox™ enables you to display data using other types of projections. For more information about creating map displays using Mapping Toolbox, see Choose a 2-D Map Display (Mapping Toolbox).

Interactively Identify Geographic Coordinates

Interactively find the latitude-longitude coordinates of locations on a map by using geographic axes and the ginput function.

Create a map of Australia that uses the grayland basemap.

figure geobasemap grayland geolimits([-46 -6],[98 170])

Identify the coordinates of four locations.

interactivelySelectLocations = false; if interactivelySelectLocations [lat,lon] = ginput(4); else lat = [-34 -38 -27.5 -32]; lon = [151 145 153 116]; end

Display the locations on the map. Preserve the geographic limits by setting the hold state to on.

hold on geoscatter(lat,lon,"filled")

Interactively Display Text

Interactively select the locations for text on a map by using geographic axes and the gtext function.

Create a new map of Australia that uses the grayland basemap.

figure geobasemap grayland geolimits([-46 -6],[98 170])

Label Sydney, Melbourne, Brisbane, and Perth by displaying text on the map.

txt = ["Sydney"; "Melbourne"; "Brisbane"; "Perth"]; interactivelySelectLocations = false; if interactivelySelectLocations gtext(txt) else lat = [-34 -38 -27.5 -32]; lon = [151 145 153 116]; text(lat,lon,txt) end

See Also

Functions

Properties