about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/gis
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/applications/gis
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/applications/gis')
-rw-r--r--nixpkgs/pkgs/applications/gis/grass/default.nix93
-rw-r--r--nixpkgs/pkgs/applications/gis/grass/no_symbolic_links.patch37
-rw-r--r--nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix68
-rw-r--r--nixpkgs/pkgs/applications/gis/qgis/default.nix93
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/clang_patch.patch19
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/default.nix33
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/finite-6.3.0.patch55
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/finite.patch13
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/lts.nix36
-rw-r--r--nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix24
10 files changed, 471 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/gis/grass/default.nix b/nixpkgs/pkgs/applications/gis/grass/default.nix
new file mode 100644
index 000000000000..a64e9a18e1ad
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/grass/default.nix
@@ -0,0 +1,93 @@
+{ stdenv, fetchurl, flex, bison, pkgconfig, zlib, libtiff, libpng, fftw
+, cairo, readline, ffmpeg, makeWrapper, wxGTK30, netcdf, blas
+, proj, gdal, geos, sqlite, postgresql, mysql, python2Packages, libLAS
+}:
+
+stdenv.mkDerivation {
+  name = "grass-7.2.2";
+  src = fetchurl {
+    url = https://grass.osgeo.org/grass72/source/grass-7.2.2.tar.gz;
+    sha256 = "0yzljbrxlqp4wbw08n1dvmm4vmwkg8glf1ff4xyh589r5ryb7gxv";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ flex bison zlib proj gdal libtiff libpng fftw sqlite cairo
+  readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql mysql.connector-c blas
+  libLAS ]
+    ++ (with python2Packages; [ python dateutil wxPython30 numpy ]);
+
+  # On Darwin the installer tries to symlink the help files into a system
+  # directory
+  patches = [ ./no_symbolic_links.patch ];
+
+  configureFlags = [
+    "--with-proj-share=${proj}/share/proj"
+    "--without-opengl"
+    "--with-readline"
+    "--with-wxwidgets"
+    "--with-netcdf"
+    "--with-geos"
+    "--with-postgres"
+    "--with-postgres-libs=${postgresql.lib}/lib/"
+    # it complains about missing libmysqld but doesn't really seem to need it
+    "--with-mysql"
+    "--with-mysql-includes=${mysql.connector-c}/include/mysql"
+    "--with-mysql-libs=${mysql.connector-c}/lib/mysql"
+    "--with-blas"
+    "--with-liblas=${libLAS}/bin/liblas-config"
+  ];
+
+  # Otherwise a very confusing "Can't load GDAL library" error
+  makeFlags = stdenv.lib.optional stdenv.isDarwin "GDAL_DYNAMIC=";
+
+  /* Ensures that the python script run at build time are actually executable;
+   * otherwise, patchShebangs ignores them.  */
+  postConfigure = ''
+    chmod +x scripts/d.out.file/d.out.file.py \
+      scripts/d.to.rast/d.to.rast.py \
+      scripts/d.what.rast/d.what.rast.py \
+      scripts/d.what.vect/d.what.vect.py \
+      scripts/g.extension/g.extension.py \
+      scripts/g.extension.all/g.extension.all.py \
+      scripts/r.pack/r.pack.py \
+      scripts/r.tileset/r.tileset.py \
+      scripts/r.unpack/r.unpack.py \
+      scripts/v.rast.stats/v.rast.stats.py \
+      scripts/v.to.lines/v.to.lines.py \
+      scripts/v.what.strds/v.what.strds.py \
+      scripts/v.unpack/v.unpack.py \
+      scripts/wxpyimgview/*.py \
+      gui/wxpython/animation/g.gui.animation.py \
+      gui/wxpython/datacatalog/g.gui.datacatalog.py \
+      gui/wxpython/rlisetup/g.gui.rlisetup.py \
+      gui/wxpython/vdigit/g.gui.vdigit.py \
+      temporal/t.rast.accumulate/t.rast.accumulate.py \
+      temporal/t.rast.accdetect/t.rast.accdetect.py \
+      temporal/t.rast.algebra/t.rast.algebra.py \
+      temporal/t.rast3d.algebra/t.rast3d.algebra.py \
+      temporal/t.vect.algebra/t.vect.algebra.py \
+      temporal/t.select/t.select.py
+    for d in gui lib scripts temporal tools; do
+      patchShebangs $d
+    done
+  '';
+
+  postInstall = ''
+    wrapProgram $out/bin/grass72 \
+    --set PYTHONPATH $PYTHONPATH \
+    --set GRASS_PYTHON ${python2Packages.python}/bin/${python2Packages.python.executable} \
+    --suffix LD_LIBRARY_PATH ':' '${gdal}/lib'
+    ln -s $out/grass-*/lib $out/lib
+    ln -s $out/grass-*/include $out/include
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = http://grass.osgeo.org/;
+    description = "GIS software suite used for geospatial data management and analysis, image processing, graphics and maps production, spatial modeling, and visualization";
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = stdenv.lib.platforms.all;
+    maintainers = with stdenv.lib.maintainers; [mpickering];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/grass/no_symbolic_links.patch b/nixpkgs/pkgs/applications/gis/grass/no_symbolic_links.patch
new file mode 100644
index 000000000000..ef09b97b7037
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/grass/no_symbolic_links.patch
@@ -0,0 +1,37 @@
+diff --git a/include/Make/Install.make b/include/Make/Install.make
+index 0aba138..8ba74bc 100644
+--- a/include/Make/Install.make
++++ b/include/Make/Install.make
+@@ -116,11 +116,6 @@ real-install: | $(INST_DIR) $(UNIX_BIN)
+ 	-$(INSTALL) config.status $(INST_DIR)/config.status
+ 	-$(CHMOD) -R a+rX $(INST_DIR) 2>/dev/null
+ 
+-ifneq ($(findstring darwin,$(ARCH)),)
+-	@# enable OSX Help Viewer
+-	@/bin/ln -sfh "$(INST_DIR)/docs/html" /Library/Documentation/Help/GRASS-$(GRASS_VERSION_MAJOR).$(GRASS_VERSION_MINOR)
+-endif
+-
+ $(INST_DIR) $(UNIX_BIN):
+ 	$(MAKE_DIR_CMD) $@
+ 
+diff --git a/macosx/app/build_html_user_index.sh b/macosx/app/build_html_user_index.sh
+index 04e63eb..c9d9c2c 100755
+--- a/macosx/app/build_html_user_index.sh
++++ b/macosx/app/build_html_user_index.sh
+@@ -140,7 +140,6 @@ else
+ #      echo "<tr><td valign=\"top\"><a href=\"$HTMLDIRG/$i\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> $FULLINDEX
+       # make them local to user to simplify page links
+       echo "<tr><td valign=\"top\"><a href=\"global_$i\">$BASENAME</a></td> <td>$SHORTDESC</td></tr>" >> $FULLINDEX
+-      ln -sf "$HTMLDIRG/$i" global_$i
+     done
+   done
+ fi
+@@ -183,8 +182,3 @@ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
+ </html>" > $i.html
+ done
+ 
+-# add Help Viewer links in user docs folder
+-
+-mkdir -p $HOME/Library/Documentation/Help/
+-ln -sfh ../../GRASS/$GRASS_MMVER/Modules/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER-addon
+-ln -sfh $GISBASE/docs/html $HOME/Library/Documentation/Help/GRASS-$GRASS_MMVER
diff --git a/nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix b/nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix
new file mode 100644
index 000000000000..3517351090d7
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix
@@ -0,0 +1,68 @@
+{ stdenv, fetchFromGitHub, gdal, cmake, ninja, proj, clipper, zlib, qtbase, qttools
+  , qtlocation, qtsensors, doxygen, cups, makeWrapper, qtimageformats
+}:
+
+stdenv.mkDerivation rec {
+  name = "OpenOrienteering-Mapper-${version}";
+  version = "0.8.3";
+
+  buildInputs = [ gdal qtbase qttools qtlocation qtimageformats
+                  qtsensors clipper zlib proj doxygen cups];
+
+  nativeBuildInputs = [ cmake makeWrapper ninja ];
+
+  src = fetchFromGitHub {
+    owner = "OpenOrienteering";
+    repo = "mapper";
+    rev = "v${version}";
+    sha256 = "0pnqwvmg97mgc2ci3abmx07l0njxcrbljh75w8ym31g0jq76pgr9";
+  };
+
+  cmakeFlags =
+    [
+    # Required by the build to be specified
+    "-DPROJ4_ROOT=${proj}"
+
+    # Building the manual and bundling licenses fails
+    "-DLICENSING_PROVIDER:BOOL=OFF"
+    "-DMapper_MANUAL_QTHELP:BOOL=OFF"
+    ] ++
+    (stdenv.lib.optionals stdenv.isDarwin
+    [
+    # Usually enabled on Darwin
+    "-DCMAKE_FIND_FRAMEWORK=never"
+    # FindGDAL is broken and always finds /Library/Framework unless this is
+    # specified
+    "-DGDAL_INCLUDE_DIR=${gdal}/include"
+    "-DGDAL_CONFIG=${gdal}/bin/gdal-config"
+    "-DGDAL_LIBRARY=${gdal}/lib/libgdal.dylib"
+    # Don't bundle libraries
+    "-DMapper_PACKAGE_PROJ=0"
+    "-DMapper_PACKAGE_QT=0"
+    "-DMapper_PACKAGE_ASSISTANT=0"
+    "-DMapper_PACKAGE_GDAL=0"
+    ]);
+
+
+  postInstall =
+    stdenv.lib.optionalString stdenv.isDarwin ''
+    # Fixes "This application failed to start because it could not find or load the Qt
+    # platform plugin "cocoa"."
+    wrapProgram $out/Mapper.app/Contents/MacOS/Mapper \
+      --set QT_QPA_PLATFORM_PLUGIN_PATH ${qtbase.bin}/lib/qt-*/plugins/platforms \
+      --set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}:${qtimageformats}/${qtbase.qtPluginPrefix}
+    mkdir -p $out/bin
+    ln -s $out/Mapper.app/Contents/MacOS/Mapper $out/bin/mapper
+    '';
+
+  meta = with stdenv.lib; {
+    description = ''
+      OpenOrienteering Mapper is an orienteering mapmaking program
+      and provides a free alternative to the existing proprietary solution.
+    '';
+    homepage = https://www.openorienteering.org/apps/mapper/;
+    license = licenses.gpl3;
+    platforms = with platforms; linux ++ darwin;
+    maintainers = with maintainers; [mpickering];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/qgis/default.nix b/nixpkgs/pkgs/applications/gis/qgis/default.nix
new file mode 100644
index 000000000000..b98d048d0343
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/qgis/default.nix
@@ -0,0 +1,93 @@
+{ stdenv, fetchurl, fetchpatch, gdal, cmake, qt4, flex, bison, proj, geos, xlibsWrapper, sqlite, gsl
+, qwt, fcgi, python2Packages, libspatialindex, libspatialite, qscintilla, postgresql, makeWrapper
+, qjson, qca2, txt2tags, openssl, darwin, pkgconfig
+, withGrass ? true, grass, saga, IOKit, ApplicationServices
+}:
+
+stdenv.mkDerivation rec {
+  name = "qgis-2.18.22";
+
+  buildInputs = [ gdal qt4 flex openssl bison proj geos xlibsWrapper sqlite gsl qwt qscintilla
+    fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags pkgconfig
+    saga ]
+  ++
+    (stdenv.lib.optionals stdenv.isDarwin [IOKit ApplicationServices])
+  ++
+    (stdenv.lib.optional withGrass grass) ++
+    (stdenv.lib.optional (stdenv.isDarwin && withGrass) darwin.apple_sdk.libs.utmp) ++
+    (with python2Packages; [ jinja2 numpy psycopg2 pygments requests python2Packages.qscintilla sip ]);
+
+  nativeBuildInputs = [ cmake makeWrapper pkgconfig ];
+
+  # `make -f src/providers/wms/CMakeFiles/wmsprovider_a.dir/build.make src/providers/wms/CMakeFiles/wmsprovider_a.dir/qgswmssourceselect.cpp.o`:
+  # fatal error: ui_qgsdelimitedtextsourceselectbase.h: No such file or directory
+  enableParallelBuilding = false;
+
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libspatialindex)"
+  '';
+
+  # To handle the lack of 'local' RPATH; required, as they call one of
+  # their built binaries requiring their libs, in the build process.
+  preBuild = ''
+    export LD_LIBRARY_PATH=`pwd`/output/lib:${stdenv.lib.makeLibraryPath [ openssl ]}:$LD_LIBRARY_PATH
+  '';
+
+  src = fetchurl {
+    url = "https://qgis.org/downloads/${name}.tar.bz2";
+    sha256 = "00b3a2hfn3i7bdx7x96vz2nj0976vpkhid4ss7n8c33fdvw3k82a";
+  };
+
+  patches = [
+    # https://github.com/qgis/QGIS/pull/7765
+    (fetchpatch {
+      url = "https://github.com/qgis/QGIS/commit/6b61ef361a77f057dc29eb07463007bd9012b253.patch";
+      sha256 = "1xibcahm18n7nxff1xvwwzjf505hvhiw5dk12is7aclv49h0rdf7";
+    })
+  ];
+
+  # CMAKE_FIND_FRAMEWORK=never stops the installer choosing system
+  # installed frameworks
+  # QGIS_MACAPP_BUNDLE=0 stops the installer copying the Qt binaries into the
+  # installation which causes havoc
+  # Building RelWithDebInfo allows QGIS_DEBUG to print debugging information
+  cmakeFlags = stdenv.lib.optional withGrass "-DGRASS_PREFIX7=${grass}/${grass.name}"
+               ++ stdenv.lib.optional stdenv.isDarwin
+                    (["-DCMAKE_FIND_FRAMEWORK=never"]
+                      ++ ["-DQGIS_MACAPP_BUNDLE=0"]);
+#                     ++ ["-DCMAKE_BUILD_TYPE=RelWithDebInfo"];
+
+
+
+  postInstall =
+    (stdenv.lib.optionalString stdenv.isLinux ''
+          wrapProgram $out/bin/qgis \
+            --set PYTHONPATH $PYTHONPATH \
+            --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ openssl ]}
+          '') +
+    (stdenv.lib.optionalString stdenv.isDarwin ''
+      # Necessary for QGIS to find the correct default GRASS path
+      # Plugins look for gdal tools like deminfo on the PATH
+      ${stdenv.lib.optionalString withGrass "ln -sf ${grass} $out/QGIS.app/Contents/MacOS/grass"}
+      # Necessary for QGIS to find the right SAGA installation
+      ln -sf ${saga}/bin/saga_cmd $out/QGIS.app/Contents/MacOS/bin/saga_cmd
+      for file in $(find $out -type f -name "QGIS"); do
+        wrapProgram "$file" \
+          --prefix DYLD_LIBRARY_PATH : "${qwt}/lib" \
+          --prefix DYLD_LIBRARY_PATH : "${qscintilla}/lib" \
+          --prefix PATH : "${gdal}/bin" \
+          ${stdenv.lib.optionalString withGrass "--prefix PATH : ${grass}/bin"} \
+          --set PYTHONPATH $PYTHONPATH
+      done
+      mkdir -p $out/bin
+      ln -s $out/QGIS.app/Contents/MacOS/QGIS $out/bin/qgis
+      '');
+
+  meta = {
+    description = "User friendly Open Source Geographic Information System";
+    homepage = http://www.qgis.org;
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = with stdenv.lib.platforms; unix;
+    maintainers = with stdenv.lib.maintainers; [mpickering];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/saga/clang_patch.patch b/nixpkgs/pkgs/applications/gis/saga/clang_patch.patch
new file mode 100644
index 000000000000..e6af8d130514
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/saga/clang_patch.patch
@@ -0,0 +1,19 @@
+commit e92b250968e9656084ab5984689747ca615ff6e7
+Author: Volker Wichmann <wichmann@laserdata.at>
+Date:   Sun Mar 5 13:49:53 2017 +0100
+
+    saga_api, CSG_Table::Del_Records(): bug fix, check record count correctly
+
+diff --git a/src/saga_core/saga_api/table.cpp b/src/saga_core/saga_api/table.cpp
+index 76a1d8d..fa1a66f 100644
+--- a/src/saga_core/saga_api/table.cpp
++++ b/src/saga_core/saga_api/table.cpp
+@@ -901,7 +901,7 @@ bool CSG_Table::Del_Record(int iRecord)
+ //---------------------------------------------------------
+ bool CSG_Table::Del_Records(void)
+ {
+-	if( m_Records > 0 )
++	if( m_nRecords > 0 )
+ 	{
+ 		_Index_Destroy();
+
diff --git a/nixpkgs/pkgs/applications/gis/saga/default.nix b/nixpkgs/pkgs/applications/gis/saga/default.nix
new file mode 100644
index 000000000000..4738bfba14a8
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/saga/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma, jasper,
+  libharu, opencv, vigra, postgresql, Cocoa,
+  unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }:
+
+stdenv.mkDerivation rec {
+  name = "saga-6.3.0";
+
+  # See https://groups.google.com/forum/#!topic/nix-devel/h_vSzEJAPXs
+  # for why the have additional buildInputs on darwin
+  buildInputs = [ gdal wxGTK30 proj libharu opencv vigra postgresql libiodbc lzma
+                  jasper qhull giflib ]
+                ++ stdenv.lib.optionals stdenv.isDarwin
+                  [ Cocoa unixODBC poppler hdf4.out hdf5 netcdf sqlite ];
+
+  enableParallelBuilding = true;
+
+  patches = [ ./finite-6.3.0.patch];
+
+  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/saga-gis/SAGA%20-%206/SAGA%20-%206.3.0/saga-6.3.0.tar.gz";
+    sha256 = "0hyjim8fcp3mna1hig22nnn4ki3j6b7096am2amcs99sdr09jjxv";
+  };
+
+  meta = with stdenv.lib; {
+    description = "System for Automated Geoscientific Analyses";
+    homepage = http://www.saga-gis.org;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ michelk mpickering ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/saga/finite-6.3.0.patch b/nixpkgs/pkgs/applications/gis/saga/finite-6.3.0.patch
new file mode 100644
index 000000000000..91c9543edfda
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/saga/finite-6.3.0.patch
@@ -0,0 +1,55 @@
+diff --git a/src/tools/imagery/imagery_maxent/me.cpp b/src/tools/imagery/imagery_maxent/me.cpp
+index c5da854..d3e9cff 100755
+--- a/src/tools/imagery/imagery_maxent/me.cpp
++++ b/src/tools/imagery/imagery_maxent/me.cpp
+@@ -21,7 +21,7 @@
+ #ifdef _SAGA_MSW
+ #define isinf(x) (!_finite(x))
+ #else
+-#define isinf(x) (!finite(x))
++#define isinf(x) (!isfinite(x))
+ #endif
+ 
+ /** The input array contains a set of log probabilities lp1, lp2, lp3
+@@ -47,7 +47,7 @@ double sumLogProb(vector<double>& logprobs)
+ /** returns log (e^logprob1 + e^logprob2). */
+ double sumLogProb(double logprob1, double logprob2)
+ {
+-  if (isinf(logprob1) && isinf(logprob2)) 
++  if (isinf(logprob1) && isinf(logprob2))
+     return logprob1; // both prob1 and prob2 are 0, return log 0.
+   if (logprob1>logprob2)
+     return logprob1+log(1+exp(logprob2-logprob1));
+@@ -70,8 +70,8 @@ void MaxEntModel::print(ostream& ostrm, MaxEntTrainer& trainer)
+   for (FtMap::iterator it = _index.begin(); it!=_index.end(); it++) {
+     unsigned long i = it->second;
+     for (unsigned long c = 0; c<_classes; c++) {
+-      ostrm << "lambda(" << trainer.className(c) << ", " 
+-	    << trainer.getStr(it->first) << ")=" 
++      ostrm << "lambda(" << trainer.className(c) << ", "
++	    << trainer.getStr(it->first) << ")="
+ 	    << _lambda[i+c] << endl;
+     }
+   }
+@@ -86,7 +86,7 @@ int MaxEntModel::getProbs(MaxEntEvent& event, vector<double>& probs)
+     double s = 0;
+     for (unsigned int f = 0; f<event.size(); f++) {
+       FtMap::iterator it = _index.find(event[f]);
+-      if (it!=_index.end()) 
++      if (it!=_index.end())
+ 	s += _lambda[it->second+c];
+     }
+     probs[c] = s;
+@@ -142,10 +142,10 @@ double MaxEntModel::getObsCounts(EventSet& events, vector<double>& obsCounts)
+     double ftSum = 0;
+     for (unsigned long j=0; j<e.size(); j++) {
+       FtMap::iterator it = _index.find(e[j]);
+-      if (it!=_index.end()) 
++      if (it!=_index.end())
+ 	obsCounts[it->second+c] += count;
+       else { // new feature, need to expand obsCounts and _lambda
+-	for (unsigned int k = 0; k<_classes; k++) 
++	for (unsigned int k = 0; k<_classes; k++)
+ 	  obsCounts.push_back(0);
+ 	obsCounts[_lambda.size()+c] += count;
+ 	addFeature(e[j]);
diff --git a/nixpkgs/pkgs/applications/gis/saga/finite.patch b/nixpkgs/pkgs/applications/gis/saga/finite.patch
new file mode 100644
index 000000000000..7f60743534bd
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/saga/finite.patch
@@ -0,0 +1,13 @@
+diff --git a/saga-gis/src/modules/imagery/imagery_maxent/me.cpp b/saga-gis/src/modules/imagery/imagery_maxent/me.cpp
+index c5da854..d3e9cff 100755
+--- a/src/modules/imagery/imagery_maxent/me.cpp
++++ b/src/modules/imagery/imagery_maxent/me.cpp
+@@ -21,7 +21,7 @@
+ #ifdef _SAGA_MSW
+ #define isinf(x) (!_finite(x))
+ #else
+-#define isinf(x) (!finite(x))
++#define isinf(x) (!isfinite(x))
+ #endif
+
+ /** The input array contains a set of log probabilities lp1, lp2, lp3
diff --git a/nixpkgs/pkgs/applications/gis/saga/lts.nix b/nixpkgs/pkgs/applications/gis/saga/lts.nix
new file mode 100644
index 000000000000..ca0034aa9708
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/saga/lts.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchgit, gdal, wxGTK30, proj, libiodbc, lzma, jasper,
+  libharu, opencv, vigra, postgresql, autoreconfHook, Cocoa
+  , unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }:
+
+stdenv.mkDerivation rec {
+  name = "saga-2.3.2";
+
+  # See https://groups.google.com/forum/#!topic/nix-devel/h_vSzEJAPXs
+  # for why the have additional buildInputs on darwin
+  buildInputs = [ autoreconfHook gdal wxGTK30 proj libharu opencv vigra
+                  postgresql libiodbc lzma jasper
+                  unixODBC poppler hdf4.out hdf5 netcdf sqlite qhull giflib ]
+                ++ stdenv.lib.optional stdenv.isDarwin Cocoa ;
+
+  enableParallelBuilding = true;
+
+  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing";
+
+  sourceRoot = "code-b6f474f/saga-gis";
+
+  patches = [ ./clang_patch.patch ./finite.patch];
+
+  src = fetchgit {
+    url = "https://git.code.sf.net/p/saga-gis/code.git";
+    rev = "b6f474f8af4af7f0ff82548cc6f88c53547d91f5";
+    sha256 = "0iakynai8mhcwj6wxvafkqhd7b417ss7hyhbcp9wf6092l6vc2zd";
+  };
+
+  meta = with stdenv.lib; {
+    description = "System for Automated Geoscientific Analyses";
+    homepage = http://www.saga-gis.org;
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.mpickering ];
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix b/nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix
new file mode 100644
index 000000000000..f6adf7857ede
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, rustPlatform , fetchFromGitHub, Security }:
+rustPlatform.buildRustPackage rec {
+  name = "whitebox_tools-${version}";
+  version = "0.9.0";
+
+  src = fetchFromGitHub {
+    owner = "jblindsay";
+    repo = "whitebox-tools";
+    rev = "6221cdf327be70f0ee4f2053b76bfa01c3f37caa";
+    sha256 = "1423ga964mz7qkl88vkcm8qfprsksx04aq4sz9v5ghnmdzzvl89x";
+  };
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
+
+  cargoSha256 = "1gbgirng21ak0kl3fiyr6lxwzrjd5v79gcrbzf941nb8y8rlvz7k";
+
+  meta = with stdenv.lib; {
+    description = "An advanced geospatial data analysis platform";
+    homepage = http://www.uoguelph.ca/~hydrogeo/WhiteboxTools/index.html;
+    license = licenses.mit;
+    maintainers = [ maintainers.mpickering ];
+    platforms = platforms.all;
+  };
+}