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 Version History.

Description

R = worldfileread(worldFileName,coordinateSystemType,rasterSize) creates a raster reference object R from the world file worldFileName. The argument coordinateSystemType specifies the type of reference object. The rasterSize argument specifies the size of the image that is associated with the world file.

example

Examples

collapse all

Read an orthophoto referenced to a projected coordinate system into the workspace.

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

Get the name of the world file from the name of the image file.

worldFileName = getworldfilename(filename);

Create a reference object for the orthophoto by reading the world file.

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 an image referenced to a geographic coordinate system into the workspace.

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

Get the name of the world file from the name of the image file.

worldFileName = getworldfilename(filename);

Create a reference object for the orthophoto by reading the world file.

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 the world file, specified as a string scalar or a character vector.

Data Types: char | string

Type of coordinate system, specified as one of the following:

  • "geographic" — Geographic coordinate system. This option creates a GeographicCellsReference object.

  • "planar" — Planar map coordinate system. This option creates a MapCellsReference object.

Size of the image that is associated with 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.

Data Types: double

Output Arguments

collapse all

Raster reference object, returned as a GeographicCellsReference or MapCellsReference object. The raster reference associates each element of the image with a location in geographic or planar coordinates.

Version History

Introduced before R2006a

expand all