1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
3 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
4 ;;; Copyright © 2017, 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
7 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
8 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages geo)
26 #:use-module (guix build-system glib-or-gtk)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system python)
29 #:use-module (guix build-system scons)
30 #:use-module (guix build-system r)
31 #:use-module (guix download)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (guix utils)
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages databases)
39 #:use-module (gnu packages fontutils)
40 #:use-module (gnu packages cran)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages gnome)
43 #:use-module (gnu packages gtk)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages icu4c)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages statistics)
49 #:use-module (gnu packages web)
50 #:use-module (gnu packages webkit)
51 #:use-module (gnu packages wxwidgets)
52 #:use-module (gnu packages xml))
60 (uri (string-append "http://download.osgeo.org/geos/geos-"
65 "0ak5szby29l9l0vy43dm5z2g92xzdky20q1gc1kah1fnhkgi6nh4"))))
66 (build-system gnu-build-system)
68 (modify-phases %standard-phases
70 'unpack 'patch-test-shebangs
72 (substitute* '("tests/xmltester/testrunner.sh"
73 "tests/geostest/testrunner.sh")
74 (("/bin/sh") (which "sh")))
78 (home-page "https://geos.osgeo.org/")
79 (synopsis "Geometry Engine for Geographic Information Systems")
81 "GEOS provides a spatial object model and fundamental geometric
82 functions. It is a C++ port of the Java Topology Suite (JTS). As such,
83 it aims to contain the complete functionality of JTS in C++. This
84 includes all the OpenGIS Simple Features for SQL spatial predicate
85 functions and spatial operators, as well as specific JTS enhanced
87 (license (list license:lgpl2.1+ ; Main distribution.
88 license:zlib ; tests/xmltester/tinyxml/*
89 license:public-domain)))) ; include/geos/timeval.h
91 (define-public gnome-maps
97 (uri (string-append "mirror://gnome/sources/" name "/"
98 (version-major+minor version) "/"
99 name "-" version ".tar.xz"))
102 "0l40l7m9dyphvasiq1jxrn6ivavs1xwzn0bzz2x1z7x73955q783"))))
103 (build-system glib-or-gtk-build-system)
105 `(#:configure-flags ;; Ensure that geoclue is referred to by output.
106 (list (string-append "LDFLAGS=-L"
107 (assoc-ref %build-inputs "geoclue") "/lib")
108 (string-append "CFLAGS=-I"
109 (assoc-ref %build-inputs "geoclue") "/include"))
111 (modify-phases %standard-phases
112 (add-after 'install 'wrap
113 (lambda* (#:key inputs outputs #:allow-other-keys)
114 (let ((out (assoc-ref outputs "out"))
115 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
116 (goa-path (string-append
117 (assoc-ref inputs "gnome-online-accounts")
119 (webkitgtk-path (string-append
120 (assoc-ref inputs "webkitgtk")
122 (wrap-program (string-append out "/bin/gnome-maps")
123 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
125 ;; There seems to be no way to embed the path of
126 ;; libgoa-1.0.so.0, libwebkit2gtk-4.0.so.37 and
127 ;; libjavascriptcoregtk-4.0.so.18.
128 `("LD_LIBRARY_PATH" ":" prefix (,goa-path ,webkitgtk-path)))
131 `(("gobject-introspection" ,gobject-introspection)
132 ("intltool" ,intltool)
133 ("pkg-config" ,pkg-config)))
136 ("libchamplain" ,libchamplain)
138 ("libsecret" ,libsecret)
140 ("libgweather" ,libgweather)
142 ("gdk-pixbuf" ,gdk-pixbuf)
143 ("glib-networking" ,glib-networking)
145 ("geocode-glib" ,geocode-glib)
146 ("gfbgraph" ,gfbgraph)
149 ("gnome-online-accounts" ,gnome-online-accounts)
150 ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
152 ("webkitgtk" ,webkitgtk)))
155 (synopsis "Graphical map viewer and wayfinding program")
156 (description "GNOME Maps is a graphical map viewer. It uses map data from
157 the OpenStreetMap project. It can provide directions for walking, bicycling,
159 (home-page "https://wiki.gnome.org/Apps/Maps")
160 (license license:gpl2+)))
162 (define-public libgaiagraphics
164 (name "libgaiagraphics")
169 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libgaiagraphics-"
173 "076afqv417ag3hfvnif0qc7qscmnq1dsf6y431yygwgf34rjkayc"))))
174 (build-system gnu-build-system)
176 `(("pkg-config" ,pkg-config)))
180 ("libjepeg-turbo" ,libjpeg-turbo)
182 ("libgeotiff" ,libgeotiff)
186 (synopsis "Gaia common graphics support")
187 (description "libgaiagraphics is a library supporting
188 common-utility raster handling methods.")
189 (home-page "https://www.gaia-gis.it/fossil/libgaiagraphics/index")
190 (license license:lgpl3+)))
192 (define-public libgeotiff
199 (uri (string-append "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-"
203 "0vjy3bwfhljjx66p9w999i4mdhsf7vjshx29yc3pn5livf5091xd"))
204 (modules '((guix build utils)))
207 ;; Remove .csv files, distributed from EPSG under a restricted
208 ;; license. See LICENSE for full license text.
209 (for-each delete-file (find-files "." "\\.csv$"))
210 ;; Now that we have removed the csv files, we need to modify the Makefile.
211 (substitute* "Makefile.in"
213 "all-am: Makefile $(LTLIBRARIES) $(HEADERS) geo_config.h\n")
214 (("^install-data-am: .*$")
215 "install-data-am: install-includeHEADERS"))
217 (build-system gnu-build-system)
219 `(("libjpeg-turbo" ,libjpeg-turbo)
225 (list (string-append "--with-zlib")
226 (string-append "--with-jpeg")
227 (string-append "--with-libtiff=" (assoc-ref %build-inputs "libtiff")))))
228 (synopsis "Library for handling GeoTIFF (geographic enabled TIFF)")
229 (description "libgeotiff is a library on top of libtiff for reading and
230 writing GeoTIFF information tags.")
231 (home-page "https://trac.osgeo.org/geotiff/")
232 ;; This is a mixture of various contributions under different licenses.
233 ;; Note that the EPSG database is NOT "free to use" as the LICENSE file
234 ;; states, as its commercial redistribution is restricted. Hence, we have
235 ;; removed it from the package.
236 (license (list license:public-domain
239 (license:non-copyleft "file://LICENSE"
240 "See LICENSE in the distribution.")))))
242 (define-public libspatialite
244 (name "libspatialite")
249 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libspatialite-"
253 "16d4lpl7xrm9zy4gphy6nwanpjp8wn9g4wq2i2kh8abnlhq01448"))))
254 (build-system gnu-build-system)
256 `(("pkg-config" ,pkg-config)))
266 (modify-phases %standard-phases
267 ;; 3 tests are failing, ignore them:
268 (add-after 'unpack 'ignore-broken-tests
270 (substitute* '("test/Makefile.in")
271 (("\tcheck_sql_stm.*" all) "\tcheck_multithread$(EXEEXT) \\\n")
272 (("(\tch.*) check_v.*ble2.*$" all vt1) (string-append vt1 " \\\n"))
273 (("\tch.* (check_v.*ble4.*)$" all vt4) (string-append "\t" vt4)))
275 (synopsis "Extend SQLite to support Spatial SQL capabilities")
277 "SpatiaLite is a library intended to extend the SQLite core to support
278 fully fledged Spatial SQL capabilities.")
279 (home-page "https://www.gaia-gis.it/fossil/libspatialite/index")
280 ;; For the genuine libspatialite-sources holds:
281 ;; Any of the licenses MPL1.1, GPL2+ or LGPL2.1+ may be picked.
282 ;; Files under src/control_points are from GRASS
283 ;; and are licensed under GPL2+ only.
284 ;; src/md5.[ch]: Placed into the public domain by Alexander Peslyak.
285 (license (list license:gpl2+
288 license:public-domain))))
290 (define-public proj.4
296 (uri (string-append "http://download.osgeo.org/proj/proj-"
300 "1xw5f427xk9p2nbsj04j6m5zyjlyd66sbvl2bkg8hd1kx8pm9139"))))
301 (build-system gnu-build-system)
304 (modify-phases %standard-phases
305 (add-after 'unpack 'patch-test-paths
307 (substitute* '("nad/test27"
313 (("/bin/rm") (which "rm")))
315 ;; Precision problems on i686 and other platforms. See:
316 ;; https://web.archive.org/web/20151006134301/http://trac.osgeo.org/proj/ticket/255
317 ;; Disable failing test.
318 (add-after 'patch-test-paths 'ignore-failing-tests
320 (substitute* '("nad/Makefile.in")
321 (("\tPROJ_LIB.*" all) (string-append "#" all)))
325 (home-page "http://proj4.org/")
326 (synopsis "Cartographic Projections Library")
328 "Proj.4 is a library for converting coordinates between cartographic
330 (license (list license:expat
331 ;; src/PJ_patterson.c
335 ;; Embedded EPSG database.
336 (license:non-copyleft "http://www.epsg.org/TermsOfUse")
340 (define-public mapnik
347 (uri (string-append "https://github.com/mapnik/mapnik/releases/download/v"
348 version "/mapnik-v" version ".tar.bz2"))
351 "06frcikaj2mgz3abfk5h0z4j3hbksi0zikwjngbjv4p5f3pwxf8q"))))
352 (build-system scons-build-system)
356 ("freetype" ,freetype)
357 ("harfbuzz" ,harfbuzz)
359 ("libjpeg-turbo" ,libjpeg-turbo)
368 `(("pkg-config" ,pkg-config)))
370 `(#:scons ,scons-python2
373 (string-append "PREFIX=" %output)
374 (string-append "CUSTOM_LDFLAGS=-Wl,-rpath=" %output "/lib"))))
375 (home-page "http://mapnik.org/")
376 (synopsis "Toolkit for developing mapping applications")
377 (description "Mapnik is a toolkit for developing mapping applications. It
378 is basically a collection of geographic objects like maps, layers,
379 datasources, features, and geometries. At its core is a C++ shared library
380 providing algorithms and patterns for spatial data access and visualization.
381 The library does not rely on any specific windowing system and can be deployed
382 to any server environment. It is intended to play fair in a multi-threaded
383 environment and is aimed primarily, but not exclusively, at web-based
385 (license (list license:lgpl2.1+
386 ;; demo/viewer, demo/python/rundemo.py
388 ;; deps/boost, deps/mapbox, deps/agg/include/agg_conv_offset.h
390 ;; deps/mapnik/sparsehash
393 (license:non-copyleft "file://deps/agg/copying")))))
395 (define-public python2-mapnik
397 (name "python2-mapnik")
402 (uri (string-append "https://github.com/mapnik/python-mapnik/archive/v"
404 (file-name (string-append name "-" version ".tar.gz"))
407 "0w7wg72gnwmbjani9sqk42p2jwqkrl9hsdkawahni5m05xsifcb4"))))
408 (build-system python-build-system)
411 ("harfbuzz" ,harfbuzz)
413 ("libjpeg-turbo" ,libjpeg-turbo)
419 ("python2-pycairo" ,python2-pycairo)))
421 (let ((test-data-input
422 (lambda (repository version hash)
425 (uri (string-append "https://github.com/mapnik/" repository
426 "/archive/v" version ".tar.gz"))
427 (file-name (string-append "python-mapnik-" repository
428 "-" version ".tar.gz"))
429 (sha256 (base32 hash))))))
430 `(("python2-nose" ,python2-nose)
431 ;; Test data is released as separate tarballs
433 ,(test-data-input "test-data" "3.0.18"
434 "10cvgn5gxn8ldrszj24zr1vzm5w76kqk4s7bl2zzp5yvkhh8lj1n"))
436 ,(test-data-input "test-data-visual" "3.0.18"
437 "1cb9ghy8sis0w5fkp0dvwxdqqx44rhs9a9w8g9r9i7md1c40r80i")))))
439 `(#:python ,python-2 ; Python 3 support is incomplete, and the build fails
441 (modify-phases %standard-phases
442 ;; Unpack test data into the source tree
443 (add-after 'unpack 'unpack-submodules
444 (lambda* (#:key inputs #:allow-other-keys)
445 (let ((unpack (lambda (source target)
446 (with-directory-excursion target
447 (invoke "tar" "xvf" (assoc-ref inputs source)
448 "--strip-components=1")))))
449 (unpack "test-data" "test/data")
450 (unpack "test-data-visual" "test/data-visual"))))
451 ;; Skip failing tests
452 (add-after 'unpack 'skip-tests
454 (let ((skipped-tests (list "test_vrt_referring_to_missing_files"
455 "test_unicode_regex_replace"
456 "test_proj_antimeridian_bbox"
457 "test_render_with_scale_factor")))
458 (substitute* "setup.cfg"
459 (("\\[nosetests\\]" all)
460 (string-append all "\nexclude=^("
461 (string-join skipped-tests "|") ")$")))))))))
462 (home-page "https://github.com/mapnik/python-mapnik")
463 (synopsis "Python bindings for Mapnik")
464 (description "This package provides Python bindings for Mapnik.")
465 (license license:lgpl2.1+)))
467 (define-public spatialite-gui
469 (name "spatialite-gui")
474 (uri (string-append "https://www.gaia-gis.it/gaia-sins/spatialite_gui-"
478 "1r05dz9pyc8vsd2wbqxcsracpfbaamz470rcyp2myfpqwznv376b"))))
479 (build-system gnu-build-system)
481 `(("pkg-config" ,pkg-config)))
485 ("libgaiagraphics" ,libgaiagraphics)
486 ("libspatialite" ,libspatialite)
490 ("wxwidgets" ,wxwidgets-2)
492 (synopsis "Graphical user interface for SpatiaLite")
493 (description "Spatialite-gui provides a visual interface for viewing and
494 maintaining a spatialite database. You can easily see the structure of the
495 tables and data contents using point and click functions, many of which
496 construct common SQL queries, or craft your own SQL queries.")
497 (home-page "https://www.gaia-gis.it/fossil/spatialite_gui/index")
498 (license license:gpl3+)))
500 (define-public r-maps
507 (uri (cran-uri "maps" version))
510 "05i2ppl5z4p8rawgqmy3z4ia05fcblpq1vvrmrkgkkpdlhczx6hr"))))
511 (build-system r-build-system)
512 (home-page "https://cran.r-project.org/web/packages/maps")
513 (synopsis "Draw geographical maps")
514 (description "This package provies an R module for display of maps.
515 Projection code and larger maps are in separate packages ('mapproj' and
517 (license license:gpl2)))
519 (define-public r-mapproj
526 (uri (cran-uri "mapproj" version))
529 "1rggww8cbwv0vzlj5afzhbsbngg4bzj5znbkz7wmxsbshfbsm9b2"))))
530 (build-system r-build-system)
531 (propagated-inputs `(("r-maps" ,r-maps)))
532 (home-page "https://cran.r-project.org/web/packages/mapproj")
533 (synopsis "Map projection in R")
534 (description "This package converts latitude/longitude into projected
536 (license (list license:gpl2 ; The R interface
537 (license:non-copyleft ; The C code
538 "https://www.gnu.org/licenses/license-list.en.html#lucent102"
539 "Lucent Public License Version 1.02")))))
541 (define-public r-rgooglemaps
543 (name "r-rgooglemaps")
548 (uri (cran-uri "RgoogleMaps" version))
551 "0fsmlnhl4kw2j4972kfanzw9njhnzk695gsyw8g6yppsmz2clcaq"))))
552 (properties `((upstream-name . "RgoogleMaps")))
553 (build-system r-build-system)
554 (propagated-inputs `(("r-png" ,r-png)))
555 (home-page "https://cran.r-project.org/web/packages/RgoogleMaps")
556 (synopsis "Use Google Maps in R")
557 (description "This package serves two purposes: (i) Provide a comfortable R
558 interface to query the Google server for static maps, and (ii) Use the map as a
559 background image to overlay plots within R. This requires proper coordinate
561 (license license:gpl2+)))
563 (define-public r-geosphere
570 (uri (cran-uri "geosphere" version))
573 "186qdm5niq7v3d4w4rngx71znsgi44hnam7698bsx9ar5mg5b6wx"))))
574 (build-system r-build-system)
575 (propagated-inputs `(("r-sp" ,r-sp)))
576 (home-page "https://cran.r-project.org/web/packages/geosphere")
577 (synopsis "Spherical trigonometry")
578 (description "This package computes spherical trigonometry for geographic
579 applications. That is, compute distances and related measures for angular
580 (longitude/latitude) locations.")
581 (license license:gpl3+)))
583 (define-public r-ggmap
590 (uri (cran-uri "ggmap" version))
593 "0mssb09w818jv58h7mly9y181pzv22sgcd4a079cfpq04bs0wigw"))))
594 (build-system r-build-system)
596 `(("r-digest" ,r-digest)
597 ("r-geosphere" ,r-geosphere)
598 ("r-ggplot2" ,r-ggplot2)
600 ("r-mapproj" ,r-mapproj)
604 ("r-reshape2" ,r-reshape2)
605 ("r-rgooglemaps" ,r-rgooglemaps)
607 ("r-scales" ,r-scales)))
608 (home-page "https://github.com/dkahle/ggmap")
609 (synopsis "Spatial visualization with ggplot2")
610 (description "This package provides a collection of functions to visualize
611 spatial data and models on top of static maps from various online sources (e.g
612 Google Maps and Stamen Maps). It includes tools common to those tasks,
613 including functions for geolocation and routing.")
614 (license license:gpl2)))