Main Content

worldfileread

Read world file and return reference object

Syntaxes of the worldfileread function that return referencing matrices have been removed. Use a syntax that returns a reference object instead. For more information, see Compatibility Considerations.

Description

example

R = worldfileread(worldFileName,coordinateSystemType,rasterSize) reads the world file, worldFileName, and constructs a spatial referencing object, R. The argument coordinateSystemType specifies the type of referencing object. rasterSize specifies the size of the image corresponding to the world file.

Examples

collapse all

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

filename = 'concord_ortho_w.tif';
[X, cmap] = imread(filename);

Derive world file name from image file name.

worldFileName = getworldfilename(filename);

Read the world file, returning a referencing object.

R = worldfileread(worldFileName, 'planar', size(X))
R = 
  MapCellsReference with properties:

            XWorldLimits: [207000 209000]
            YWorldLimits: [911000 913000]
              RasterSize: [2000 2000]
    RasterInterpretation: 'cells'
        ColumnsStartFrom: 'north'
           RowsStartFrom: 'west'
      CellExtentInWorldX: 1
      CellExtentInWorldY: 1
    RasterExtentInWorldX: 2000
    RasterExtentInWorldY: 2000
        XIntrinsicLimits: [0.5 2000.5]
        YIntrinsicLimits: [0.5 2000.5]
      TransformationType: 'rectilinear'
    CoordinateSystemType: 'planar'
            ProjectedCRS: []


Read image reference to a geographic coordinate system.

filename = 'boston_ovr.jpg';
RGB = imread(filename);

Derive world file name from image file name,

worldFileName = getworldfilename(filename);

Read world file, returning a referencing object.

R = worldfileread(worldFileName, 'geographic', size(RGB))
R = 
  GeographicCellsReference with properties:

             LatitudeLimits: [42.3052018188767 42.4165064733949]
            LongitudeLimits: [-71.1308390797572 -70.9898400731705]
                 RasterSize: [769 722]
       RasterInterpretation: 'cells'
           ColumnsStartFrom: 'north'
              RowsStartFrom: 'west'
       CellExtentInLatitude: 0.000144739472715501
      CellExtentInLongitude: 0.000195289482807142
     RasterExtentInLatitude: 0.11130465451822
    RasterExtentInLongitude: 0.140999006586757
           XIntrinsicLimits: [0.5 722.5]
           YIntrinsicLimits: [0.5 769.5]
       CoordinateSystemType: 'geographic'
              GeographicCRS: []
                  AngleUnit: 'degree'


Input Arguments

collapse all

Name of world file, specified as a character vector.

Example: worldFileName = getworldfilename(filename);

Data Types: char

Type of referencing object, specified as one of the following:

ValueDescription
'geographic'Latitude-longitude systems
'planar'Projected map coordinate systems

Example: R = worldfileread(worldFileName, 'geographic', size(RGB));

Data Types: char

Size of the image corresponding to the world file, specified as a two-element vector, [m n], where m is the number of rows in the image and n is the number of columns in the image.

Example: size(I)

Data Types: double

Output Arguments

collapse all

Spatial referencing object, returned as a raster reference object.

Version History

Introduced before R2006a

expand all