filterm
Filter latitudes and longitudes based on underlying data grid
Description
Examples
Filter Elevation Data
Display points along the equator that are above sea level.
First, load elevation raster data and a geographic cells reference object. The raster contains terrain heights relative to mean sea level. Then, specify the coordinates of evenly spaced points along the equator.
load topo60c
lon = (0:5:360)';
lat = zeros(size(lon));
Create a logical array representing the terrain above sea level. Then, filter the points along the equator to include only the elements that contain true
.
topoASL = topo60c > 0; [newlat,newlon] = filterm(lat,lon,topoASL,topo60cR,1);
Create a map axes object for the world and display the elevation data. Display the all of the points along the equator using red markers. Then, display the points that are above sea level using yellow circles.
worldmap world geoshow(topo60c,topo60cR,'DisplayType','texturemap') demcmap(topo60c) geoshow(lat,lon,'DisplayType','point','MarkerEdgeColor','r') geoshow(newlat,newlon,'DisplayType','point','Marker','o',... 'MarkerFaceColor','y')
Input Arguments
lat
— Latitude values
numeric array
Latitude values, specified as a numeric array.
Data Types: single
| double
lon
— Longitude values
numeric array
Longitude values, specified as a numeric array.
Data Types: single
| double
Z
— Filter
numeric array
Filter, specified as a numeric array.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
R
— Spatial referencing information
geographic raster reference object | referencing vector | referencing matrix
Spatial referencing information, specified as a geographic raster reference object, a referencing vector, or a referencing matrix.
If R
is a geographic raster reference object,
its RasterSize
property must be consistent with size(Z)
.
If R
is a referencing vector, it must be
a 1-by-3 with elements:
[cells/degree northern_latitude_limit western_longitude_limit]
If R
is a referencing matrix, it must be
3-by-2 and transform raster row and column indices to or from geographic
coordinates according to:
[lon lat] = [row col 1] * R
If R
is a referencing matrix, it must define
a (non-rotational, non-skewed) relationship in which each column of
the data grid falls along a meridian and each row falls along a parallel.
Nearest-neighbor interpolation is used by default. NaN is returned
for points outside the grid limits or for which lat
or lon
contain
NaN. All angles are in units of degrees.
Data Types: double
allowed
— Allowed values
numeric array or character vector
Allowed values, specified as a numeric array or character vector.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
| char
Output Arguments
latout
— Latitudes of filtered points
numeric array
Latitudes of filtered points, returned as a numeric array.
lonout
— Longitudes of filtered points
numeric array
Longitudes of filtered points, returned as a numeric array.
indx
— Indices of filtered points
numeric array
Indices of filtered points, returned as a numeric array.
Version History
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)