Compute Map Limits for Regular Data Grids

The latitude and longitude limits of a regular grid are among the most important properties of its referencing object. Given an older data grid that includes a referencing vector but not a referencing object, a good way to check the limits is to convert the referencing vector to a geographic raster reference object, as in the following simple exercise:

  1. Load the Korea 5-arc-minute elevation grid and inspect the referencing vector, refvec:

    korea = load('korea','map','refvec')
    
    korea = 
    
           map: [180x240 double]
        refvec: [12 45 115]
    

    The referencing vector, korea.refvec, indicates that there are 12 cells per angular degree. This horizontal resolution is 5 times finer than that of the topo grid, which is one cell per degree. It also indicates that the northwest corner is at 45 degrees North, 115 degrees East, but it needs to be combined with the size of the data grid before the southern and eastern limits can be determined.

  2. Convert the referencing vector to a geographic raster reference object (providing a size vector):

    korea.R = refvecToGeoRasterReference(korea.refvec, ...
       size(korea.map))
    
    korea = 
    
           map: [180x240 double]
        refvec: [12 45 115]
             R: [1x1 map.rasterref.GeographicCellsReference]
    
  3. Examine the Latlim and Lonlim properties:

    korea.R.LatitudeLimits
    korea.R.LongitudeLimits
    
    ans =
    
        30    45
    
    
    ans =
    
       115   135