Skip to main content
`Ctrl`+`K`

# RasterReader

This class offer static methods to load raster data: - read raster from ascii files, - get DTM data from IGN web services.

class tracklib.io.RasterReader.RasterReader
  static readMetadataFromAscFile(path, name='')
  static readFromAscFile(path, name='')

    Read grid data from an ASCII file. The first six lines of the file indicate the reference of the grid, followed by the values listed in the order they would appear (left to right and top to bottom). Where:

    > - ncols is the numbers of rows (represented as integers)

    > - nrows is the numbers of rows (represented as integers)

    > - Lower-left corner refers to a cell corner, and not to a data point

    > - xllcorner and yllcorner are the western (left) X coordinate and southern (bottom) Y coordinates, such as easting and northing (represented as real numbers with an optional decimal point)

    > - xllcorner and yllcorner are the X and Y coordinates for the lower left corner of the lower left grid cell. Some ESRI raster files use xllcenter and yllcenter instead for the XY reference point, which indicate the X and Y coordinates for the center of the lower left grid cell. These values are represented as real numbers with an optional decimal point

    > - cellsize is the length of one side of a square cell (a real number)

    > - nodata_value is the value that is regarded as “missing” or “not applicable”; this line is optional, but highly recommended as some programs expect this line to be declared (a real number)

    ## Example

        raster = RasterReader.readFromAscFile('data/asc/RGEALTI_0930_6415_LAMB93_IGN69.asc')
        grid = raster.getRasterBand(1)
        self.assertEqual(1000, grid.nrow)

    ### Parameters

    pathstr

      chemin du fichier.

    name: str

      nom de la band du raster, par exemple ‘speed#avg’

    ### Returns

    Raster

      DESCRIPTION.