Happy! SWAT Team Accept my Revision for SWAT Codes

Nancy¬†Sammons, a member of SWAT team, sent me e-mail to info me that the revision¬†Kerem and I working on has been emerged in to the latest version of SWAT, ver 614. This revision origin from Kerem’s finding that ET would be greater than PET in some cases. And etact.f is modified to prevent this happen. Very happy to see everyone could contribute to SWAT. Feel good!

Compile GDAL in Visual Studio

GDAL is default compiled with makefile. All the source codes are compiled and the lib file is very big.

GDAL supports many raster and vector formats. Most of the formats are not usually used. In VS, we can just compile the formats we will use. This will make the library file smaller.

Except the format-related source files, all other files should be added to project.

We just need to read asc and tif files, so we just add aaigrid and gtiff in frmts to project. Because img file (hfa) is used to generate overview image, so hfa in frmts is also added to project. We don’t need to read vector files, so we don’t add any vector format under ogr/ogrsf_frmts.


General -> Character Set -> Use Multi-Byte Character Set

C/C++ -> General -> Additional Include Directories

Register drivers for selected rater formats

It’s done in function GDALAllRegister of frmts/gdalallregister.cpp. Macro is used to control which drivers are needed to be registered. We just need two formats, so add FRMT_gtiff and FRMT_aaigrid to C/C++ -> Preprocessor -> Preprocessor Definitions to register drivers for these two formats.

It’s done. If new formats are needed, we just need to copy corresponding source files in to frmts, add preprocessor definition for them and compile the project again.

The procedure of change grid format in MapWindow

MapWindow can change grid format. It’s fast. So, I’m curious how it’s complemented.

Based on the latest source code, following procedure is found.

The GisToolsPlugin add items to toolbox. When user double-clicks specific item, this plugin responds correspondingly. For “change grid formats”, the function mnuChangeGridFormats in Module GisTools is called. After user sets all the options in frmOutput window, the function in class MapWinGeoProc.DataManagement is called. In this function, the class grid in COM library MapWinGIS is used to do the real job.

It seems that the source code of MapWinGIS is not the latest one. It may use GDAL to change grid format now.

GDAL in MapWindow

GDAL is used in MapWinGIS. Following classes use GDAL.

  1. tkGridRaster: Generic grid wrapper class to allow MapWinGIs to utilize formats supported by GDAL
  2. tkRaster: tkRaster.h/cpp
  3. CUtils: Utils.h/cpp
  4. CGrid: Grid.h/cpp
  5. CImageClass: image.h/cpp, uses tkRaster