Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

boundImageSize

Bound size of raster map

Syntax

mapBound = boundImageSize(mapRequest,imageLength)

Description

example

mapBound = boundImageSize(mapRequest,imageLength) sets the bounds of the raster map mapRequest based on imageLength, the length in pixels for the row (ImageHeight) or column (ImageWidth) dimension.

Examples

collapse all

Read the VMAP0 basic layer for the entire globe.

vmap0 = wmsfind('vmap0.tiles','SearchField','serverurl');
vmap0 = wmsupdate(vmap0);
layer = refine(vmap0,'basic');
request = WMSMapRequest(layer);
request.Transparent = true;
imageLength = 720;
request = boundImageSize(request,imageLength);
globalImage = getMap(request.Server, request.RequestURL);

Display the map. The rendered map has a spatial resolution of 0.5 degrees per cell and an image size of 360-by-720 pixels.

figure; worldmap('world')
geoshow(globalImage, request.RasterReference);
title(['VMAP0 ' layer.LayerTitle ' Layer'])

Read and display multiple layers centered around London. The rendered map has a spatial extent of 0.5 degrees and an image size of 1024-by-1024 pixels

vmap0 = wmsfind('vmap0.tiles','SearchField','serverurl');
vmap0 = wmsupdate(vmap0);
layers = [ refine(vmap0, 'rail'); refine(vmap0, 'river'); ...
       refine(vmap0, 'priroad'); refine(vmap0, 'secroad'); ...
       refine(vmap0, 'ctylabel'); refine(vmap0, 'basic')];
request = WMSMapRequest(layers);
cities = shaperead('worldcities', 'UseGeo', true);
london = cities(strcmpi('London', {cities.Name}));
extent = [-.25 .25];
request.Latlim = london.Lat + extent;
request.Lonlim = london.Lon + extent;
 
request.Transparent = true;
imageLength = 1024;
request = boundImageSize(request,imageLength);
londonImage = getMap(request.Server,request.RequestURL);

Display the map. The rendered map has a spatial extent of 0.5 degrees and an image size of 1024-by-1024 pixels

figure
worldmap(londonImage,request.RasterReference)
geoshow(londonImage,request.RasterReference)
title({'Region Surrounding London, England', ...
   ['with Primary and Secondary Roads, ', ...
    'Rivers, Rails, City Label, and Basic Layers']})

Input Arguments

collapse all

Original Web map service map, specified as a WMSMapRequest object.

Row or column length of input WMS map, specified as a positive scalar. imageLength indicates the length in pixels for the row (ImageHeight) or column (ImageWidth) dimension.

Example: 720

Data Types: double

Output Arguments

collapse all

Bound Web map service map, returned as a WMSMapRequest object.

Algorithms

The boundImageSize function calculates the row or column dimension length by using the aspect ratio of the Latlim and Lonlim properties or the aspect ratio of the XLim and YLim properties of , if they are set.

boundImageSize measures image dimensions in geographic or map coordinates. The function sets the longest image dimension to imageLength, and the shortest to the nearest integer value that preserves the aspect ratio, without changing the coordinate limits. The maximum value of the MaximumHeight and MaximumWidth properties becomes the maximum value of imageLength.

Introduced in R2009b

Was this topic helpful?