about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/gis
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/gis')
-rw-r--r--nixpkgs/pkgs/applications/gis/grass/default.nix108
-rw-r--r--nixpkgs/pkgs/applications/gis/grass/no_symbolic_links.patch37
-rw-r--r--nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix62
-rw-r--r--nixpkgs/pkgs/applications/gis/qgis/default.nix27
-rw-r--r--nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix57
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/clang_patch.patch19
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/default.nix32
-rw-r--r--nixpkgs/pkgs/applications/gis/saga/finite.patch13
-rw-r--r--nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix27
9 files changed, 382 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..8734fabfdcf9
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/grass/default.nix
@@ -0,0 +1,108 @@
+{ stdenv, fetchFromGitHub, flex, bison, pkgconfig, zlib, libtiff, libpng, fftw
+, cairo, readline, ffmpeg, makeWrapper, wxGTK30, netcdf, blas
+, proj, gdal, geos, sqlite, postgresql, libmysqlclient, python2Packages, libLAS, proj-datumgrid
+}:
+
+stdenv.mkDerivation rec {
+  name = "grass";
+  version = "7.6.1";
+
+  src = with stdenv.lib; fetchFromGitHub {
+    owner = "OSGeo";
+    repo = "grass";
+    rev = "${name}_${replaceStrings ["."] ["_"] version}";
+    sha256 = "1amjk9rz7vw5ha7nyl5j2bfwj5if9w62nlwx5qbp1x7spldimlll";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ flex bison zlib proj gdal libtiff libpng fftw sqlite cairo proj
+  readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql libmysqlclient blas
+  libLAS proj-datumgrid ]
+    ++ (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 ];
+
+  # Correct mysql_config query
+  patchPhase = ''
+      substituteInPlace configure --replace "--libmysqld-libs" "--libs"
+  '';
+
+  configureFlags = [
+    "--with-proj-share=${proj}/share/proj"
+    "--with-proj-includes=${proj.dev}/include"
+    "--with-proj-lib=${proj}/lib"
+    "--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=${libmysqlclient}/include/mysql"
+    "--with-mysql-libs=${libmysqlclient}/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.drain/r.drain.py \
+      scripts/r.pack/r.pack.py \
+      scripts/r.tileset/r.tileset.py \
+      scripts/r.unpack/r.unpack.py \
+      scripts/v.clip/v.clip.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
+  '';
+
+  NIX_CFLAGS_COMPILE = "-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1";
+
+  postInstall = ''
+    wrapProgram $out/bin/grass76 \
+    --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 = https://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..21d16282edcb
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/openorienteering-mapper/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, fetchFromGitHub, gdal, cmake, ninja, proj, clipper, zlib, qtbase, qttools
+, qtlocation, qtsensors, doxygen, cups, wrapQtAppsHook, qtimageformats
+}:
+
+stdenv.mkDerivation rec {
+  pname = "OpenOrienteering-Mapper";
+  version = "0.9.1";
+
+  buildInputs = [ gdal qtbase qttools qtlocation qtimageformats
+                  qtsensors clipper zlib proj doxygen cups];
+
+  nativeBuildInputs = [ cmake wrapQtAppsHook ninja ];
+
+  src = fetchFromGitHub {
+    owner = "OpenOrienteering";
+    repo = "mapper";
+    rev = "v${version}";
+    sha256 = "1fyhvf2y89hj7wj89kxccx3dqcja6ndy3w4rx1vmzrp246jpz7wb";
+  };
+
+  cmakeFlags =
+    [
+    # 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"."
+    wrapQtApp $out/Mapper.app/Contents/MacOS/Mapper
+    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 sikmir ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/gis/qgis/default.nix b/nixpkgs/pkgs/applications/gis/qgis/default.nix
new file mode 100644
index 000000000000..f272fd04dd0d
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/qgis/default.nix
@@ -0,0 +1,27 @@
+{ lib, makeWrapper, symlinkJoin
+, qgis-unwrapped, extraPythonPackages ? (ps: [ ])
+}:
+with lib;
+symlinkJoin rec {
+  inherit (qgis-unwrapped) version;
+  name = "qgis-${version}";
+
+  paths = [ qgis-unwrapped ];
+
+  nativeBuildInputs = [ makeWrapper qgis-unwrapped.python3Packages.wrapPython ];
+
+  # extend to add to the python environment of QGIS without rebuilding QGIS application.
+  pythonInputs = qgis-unwrapped.pythonBuildInputs ++ (extraPythonPackages qgis-unwrapped.python3Packages);
+
+  postBuild = ''
+    # unpackPhase
+
+    buildPythonPath "$pythonInputs"
+
+    wrapProgram $out/bin/qgis \
+      --prefix PATH : $program_PATH \
+      --set PYTHONPATH $program_PYTHONPATH
+  '';
+
+  meta = qgis-unwrapped.meta;
+}
diff --git a/nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix b/nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix
new file mode 100644
index 000000000000..de436088fa76
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/qgis/unwrapped.nix
@@ -0,0 +1,57 @@
+{ mkDerivation, lib, fetchFromGitHub, cmake, ninja, flex, bison, proj, geos, xlibsWrapper, sqlite, gsl
+, qwt, fcgi, python3Packages, libspatialindex, libspatialite, postgresql
+, txt2tags, openssl, libzip, hdf5, netcdf, exiv2
+, qtbase, qtwebkit, qtsensors, qca-qt5, qtkeychain, qscintilla, qtserialport, qtxmlpatterns
+, withGrass ? true, grass
+}:
+with lib;
+let
+  pythonBuildInputs = with python3Packages;
+    [ qscintilla-qt5 gdal jinja2 numpy psycopg2
+      chardet dateutil pyyaml pytz requests urllib3 pygments pyqt5 sip owslib six ];
+in mkDerivation rec {
+  version = "3.10.1";
+  pname = "qgis";
+  name = "${pname}-unwrapped-${version}";
+
+  src = fetchFromGitHub {
+    owner = "qgis";
+    repo = "QGIS";
+    rev = "final-${lib.replaceStrings ["."] ["_"] version}";
+    sha256 = "0xq0nnp7zdqaihqvh5rsi1129g23vnk5ijkpxfzaggafgmhf5hgz";
+  };
+
+  passthru = {
+    inherit pythonBuildInputs;
+    inherit python3Packages;
+  };
+
+  buildInputs = [ openssl proj geos xlibsWrapper sqlite gsl qwt exiv2
+    fcgi libspatialindex libspatialite postgresql txt2tags libzip hdf5 netcdf
+    qtbase qtwebkit qtsensors qca-qt5 qtkeychain qscintilla qtserialport qtxmlpatterns] ++
+    (lib.optional withGrass grass) ++ pythonBuildInputs;
+
+  nativeBuildInputs = [ cmake flex bison ninja ];
+
+  # Force this pyqt_sip_dir variable to point to the sip dir in PyQt5
+  #
+  # TODO: Correct PyQt5 to provide the expected directory and fix
+  # build to use PYQT5_SIP_DIR consistently.
+  postPatch = ''
+     substituteInPlace cmake/FindPyQt5.py \
+       --replace 'sip_dir = cfg.default_sip_dir' 'sip_dir = "${python3Packages.pyqt5}/share/sip/PyQt5"'
+   '';
+
+  cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF"
+                 "-DPYQT5_SIP_DIR=${python3Packages.pyqt5}/share/sip/PyQt5"
+                 "-DQSCI_SIP_DIR=${python3Packages.qscintilla-qt5}/share/sip/PyQt5" ] ++
+                 lib.optional withGrass "-DGRASS_PREFIX7=${grass}/${grass.name}";
+
+  meta = {
+    description = "A Free and Open Source Geographic Information System";
+    homepage = http://www.qgis.org;
+    license = lib.licenses.gpl2Plus;
+    platforms = with lib.platforms; linux;
+    maintainers = with lib.maintainers; [ lsix ];
+  };
+}
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..90e7af9944d3
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/saga/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, gdal, wxGTK30, proj, libiodbc, lzma,
+  libharu, opencv, vigra, postgresql, Cocoa,
+  unixODBC , poppler, hdf4, hdf5, netcdf, sqlite, qhull, giflib }:
+
+stdenv.mkDerivation {
+  pname = "saga";
+  version = "7.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
+                  qhull giflib ]
+                ++ stdenv.lib.optionals stdenv.isDarwin
+                  [ Cocoa unixODBC poppler hdf4.out hdf5 netcdf sqlite ];
+
+  enableParallelBuilding = true;
+
+  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11 -Wno-narrowing";
+
+  src = fetchurl {
+    url = "https://sourceforge.net/projects/saga-gis/files/SAGA%20-%207/SAGA%20-%207.3.0/saga-7.3.0.tar.gz";
+    sha256 = "1g7v6vx7b8mfhbbg03pdk4kyks20maqbcdbasnxazhs8pl2zih7k";
+  };
+
+  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.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/whitebox-tools/default.nix b/nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix
new file mode 100644
index 000000000000..84d7f3ddb499
--- /dev/null
+++ b/nixpkgs/pkgs/applications/gis/whitebox-tools/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, rustPlatform , fetchFromGitHub, Security }:
+rustPlatform.buildRustPackage rec {
+  pname = "whitebox_tools";
+  version = "0.16.0";
+
+  src = fetchFromGitHub {
+    owner = "jblindsay";
+    repo = "whitebox-tools";
+    rev = "v${version}";
+    sha256 = "1vs4hf2x3qjnffs9kjx56rzl67kpcy8xvng6p0r9fp9mfnblxg6j";
+  };
+
+  buildInputs = stdenv.lib.optional stdenv.isDarwin Security;
+
+  cargoSha256 = "1y3vk8bzsaisx7wrncjxcqdh355f2wk4n59vq5qgj37fph2zpy7f";
+
+  # failures: structures::polyline::test::test_polyline_split
+  doCheck = false;
+
+  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;
+  };
+}