worldfileread

Read world file and return referencing object or matrix

Syntax

R = worldfileread(worldFileName, coordinateSystemType, rasterSize)
refmat = worldileread(worldFileName)

Description

R = worldfileread(worldFileName, coordinateSystemType, rasterSize) reads the world file, worldFileName, and constructs a spatial referencing object, R. The type of referencing object is determined by the coordinateSystemType string, which can be either 'planar' (including projected map coordinate systems) or 'geographic' (for latitude-longitude systems). The rasterSize input should match the size of the image corresponding to the world file.

refmat = worldileread(worldFileName) reads the world file, worldFileName, and constructs a 3-by-2 referencing matrix, refmat.

Examples

Read an ortho image referenced to a projected coordinate system (Massachusetts State Plane Mainland).

filename = 'concord_ortho_w.tif';
[X, cmap] = imread(filename);
worldFileName = getworldfilename(filename);
R = worldfileread(worldFileName, 'planar', size(X))

Read an image referenced to a geographic coordinate system.

filename = 'boston_ovr.jpg';
RGB = imread(filename);
worldFileName = getworldfilename(filename);
R = worldfileread(worldFileName, 'geographic', size(RGB))
Was this topic helpful?