worldFileMatrix
Return world file parameters for transformation
Syntax
Description
Examples
Create World File Matrix from a Planar Map Raster
Create a MapCellsReference
raster reference object.
xWorldLimits = [207000 208000]; yWorldLimits = [912500 913000]; rasterSize = [10 20]; R = maprefcells(xWorldLimits,yWorldLimits,rasterSize,'ColumnsStartFrom','north')
R = MapCellsReference with properties: XWorldLimits: [207000 208000] YWorldLimits: [912500 913000] RasterSize: [10 20] RasterInterpretation: 'cells' ColumnsStartFrom: 'north' RowsStartFrom: 'west' CellExtentInWorldX: 50 CellExtentInWorldY: 50 RasterExtentInWorldX: 1000 RasterExtentInWorldY: 500 XIntrinsicLimits: [0.5 20.5] YIntrinsicLimits: [0.5 10.5] TransformationType: 'rectilinear' CoordinateSystemType: 'planar' ProjectedCRS: []
Compute the world file matrix.
W = worldFileMatrix(R)
W = 2×3
50 0 207025
0 -50 912975
Observe that W(2,1)
and W(1,2)
are 0. This value is expected since R.TransformationType
is 'rectilinear'
.
Input Arguments
R
— Geographic or map raster
GeographicCellsReference
,
GeographicPostingsReference
,
MapCellsReference
, or
MapPostingsReference
object
Geographic or map raster, specified as a GeographicCellsReference
,
GeographicPostingsReference
,
MapCellsReference
, or MapPostingsReference
object.
Output Arguments
W
— World file matrix
2-by-3 numeric array
World file matrix, returned as a 2-by-3 numeric array. Each of the six
elements in W
matches one of the lines in a world file
corresponding to the transformation defined by raster referencing object
R
.
Data Types: double
More About
World File Matrix
A world file matrix maps points in intrinsic coordinates to points in geographic or planar world coordinates.
Given a world file matrix W of the form:
W = [A B C; D E F]
xw = A × ( xi - 1 ) + B × ( yi - 1 ) + C
yw = D × ( xi - 1 ) + E × ( yi - 1 ) + F.
More compactly:
[ xw yw ]′ = W × [ ( xi - 1 ) ( yi - 1 ) ].
Note
Similar equations hold true for points ( lat, lon ) in geographic coordinates. However, the geographic coordinate ordering is switched. That is, xw is substituted by lon, and yw is substituted by lat.
The −1
s are needed to maintain the Mapping Toolbox™ convention for intrinsic coordinates, which is consistent with the
1-based indexing used throughout MATLAB®.
W is stored in a world file with one term per line in column-major order: A, D, B, E, C, F. That is, a world file contains the elements of W in this order:
W(1,1) W(2,1) W(1,2) W(2,2) W(1,3) W(2,3)
The previous expressions hold for both affine and rectilinear transformations of rasters. The values B, D, W(2,1) and W(1,2) are identically 0 whenever:
R
is a geographic raster, since longitude depends only on intrinsic x and latitude depends only on intrinsic yR
is a map raster andR.TransformationType
is'rectilinear'
Version History
Introduced in R2013b
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)