Main Content

Navigate a Web Map

Web maps created using the webmap function are interactive. View a portion of the map in more detail by using the zoom control or scroll wheel. Move the map in any direction by using the pan tool or arrow keys, or clicking and dragging the mouse. Alternatively, you can position the map programmatically using the wmzoom, wmlimits, and wmcenter functions.

For example, open a web map using the webmap function. By default, webmap displays the entire map, scaled to fit the window and centered at latitude and longitude [0 0]. This image shows the pan tool outlined in red and the zoom tool outlined in blue. Use the tools to center the map on Brazil.

webmap

Web map centered on Brazil

You can perform the same navigation programmatically. For example, open a web map that is centered on Brazil using the wmcenter function. Specify the latitude and longitude of the center point and the zoom level as arguments.

wmcenter(-15.6000,-56.1003,4)

You can also customize your view of a web map by specifying the latitude and longitude limits. For example, retrieve the current latitude and longitude limits using the wmlimits function. Depending on the size of the web map, your limits may be different.

[latlim,lonlim] = wmlimits 
latlim =

  -36.5081    7.6476


lonlim =

  -88.7077  -23.4929

You can then open a new web map, specifying these latitude and longitude limits using the wmlimits function.

wmlimits(latlim,lonlim) 

The displayed limits may not match the specified limits because the zoom level is quantized to discrete integer values and the longitude limits may be constrained.

See Also

| | |

Related Topics