| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Mapping Toolbox |
| Contents | Index |
| Learn more about Mapping Toolbox |
[latTrimmed,lonTrimmed] = maptrimp(lat,lon,latlim,lonlim)
[latTrimmed,lonTrimmed] = maptrimp(lat,lon,latlim,lonlim) trims the polygons in lat and lon to the quadrangle specified by latlim and lonlim. latlim and lonlim are two-element vectors, defining the latitude and longitude limits respectively. lat and lon must be vectors that represent valid polygons.
maptrimp conditions the longitude limits such that:
lonlim(2) always exceeds lonlim(1)
lonlim(2) never exceeds lonlim(1) by more than 360
lonlim(1) < 180 or lonlim(2) > -180
Should the quadrangle span the Greenwich meridian, then that meridian appears at longitude = 0.
Display a world map of coastline data, trim the dataset to a specific geographic area, and display a map of this trimmed data.
coast = load('coast.mat');
figure
mapshow(coast.long, coast.lat, 'DisplayType', 'polygon');
Original Map

latlim = [-50 50]; lonlim = [-100 50]; [latTrimmed, lonTrimmed] = maptrimp(coast.lat, coast.long, ... latlim, lonlim); figure mapshow(lonTrimmed, latTrimmed, 'DisplayType', 'polygon');
Map with Trimmed Data

![]() | maptriml | maptrims | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |