CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
gis_utils.cpp File Reference

Various GIS-related functions, requires GDAL. More...

#include <assert.h>
#include <iostream>
#include <cmath>
#include <cfloat>
#include <gdal_priv.h>
#include <ogrsf_frmts.h>
#include "cme.h"
#include "simulation.h"
#include "coast.h"
#include "raster_grid.h"

Go to the source code of this file.

Detailed Description

Various GIS-related functions, requires GDAL.

Note re. coordinate systems used

  1. In the raster CRS, cell[0][0] is at the top left (NW) corner of the grid. Raster grid co-oordinate [0][0] is actually the top left (NW) corner of this cell.
  2. We assume that the grid CRS and external CRS have parallel axes. If they have not, see http://www.gdal.org/classGDALDataset.html which says that:

    To convert between pixel/line (P,L) raster space, and projection coordinates (Xp,Yp) space Xp = padfTransform[0] + padfTransform[1] + padfTransform[2]; Yp = padfTransform[3] + padfTransform[4] + padfTransform[5];

    In a north-up image, padfTransform[1] is the pixel width, and padfTransform[5] is the pixel height. The upper left corner of the upper left pixel is at position (padfTransform[0], padfTransform[3]).

  3. Usually, raster grid CRS values are integer, i.e. they refer to a point which is at the centroid of a cell. They may also be -ve or greater than m_nXGridSize-1 i.e. may refer to a point which lies outside any cell of the raster grid.

    Author
    David Favis-Mortlock
    Andres Payo
    Date
    2025

Definition in file gis_utils.cpp.