gnu: Remove ".git" from "https://github/…/….git".
[jackhill/guix/guix.git] / gnu / packages / geo.scm
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, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
7 ;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
8 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
9 ;;; Copyright © 2018, 2019, 2020 Julien Lepiller <julien@lepiller.eu>
10 ;;; Copyright © 2019, 2020 Guillaume Le Vaillant <glv@posteo.net>
11 ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
12 ;;; Copyright © 2019 Wiktor Żelazny <wzelazny@vurv.cz>
13 ;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
14 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
15 ;;;
16 ;;; This file is part of GNU Guix.
17 ;;;
18 ;;; GNU Guix is free software; you can redistribute it and/or modify it
19 ;;; under the terms of the GNU General Public License as published by
20 ;;; the Free Software Foundation; either version 3 of the License, or (at
21 ;;; your option) any later version.
22 ;;;
23 ;;; GNU Guix is distributed in the hope that it will be useful, but
24 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ;;; GNU General Public License for more details.
27 ;;;
28 ;;; You should have received a copy of the GNU General Public License
29 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30
31 (define-module (gnu packages geo)
32 #:use-module (guix build-system ant)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system glib-or-gtk)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system go)
37 #:use-module (guix build-system meson)
38 #:use-module (guix build-system python)
39 #:use-module (guix build-system qt)
40 #:use-module (guix build-system scons)
41 #:use-module (guix build-system r)
42 #:use-module (guix download)
43 #:use-module (guix git-download)
44 #:use-module (guix svn-download)
45 #:use-module ((guix licenses) #:prefix license:)
46 #:use-module (guix packages)
47 #:use-module (guix utils)
48 #:use-module (gnu packages)
49 #:use-module (gnu packages algebra)
50 #:use-module (gnu packages astronomy)
51 #:use-module (gnu packages audio)
52 #:use-module (gnu packages autotools)
53 #:use-module (gnu packages backup)
54 #:use-module (gnu packages bash)
55 #:use-module (gnu packages bison)
56 #:use-module (gnu packages boost)
57 #:use-module (gnu packages check)
58 #:use-module (gnu packages compression)
59 #:use-module (gnu packages curl)
60 #:use-module (gnu packages databases)
61 #:use-module (gnu packages datastructures)
62 #:use-module (gnu packages documentation)
63 #:use-module (gnu packages elf)
64 #:use-module (gnu packages flex)
65 #:use-module (gnu packages fonts)
66 #:use-module (gnu packages fontutils)
67 #:use-module (gnu packages gettext)
68 #:use-module (gnu packages gl)
69 #:use-module (gnu packages glib)
70 #:use-module (gnu packages gnome)
71 #:use-module (gnu packages gps)
72 #:use-module (gnu packages gtk)
73 #:use-module (gnu packages haskell-apps)
74 #:use-module (gnu packages image)
75 #:use-module (gnu packages image-processing)
76 #:use-module (gnu packages icu4c)
77 #:use-module (gnu packages java)
78 #:use-module (gnu packages kde)
79 #:use-module (gnu packages lua)
80 #:use-module (gnu packages maths)
81 #:use-module (gnu packages pcre)
82 #:use-module (gnu packages pdf)
83 #:use-module (gnu packages perl)
84 #:use-module (gnu packages photo)
85 #:use-module (gnu packages pkg-config)
86 #:use-module (gnu packages protobuf)
87 #:use-module (gnu packages pulseaudio)
88 #:use-module (gnu packages python)
89 #:use-module (gnu packages python-web)
90 #:use-module (gnu packages python-xyz)
91 #:use-module (gnu packages qt)
92 #:use-module (gnu packages readline)
93 #:use-module (gnu packages swig)
94 #:use-module (gnu packages sqlite)
95 #:use-module (gnu packages textutils)
96 #:use-module (gnu packages time)
97 #:use-module (gnu packages web)
98 #:use-module (gnu packages webkit)
99 #:use-module (gnu packages wxwidgets)
100 #:use-module (gnu packages xml)
101 #:use-module (gnu packages xorg))
102
103 (define-public geos
104 (package
105 (name "geos")
106 (version "3.8.0")
107 (source (origin
108 (method url-fetch)
109 (uri (string-append "http://download.osgeo.org/geos/geos-"
110 version
111 ".tar.bz2"))
112 (sha256
113 (base32
114 "1mb2v9fy1gnbjhcgv0xny11ggfb17vkzsajdyibigwsxr4ylq4cr"))))
115 (build-system gnu-build-system)
116 (arguments `(#:phases
117 (modify-phases %standard-phases
118 (add-after
119 'unpack 'patch-test-shebangs
120 (lambda _
121 (substitute* '("tests/xmltester/testrunner.sh"
122 "tests/geostest/testrunner.sh")
123 (("/bin/sh") (which "sh")))
124 #t)))))
125 (inputs
126 `(("glib" ,glib)))
127 (home-page "https://geos.osgeo.org/")
128 (synopsis "Geometry Engine for Geographic Information Systems")
129 (description
130 "GEOS provides a spatial object model and fundamental geometric
131 functions. It is a C++ port of the Java Topology Suite (JTS). As such,
132 it aims to contain the complete functionality of JTS in C++. This
133 includes all the OpenGIS Simple Features for SQL spatial predicate
134 functions and spatial operators, as well as specific JTS enhanced
135 topology functions.")
136 (license (list license:lgpl2.1+ ; Main distribution.
137 license:zlib ; tests/xmltester/tinyxml/*
138 license:public-domain)))) ; include/geos/timeval.h
139
140 (define-public gnome-maps
141 (package
142 (name "gnome-maps")
143 (version "3.34.2")
144 (source (origin
145 (method url-fetch)
146 (uri (string-append "mirror://gnome/sources/" name "/"
147 (version-major+minor version) "/"
148 name "-" version ".tar.xz"))
149 (sha256
150 (base32
151 "00xslcnhhwslqglgfv2im7vq3awa49y2jxzr8wsby7f713k28vf5"))))
152 (build-system meson-build-system)
153 (arguments
154 `(#:glib-or-gtk? #t
155 #:phases
156 (modify-phases %standard-phases
157 (add-after 'unpack 'skip-gtk-update-icon-cache
158 ;; Don't create 'icon-theme.cache'.
159 (lambda _
160 (substitute* "meson_post_install.py"
161 (("gtk-update-icon-cache") "true"))
162 #t))
163 (add-after 'install 'wrap
164 (lambda* (#:key inputs outputs #:allow-other-keys)
165 (let ((out (assoc-ref outputs "out"))
166 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
167 (geocode-glib-path (string-append
168 (assoc-ref inputs "geocode-glib")
169 "/lib"))
170 (goa-path (string-append
171 (assoc-ref inputs "gnome-online-accounts:lib")
172 "/lib"))
173 (gdk-pixbuf-path (string-append
174 (assoc-ref inputs "gdk-pixbuf")
175 "/lib"))
176 (webkitgtk-path (string-append
177 (assoc-ref inputs "webkitgtk")
178 "/lib")))
179 (wrap-program (string-append out "/bin/gnome-maps")
180 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
181
182 ;; There seems to be no way to embed the path of
183 ;; libgoa-1.0.so.0, libwebkit2gtk-4.0.so.37,
184 ;; libgdk_pixbuf-2.0.so, libjavascriptcoregtk-4.0.so.18, and
185 ;; libgeocode-glib.so.0
186 `("LD_LIBRARY_PATH" ":" prefix (,goa-path
187 ,webkitgtk-path
188 ,gdk-pixbuf-path
189 ,geocode-glib-path)))
190 #t))))))
191 (native-inputs
192 `(("gettext" ,gettext-minimal)
193 ("gobject-introspection" ,gobject-introspection)
194 ("pkg-config" ,pkg-config)))
195 (inputs
196 `(("evolution-data-server" ,evolution-data-server)
197 ("folks" ,folks)
198 ("libchamplain" ,libchamplain)
199 ("libgee" ,libgee)
200 ("libsecret" ,libsecret)
201 ("libsoup" ,libsoup)
202 ("libgweather" ,libgweather)
203 ("libxml2" ,libxml2)
204 ("gdk-pixbuf" ,gdk-pixbuf+svg)
205 ("glib-networking" ,glib-networking)
206 ("geoclue" ,geoclue)
207 ("geocode-glib" ,geocode-glib)
208 ("gfbgraph" ,gfbgraph)
209 ("gjs" ,gjs)
210 ("glib" ,glib)
211 ("gnome-online-accounts:lib" ,gnome-online-accounts "lib")
212 ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
213 ("gtk+" ,gtk+)
214 ("rest" ,rest)
215 ("webkitgtk" ,webkitgtk)))
216 (synopsis "Graphical map viewer and wayfinding program")
217 (description "GNOME Maps is a graphical map viewer. It uses map data from
218 the OpenStreetMap project. It can provide directions for walking, bicycling,
219 and driving.")
220 (home-page "https://wiki.gnome.org/Apps/Maps")
221 (license license:gpl2+)))
222
223 (define-public libgaiagraphics
224 (package
225 (name "libgaiagraphics")
226 (version "0.5")
227 (source
228 (origin
229 (method url-fetch)
230 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libgaiagraphics-"
231 version ".tar.gz"))
232 (sha256
233 (base32
234 "076afqv417ag3hfvnif0qc7qscmnq1dsf6y431yygwgf34rjkayc"))))
235 (build-system gnu-build-system)
236 (native-inputs
237 `(("pkg-config" ,pkg-config)))
238 (inputs
239 `(("cairo" ,cairo)
240 ("libpng" ,libpng)
241 ("libjpeg-turbo" ,libjpeg-turbo)
242 ("libtiff" ,libtiff)
243 ("libgeotiff" ,libgeotiff)
244 ("proj.4" ,proj.4)
245 ("libxml2" ,libxml2)
246 ("zlib" ,zlib)))
247 (synopsis "Gaia common graphics support")
248 (description "libgaiagraphics is a library supporting
249 common-utility raster handling methods.")
250 (home-page "https://www.gaia-gis.it/fossil/libgaiagraphics/index")
251 (license license:lgpl3+)))
252
253 (define-public libgeotiff
254 (package
255 (name "libgeotiff")
256 (version "1.5.1")
257 (source
258 (origin
259 (method url-fetch)
260 (uri (string-append "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-"
261 version ".tar.gz"))
262 (patches (search-patches
263 ;; See libgeotiff 1.5.1 issue
264 ;; https://github.com/OSGeo/libgeotiff/issues/22
265 "libgeotiff-adapt-test-script-for-proj-6.2.patch"))
266 (sha256
267 (base32 "0b31mlzcv5b1y7jdvb7p0pa3xradrg3x5g32ym911lbhq4rrgsgr"))
268 (modules '((guix build utils)))
269 (snippet
270 '(begin
271 ;; Remove .csv files, distributed from EPSG under a restricted
272 ;; license. See LICENSE for full license text.
273 (for-each delete-file (find-files "." "\\.csv$"))
274 #t))))
275 (build-system gnu-build-system)
276 (inputs
277 `(("libjpeg-turbo" ,libjpeg-turbo)
278 ("libtiff" ,libtiff)
279 ("zlib" ,zlib)))
280 (propagated-inputs
281 `(;; libgeotiff headers include proj headers, so ensure those are available.
282 ("proj" ,proj)))
283 (arguments
284 `(#:configure-flags
285 (list "--disable-static"
286 "--with-zlib" "--with-jpeg"
287 (string-append "--with-libtiff=" (assoc-ref %build-inputs "libtiff")))))
288 (synopsis "Library for handling GeoTIFF (geographic enabled TIFF)")
289 (description "libgeotiff is a library on top of libtiff for reading and
290 writing GeoTIFF information tags.")
291 (home-page "https://trac.osgeo.org/geotiff/")
292 ;; This is a mixture of various contributions under different licenses.
293 ;; Note that the EPSG database is NOT "free to use" as the LICENSE file
294 ;; states, as its commercial redistribution is restricted. Hence, we have
295 ;; removed it from the package.
296 (license (list license:public-domain
297 license:x11
298 license:bsd-3
299 (license:non-copyleft "file://LICENSE"
300 "See LICENSE in the distribution.")))))
301
302 (define-public libspatialite
303 (package
304 (name "libspatialite")
305 (version "4.3.0a")
306 (source
307 (origin
308 (method url-fetch)
309 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libspatialite-"
310 version ".tar.gz"))
311 (sha256
312 (base32
313 "16d4lpl7xrm9zy4gphy6nwanpjp8wn9g4wq2i2kh8abnlhq01448"))))
314 (build-system gnu-build-system)
315 (native-inputs
316 `(("pkg-config" ,pkg-config)))
317 (inputs
318 `(("freexl" ,freexl)
319 ("geos" ,geos)
320 ("libxml2" ,libxml2)
321 ("proj.4" ,proj.4)
322 ("sqlite" ,sqlite)
323 ("zlib" ,zlib)))
324 (arguments
325 `(#:phases
326 (modify-phases %standard-phases
327 ;; 3 tests are failing, ignore them:
328 (add-after 'unpack 'ignore-broken-tests
329 (lambda _
330 (substitute* '("test/Makefile.in")
331 (("\tcheck_sql_stm.*" all) "\tcheck_multithread$(EXEEXT) \\\n")
332 (("(\tch.*) check_v.*ble2.*$" all vt1) (string-append vt1 " \\\n"))
333 (("\tch.* (check_v.*ble4.*)$" all vt4) (string-append "\t" vt4)))
334 #t)))))
335 (synopsis "Extend SQLite to support Spatial SQL capabilities")
336 (description
337 "SpatiaLite is a library intended to extend the SQLite core to support
338 fully fledged Spatial SQL capabilities.")
339 (home-page "https://www.gaia-gis.it/fossil/libspatialite/index")
340 ;; For the genuine libspatialite-sources holds:
341 ;; Any of the licenses MPL1.1, GPL2+ or LGPL2.1+ may be picked.
342 ;; Files under src/control_points are from GRASS
343 ;; and are licensed under GPL2+ only.
344 ;; src/md5.[ch]: Placed into the public domain by Alexander Peslyak.
345 (license (list license:gpl2+
346 license:lgpl2.1+
347 license:mpl1.1
348 license:public-domain))))
349
350 (define-public proj
351 (package
352 (name "proj")
353 (version "6.3.1")
354 (source
355 (origin
356 (method url-fetch)
357 (uri (string-append "http://download.osgeo.org/proj/proj-"
358 version ".tar.gz"))
359 (sha256
360 (base32
361 "1y46ij32j9b4x1kjnnlykcwk3kkjwkg44sfc1ziwm3a3g0ki3q3d"))))
362 (build-system gnu-build-system)
363 (inputs
364 `(("sqlite" ,sqlite)))
365 (native-inputs
366 `(("pkg-config" ,pkg-config)))
367 (home-page "https://proj.org/")
368 (synopsis "Coordinate transformation software")
369 (description
370 "Proj is a generic coordinate transformation software that transforms
371 geospatial coordinates from one coordinate reference system (CRS) to another.
372 This includes cartographic projections as well as geodetic transformations.
373 PROJ includes command line applications for easy conversion of coordinates
374 from text files or directly from user input. In addition, proj also exposes
375 an application programming interface that lets developers use the
376 functionality of proj in their own software.")
377 (license (list license:expat
378 ;; src/projections/patterson.cpp
379 license:asl2.0
380 ;; src/geodesic.*, src/tests/geodtest.cpp
381 license:x11))))
382
383 (define-public proj.4
384 (package
385 (name "proj.4")
386 (version "4.9.3")
387 (source (origin
388 (method url-fetch)
389 (uri (string-append "http://download.osgeo.org/proj/proj-"
390 version ".tar.gz"))
391 (sha256
392 (base32
393 "1xw5f427xk9p2nbsj04j6m5zyjlyd66sbvl2bkg8hd1kx8pm9139"))))
394 (build-system gnu-build-system)
395 (arguments
396 `(#:phases
397 (modify-phases %standard-phases
398 (add-after 'unpack 'patch-test-paths
399 (lambda _
400 (substitute* '("nad/test27"
401 "nad/test83"
402 "nad/testvarious"
403 "nad/testdatumfile"
404 "nad/testflaky"
405 "nad/testIGNF")
406 (("/bin/rm") (which "rm")))
407 #t))
408 ;; Precision problems on i686 and other platforms. See:
409 ;; https://web.archive.org/web/20151006134301/http://trac.osgeo.org/proj/ticket/255
410 ;; Disable failing test.
411 (add-after 'patch-test-paths 'ignore-failing-tests
412 (lambda _
413 (substitute* '("nad/Makefile.in")
414 (("\tPROJ_LIB.*" all) (string-append "#" all)))
415 #t)))))
416 (inputs
417 `(("glib" ,glib)))
418 (home-page "https://proj.org/")
419 (synopsis "Cartographic Projections Library")
420 (description
421 "Proj.4 is a library for converting coordinates between cartographic
422 projections.")
423 (license (list license:expat
424 ;; src/PJ_patterson.c
425 license:asl2.0
426 ;; src/geodesic.c/h
427 license:x11
428 ;; Embedded EPSG database.
429 (license:non-copyleft "http://www.epsg.org/TermsOfUse")
430 ;; cmake/*
431 license:boost1.0))))
432
433 (define-public mapnik
434 (package
435 (name "mapnik")
436 (version "3.0.18")
437 (source
438 (origin
439 (method url-fetch)
440 (uri (string-append "https://github.com/mapnik/mapnik/releases/download/v"
441 version "/mapnik-v" version ".tar.bz2"))
442 (sha256
443 (base32
444 "06frcikaj2mgz3abfk5h0z4j3hbksi0zikwjngbjv4p5f3pwxf8q"))))
445 (build-system scons-build-system)
446 (inputs
447 `(("boost" ,boost)
448 ("cairo" ,cairo)
449 ("freetype" ,freetype)
450 ("harfbuzz" ,harfbuzz)
451 ("icu4c" ,icu4c)
452 ("libjpeg-turbo" ,libjpeg-turbo)
453 ("libpng" ,libpng)
454 ("libtiff" ,libtiff)
455 ("libwebp" ,libwebp)
456 ("libxml2" ,libxml2)
457 ("proj.4" ,proj.4)
458 ("sqlite" ,sqlite)
459 ("zlib" ,zlib)))
460 (native-inputs
461 `(("pkg-config" ,pkg-config)))
462 (arguments
463 `(#:scons ,scons-python2
464 #:scons-flags
465 (list "CC=gcc"
466 (string-append "PREFIX=" %output)
467 (string-append "CUSTOM_LDFLAGS=-Wl,-rpath=" %output "/lib"))))
468 (home-page "https://mapnik.org/")
469 (synopsis "Toolkit for developing mapping applications")
470 (description "Mapnik is a toolkit for developing mapping applications. It
471 is basically a collection of geographic objects like maps, layers,
472 datasources, features, and geometries. At its core is a C++ shared library
473 providing algorithms and patterns for spatial data access and visualization.
474 The library does not rely on any specific windowing system and can be deployed
475 to any server environment. It is intended to play fair in a multi-threaded
476 environment and is aimed primarily, but not exclusively, at web-based
477 development.")
478 (license (list license:lgpl2.1+
479 ;; demo/viewer, demo/python/rundemo.py
480 license:gpl2+
481 ;; deps/boost, deps/mapbox, deps/agg/include/agg_conv_offset.h
482 license:boost1.0
483 ;; deps/mapnik/sparsehash
484 license:bsd-3
485 ;; deps/agg
486 (license:non-copyleft "file://deps/agg/copying")))))
487
488 (define-public python2-mapnik
489 (package
490 (name "python2-mapnik")
491 (version "3.0.16")
492 (source
493 (origin
494 (method url-fetch)
495 (uri (string-append "https://github.com/mapnik/python-mapnik/archive/v"
496 version ".tar.gz"))
497 (file-name (string-append name "-" version ".tar.gz"))
498 (sha256
499 (base32
500 "0w7wg72gnwmbjani9sqk42p2jwqkrl9hsdkawahni5m05xsifcb4"))))
501 (build-system python-build-system)
502 (inputs
503 `(("boost" ,boost)
504 ("harfbuzz" ,harfbuzz)
505 ("icu4c" ,icu4c)
506 ("libjpeg-turbo" ,libjpeg-turbo)
507 ("libpng" ,libpng)
508 ("libtiff" ,libtiff)
509 ("libwebp" ,libwebp)
510 ("mapnik" ,mapnik)
511 ("proj.4" ,proj.4)
512 ("python2-pycairo" ,python2-pycairo)))
513 (native-inputs
514 (let ((test-data-input
515 (lambda (repository version hash)
516 (origin
517 (method url-fetch)
518 (uri (string-append "https://github.com/mapnik/" repository
519 "/archive/v" version ".tar.gz"))
520 (file-name (string-append "python-mapnik-" repository
521 "-" version ".tar.gz"))
522 (sha256 (base32 hash))))))
523 `(("python2-nose" ,python2-nose)
524 ;; Test data is released as separate tarballs
525 ("test-data"
526 ,(test-data-input "test-data" "3.0.18"
527 "10cvgn5gxn8ldrszj24zr1vzm5w76kqk4s7bl2zzp5yvkhh8lj1n"))
528 ("test-data-visual"
529 ,(test-data-input "test-data-visual" "3.0.18"
530 "1cb9ghy8sis0w5fkp0dvwxdqqx44rhs9a9w8g9r9i7md1c40r80i")))))
531 (arguments
532 `(#:python ,python-2 ; Python 3 support is incomplete, and the build fails
533 #:phases
534 (modify-phases %standard-phases
535 ;; Unpack test data into the source tree
536 (add-after 'unpack 'unpack-submodules
537 (lambda* (#:key inputs #:allow-other-keys)
538 (let ((unpack (lambda (source target)
539 (with-directory-excursion target
540 (invoke "tar" "xvf" (assoc-ref inputs source)
541 "--strip-components=1")))))
542 (unpack "test-data" "test/data")
543 (unpack "test-data-visual" "test/data-visual"))))
544 ;; Skip failing tests
545 (add-after 'unpack 'skip-tests
546 (lambda _
547 (let ((skipped-tests (list "test_vrt_referring_to_missing_files"
548 "test_unicode_regex_replace"
549 "test_proj_antimeridian_bbox"
550 "test_render_with_scale_factor")))
551 (substitute* "setup.cfg"
552 (("\\[nosetests\\]" all)
553 (string-append all "\nexclude=^("
554 (string-join skipped-tests "|") ")$")))))))))
555 (home-page "https://github.com/mapnik/python-mapnik")
556 (synopsis "Python bindings for Mapnik")
557 (description "This package provides Python bindings for Mapnik.")
558 (license license:lgpl2.1+)))
559
560 (define-public spatialite-gui
561 (package
562 (name "spatialite-gui")
563 (version "1.7.1")
564 (source
565 (origin
566 (method url-fetch)
567 (uri (string-append "https://www.gaia-gis.it/gaia-sins/spatialite_gui-"
568 version ".tar.gz"))
569 (sha256
570 (base32
571 "1r05dz9pyc8vsd2wbqxcsracpfbaamz470rcyp2myfpqwznv376b"))))
572 (build-system gnu-build-system)
573 (native-inputs
574 `(("pkg-config" ,pkg-config)))
575 (inputs
576 `(("freexl" ,freexl)
577 ("geos" ,geos)
578 ("libgaiagraphics" ,libgaiagraphics)
579 ("libjpeg-turbo" ,libjpeg-turbo)
580 ("libspatialite" ,libspatialite)
581 ("libxml2" ,libxml2)
582 ("proj.4" ,proj.4)
583 ("sqlite" ,sqlite)
584 ("wxwidgets" ,wxwidgets-2)
585 ("zlib" ,zlib)))
586 (arguments
587 `(#:phases (modify-phases %standard-phases
588 (add-after 'unpack 'fix-gui
589 (lambda _
590 ;; Fix for the GUI not showing up.
591 (substitute* "Main.cpp"
592 (("Hide\\(\\);") ""))
593 #t)))))
594 (synopsis "Graphical user interface for SpatiaLite")
595 (description "Spatialite-gui provides a visual interface for viewing and
596 maintaining a spatialite database. You can easily see the structure of the
597 tables and data contents using point and click functions, many of which
598 construct common SQL queries, or craft your own SQL queries.")
599 (home-page "https://www.gaia-gis.it/fossil/spatialite_gui/index")
600 (license license:gpl3+)))
601
602 (define-public gdal
603 (package
604 (name "gdal")
605 (version "3.0.4")
606 (source (origin
607 (method url-fetch)
608 (uri (string-append
609 "http://download.osgeo.org/gdal/" version "/gdal-"
610 version ".tar.gz"))
611 (sha256
612 (base32
613 "10symyajj1b7j98f889lqxxbmhcyvlhq9gg0l42h69bv22wx45gw"))
614 (modules '((guix build utils)))
615 (snippet
616 `(begin
617 ;; TODO: frmts contains a lot more bundled code.
618 (for-each delete-file-recursively
619 ;; bundled code
620 '("frmts/png/libpng"
621 "frmts/gif/giflib"
622 "frmts/jpeg/libjpeg"
623 "frmts/jpeg/libjpeg12"
624 "frmts/gtiff/libtiff"
625 "frmts/gtiff/libgeotiff"
626 "frmts/zlib"
627 "ogr/ogrsf_frmts/geojson/libjson"))))))
628 (build-system gnu-build-system)
629 (arguments
630 `(#:tests? #f
631 #:configure-flags
632 (let-syntax ((with (syntax-rules ()
633 ((_ option input)
634 (string-append option "="
635 (assoc-ref %build-inputs input))))))
636 (list
637 ;; TODO: --with-pcidsk, --with-pcraster
638 (with "--with-freexl" "freexl")
639 (with "--with-libjson-c" "json-c")
640 (with "--with-png" "libpng")
641 (with "--with-webp" "libwebp")
642 (with "--with-gif" "giflib")
643 (with "--with-jpeg" "libjpeg-turbo")
644 (with "--with-libtiff" "libtiff")
645 (with "--with-geotiff" "libgeotiff")
646 (with "--with-libz" "zlib")
647 (with "--with-expat" "expat")
648 (with "--with-sqlite3" "sqlite")
649 "--with-pcre"))
650 #:phases
651 (modify-phases %standard-phases
652 (add-before 'build 'fix-path
653 (lambda _
654 (substitute* "frmts/mrf/mrf_band.cpp"
655 (("\"../zlib/zlib.h\"") "<zlib.h>")))))))
656 (inputs
657 `(("expat" ,expat)
658 ("freexl" ,freexl)
659 ("geos" ,geos)
660 ("giflib" ,giflib)
661 ("json-c" ,json-c)
662 ("libgeotiff" ,libgeotiff)
663 ("libjpeg-turbo" ,libjpeg-turbo)
664 ("libpng" ,libpng)
665 ("libtiff" ,libtiff)
666 ("libwebp" ,libwebp)
667 ("netcdf" ,netcdf)
668 ("pcre" ,pcre)
669 ("proj" ,proj)
670 ("sqlite" ,sqlite)
671 ("zlib" ,zlib)))
672 (home-page "https://gdal.org/")
673 (synopsis "Raster and vector geospatial data format library")
674 (description "GDAL is a translator library for raster and vector geospatial
675 data formats. As a library, it presents a single raster abstract data model
676 and single vector abstract data model to the calling application for all
677 supported formats. It also comes with a variety of useful command line
678 utilities for data translation and processing.")
679 (license (list
680 ;; general license
681 license:expat
682 ;; frmts/gtiff/tif_float.c, frmts/pcraster/libcsf,
683 ;; ogr/ogrsf_frmts/dxf/intronurbs.cpp, frmts/pdf/pdfdataset.cpp
684 ;; frmts/mrf/
685 license:bsd-3
686 ;; frmts/hdf4/hdf-eos/*
687 ;; similar to the expat license, but without guarantee exclusion
688 (license:non-copyleft "file://frmts/hdf4/hdf-eos/README")
689 ;; frmts/grib/degrib/
690 license:public-domain ; with guarantee exclusion
691 ;; port/cpl_minizip*
692 ;; Some bsd-inspired license
693 (license:non-copyleft "file://port/LICENCE_minizip")
694 ;; alg/internal_libqhull
695 ;; Some 5-clause license
696 (license:non-copyleft "file://alg/internal_libqhull/COPYING.txt")
697 ;; frmts/mrf/libLERC
698 license:asl2.0))))
699
700 (define-public python-gdal
701 (package (inherit gdal)
702 (name "python-gdal")
703 (build-system python-build-system)
704 (arguments
705 '(#:tests? #f ; no tests
706 #:phases
707 (modify-phases %standard-phases
708 (add-before 'build 'chdir
709 (lambda _
710 (chdir "swig/python")
711 #t)))))
712 (native-inputs '())
713 (propagated-inputs
714 `(("python-numpy" ,python-numpy)))
715 (inputs
716 `(("gdal" ,gdal)))
717 (synopsis "GDAL (Geospatial Data Abstraction Library) python bindings")))
718
719 (define-public postgis
720 (package
721 (name "postgis")
722 (version "3.0.0")
723 (source (origin
724 (method url-fetch)
725 (uri (string-append "https://download.osgeo.org/postgis/source/postgis-"
726 version ".tar.gz"))
727 (sha256
728 (base32
729 "15557fbk0xkngihwhqsbdyz2ng49blisf5zydw81j0gabk6x4vy0"))))
730 (build-system gnu-build-system)
731 (arguments
732 `(#:tests? #f
733 #:make-flags
734 (list (string-append "datadir=" (assoc-ref %outputs "out") "/share")
735 (string-append "docdir="(assoc-ref %outputs "out") "/share/doc")
736 (string-append "pkglibdir="(assoc-ref %outputs "out") "/lib")
737 (string-append "bindir=" (assoc-ref %outputs "out") "/bin"))
738 #:phases
739 (modify-phases %standard-phases
740 (add-before 'build 'fix-install-path
741 (lambda* (#:key outputs #:allow-other-keys)
742 (substitute* '("raster/loader/Makefile" "raster/scripts/python/Makefile")
743 (("\\$\\(DESTDIR\\)\\$\\(PGSQL_BINDIR\\)")
744 (string-append (assoc-ref outputs "out") "/bin"))))))))
745 (inputs
746 `(("gdal" ,gdal)
747 ("geos" ,geos)
748 ("giflib" ,giflib)
749 ("json-c" ,json-c)
750 ("libjpeg" ,libjpeg-turbo)
751 ("libxml2" ,libxml2)
752 ("pcre" ,pcre)
753 ("postgresql" ,postgresql)
754 ("proj" ,proj)))
755 (native-inputs
756 `(("perl" ,perl)
757 ("pkg-config" ,pkg-config)))
758 (home-page "https://postgis.net")
759 (synopsis "Spatial database extender for PostgreSQL")
760 (description "PostGIS is a spatial database extender for PostgreSQL
761 object-relational database. It adds support for geographic objects allowing
762 location queries to be run in SQL. This package provides a PostgreSQL
763 extension.")
764 (license (list
765 ;; General license
766 license:gpl2+
767 ;; loader/dbfopen, safileio.*, shapefil.h, shpopen.c
768 license:expat
769 ;; loader/getopt.*
770 license:public-domain
771 ;; doc/xsl
772 license:bsd-3 ; files only say "BSD"
773 ;; doc
774 license:cc-by-sa3.0))))
775
776 (define-public tegola
777 (package
778 (name "tegola")
779 (version "0.7.0")
780 (source (origin
781 (method url-fetch)
782 (uri (string-append
783 "https://github.com/go-spatial/tegola/archive/v"
784 version ".tar.gz"))
785 (file-name (string-append name "-" version ".tar.gz"))
786 (sha256
787 (base32
788 "09vnzxfn0r70kmd776kcdfqxhzdj11syxa0b27z4ci1k367v7viw"))))
789 (build-system go-build-system)
790 (arguments
791 `(#:import-path "github.com/go-spatial/tegola/cmd/tegola"
792 #:unpack-path "github.com/go-spatial/tegola"
793 #:phases
794 (modify-phases %standard-phases
795 (add-before 'build 'set-version
796 (lambda _
797 (with-directory-excursion "src/github.com/go-spatial/tegola"
798 (substitute* '("cmd/tegola/cmd/root.go"
799 "cmd/tegola_lambda/main.go")
800 (("version not set") ,version)))
801 #t)))))
802 (home-page "https://tegola.io")
803 (synopsis "Vector tile server for maps")
804 (description "Tegola is a free vector tile server written in Go. Tegola
805 takes geospatial data and slices it into vector tiles that can be efficiently
806 delivered to any client.")
807 (license (list
808 license:expat
809 ;; Some packages in vendor have other licenses
810 license:asl2.0
811 license:bsd-2
812 license:bsd-3
813 license:wtfpl2))))
814
815 (define-public imposm3
816 (package
817 (name "imposm3")
818 (version "0.6.0-alpha.4")
819 (source
820 (origin
821 (method url-fetch)
822 (uri (string-append "https://github.com/omniscale/imposm3/archive/v"
823 version ".tar.gz"))
824 (file-name (string-append name "-" version ".tar.gz"))
825 (sha256
826 (base32
827 "06f0kwmv52yd5m9jlckqxqmkf0cnqy3hamakrvg9lspplyqrds80"))))
828 (build-system go-build-system)
829 (arguments
830 `(#:import-path "github.com/omniscale/imposm3/cmd/imposm"
831 #:unpack-path "github.com/omniscale/imposm3"
832 #:phases
833 (modify-phases %standard-phases
834 (add-before 'build 'set-version
835 (lambda _
836 (substitute* "src/github.com/omniscale/imposm3/version.go"
837 (("0.0.0-dev") ,version))
838 #t)))))
839 (inputs
840 `(("geos" ,geos)
841 ("leveldb" ,leveldb)))
842 (home-page "https://imposm.org/")
843 (synopsis "OpenStreetMap importer for PostGIS")
844 (description "Imposm is an importer for OpenStreetMap data. It reads PBF
845 files and imports the data into PostgreSQL/PostGIS databases. It is designed
846 to create databases that are optimized for rendering/tile/map-services.")
847 (license (list
848 license:asl2.0
849 ;; Some dependencies in vendor have different licenses
850 license:expat
851 license:bsd-2
852 license:bsd-3))))
853
854 (define-public libosmium
855 (package
856 (name "libosmium")
857 (version "2.15.4")
858 (source
859 (origin
860 (method git-fetch)
861 (uri (git-reference
862 (url "https://github.com/osmcode/libosmium")
863 (commit (string-append "v" version))))
864 (file-name (git-file-name name version))
865 (sha256
866 (base32 "0mlcvqrhp40bzj5r5j9nfc5vbis8hmzcq9xi8jylkciyydaynhz4"))))
867 (build-system cmake-build-system)
868 (propagated-inputs
869 `(("boost" ,boost)
870 ("bzip2" ,bzip2)
871 ("expat" ,expat)
872 ("gdal" ,gdal)
873 ("geos" ,geos)
874 ("proj" ,proj)
875 ("protozero" ,protozero)
876 ("sparsehash" ,sparsehash)
877 ("utfcpp" ,utfcpp)
878 ("zlib" ,zlib)))
879 (native-inputs
880 `(("doxygen" ,doxygen)))
881 (home-page "https://osmcode.org/libosmium/")
882 (synopsis "C++ library for working with OpenStreetMap data")
883 (description "Libosmium is a fast and flexible C++ library for working with
884 OpenStreetMap data.")
885 (license license:boost1.0)))
886
887 (define-public osm2pgsql
888 (package
889 (name "osm2pgsql")
890 (version "1.2.1")
891 (source
892 (origin
893 (method git-fetch)
894 (uri (git-reference
895 (url "https://github.com/openstreetmap/osm2pgsql")
896 (commit version)))
897 (file-name (git-file-name name version))
898 (sha256
899 (base32 "1ysan01lpqzjxlq3y2kdminfjs5d9zksicpf9vvzpdk3fzq51fc9"))
900 (modules '((guix build utils)))
901 (snippet
902 '(begin
903 (delete-file-recursively "contrib/protozero")
904 (delete-file-recursively "contrib/libosmium")
905 #t))))
906 (build-system cmake-build-system)
907 (arguments
908 `(#:tests? #f; tests fail because we need to setup a database
909 #:configure-flags
910 (list (string-append "-DOSMIUM_INCLUDE_DIR="
911 (assoc-ref %build-inputs "libosmium")
912 "/include")
913 (string-append "-DPROTOZERO_INCLUDE_DIR="
914 (assoc-ref %build-inputs "protozero")
915 "/include"))))
916 (inputs
917 `(("boost" ,boost)
918 ("bzip2" ,bzip2)
919 ("expat" ,expat)
920 ("libosmium" ,libosmium)
921 ("lua" ,lua)
922 ("postgresql" ,postgresql)
923 ("proj" ,proj)
924 ("protozero" ,protozero)
925 ("zlib" ,zlib)))
926 (native-inputs
927 `(("python" ,python)
928 ("python-psycopg2" ,python-psycopg2)))
929 (home-page "https://github.com/openstreetmap/osm2pgsql")
930 (synopsis "OSM data importer to postgresql")
931 (description "Osm2pgsql is a tool for loading OpenStreetMap data into a
932 PostgreSQL / PostGIS database suitable for applications like rendering into a
933 map, geocoding with Nominatim, or general analysis.")
934 (license license:gpl2+)))
935
936 (define-public tippecanoe
937 (package
938 (name "tippecanoe")
939 (version "1.31.5")
940 (source
941 (origin
942 (method git-fetch)
943 (uri (git-reference
944 (url "https://github.com/mapbox/tippecanoe")
945 (commit version)))
946 (file-name (git-file-name name version))
947 (sha256
948 (base32 "1m0x931a945sr7axyhcvpwh798m58hx1zxh6ikgf9gsgqhdhmszz"))))
949 (build-system gnu-build-system)
950 (arguments
951 `(#:phases
952 (modify-phases %standard-phases (delete 'configure))
953 #:test-target "test"
954 #:make-flags
955 (list "CC=gcc"
956 (string-append "PREFIX=" (assoc-ref %outputs "out")))))
957 (inputs
958 `(("perl" ,perl)
959 ("sqlite" ,sqlite)
960 ("zlib" ,zlib)))
961 (home-page "https://github.com/mapbox/tippecanoe")
962 (synopsis "Vector tile server for maps")
963 (description "Tippecanoe creates scale-independent view of data, so that
964 the texture and density of features is visible at every zoom level, instead of
965 dropping features at lower levels.")
966 (license license:bsd-2)))
967
968 (define-public osmctools
969 (package
970 (name "osmctools")
971 (version "0.9")
972 (source
973 (origin
974 (method git-fetch)
975 (uri (git-reference
976 (url "https://gitlab.com/osm-c-tools/osmctools")
977 (commit version)))
978 (file-name (git-file-name name version))
979 (sha256
980 (base32
981 "1m8d3r1q1v05pkr8k9czrmb4xjszw6hvgsf3kn9pf0v14gpn4r8f"))))
982 (build-system gnu-build-system)
983 (native-inputs
984 `(("autoconf" ,autoconf)
985 ("automake" ,automake)))
986 (inputs
987 `(("zlib" ,zlib)))
988 (home-page "https://gitlab.com/osm-c-tools/osmctools")
989 (synopsis "Tools to convert, filter and update OpenStreetMap data files")
990 (description "This project contains a few tools which are used in the
991 OpenStreetMap project. They can be used to convert, filter and update
992 OpenStreetMap data files.")
993 (license license:agpl3)))
994
995 (define-public osm-gps-map
996 (package
997 (name "osm-gps-map")
998 (version "1.1.0")
999 (source
1000 (origin
1001 (method url-fetch)
1002 (uri (string-append
1003 "https://github.com/nzjrs/osm-gps-map/releases/download/"
1004 version "/osm-gps-map-" version ".tar.gz"))
1005 (sha256
1006 (base32
1007 "11imsf4cz1dpxdjh178k2s29axmq86rkfg1pqmn7incyxmjzhbwg"))))
1008 (build-system gnu-build-system)
1009 (native-inputs
1010 `(("gnome-common" ,gnome-common)
1011 ("gtk-doc" ,gtk-doc)
1012 ("pkg-config" ,pkg-config)))
1013 (inputs
1014 `(("cairo" ,cairo)
1015 ("glib" ,glib)
1016 ("gobject-introspection" ,gobject-introspection)
1017 ("gtk+" ,gtk+)
1018 ("libsoup" ,libsoup)))
1019 (home-page "https://nzjrs.github.io/osm-gps-map/")
1020 (synopsis "GTK+ widget for displaying OpenStreetMap tiles")
1021 (description
1022 "This package provides a GTK+ widget (and Python bindings) that when
1023 given GPS coordinates,draws a GPS track, and points of interest on a moving
1024 map display. Downloads map data from a number of websites, including
1025 @url{https://www.openstreetmap.org}.")
1026 (license license:gpl2+)))
1027
1028 (define-public xygrib
1029 (package
1030 (name "xygrib")
1031 (version "1.2.6.1")
1032 (source (origin
1033 (method git-fetch)
1034 (uri (git-reference
1035 (url "https://github.com/opengribs/XyGrib")
1036 (commit (string-append "v" version))))
1037 (file-name (git-file-name name version))
1038 (sha256
1039 (base32
1040 "0xzsm8pr0zjk3f8j880fg5n82jyxn8xf1330qmmq1fqv7rsrg9ia"))
1041 (modules '((guix build utils)))
1042 (snippet
1043 '(begin (delete-file-recursively "data/fonts") #t))))
1044 (build-system cmake-build-system)
1045 (arguments
1046 `(#:phases
1047 (modify-phases %standard-phases
1048 (add-after 'unpack 'patch-directories
1049 (lambda* (#:key inputs #:allow-other-keys)
1050 (let ((jpeg (assoc-ref inputs "openjpeg"))
1051 (font (assoc-ref inputs "font-liberation")))
1052 (substitute* "CMakeLists.txt"
1053 ;; Find libjpeg.
1054 (("/usr") jpeg)
1055 ;; Fix install locations.
1056 (("set\\(PREFIX_BIN.*") "set(PREFIX_BIN \"bin\")\n")
1057 (("set\\(PREFIX_PKGDATA.*") "set(PREFIX_PKGDATA \"share/${PROJECT_NAME}\")\n")
1058 ;; Skip looking for the static library.
1059 (("\"libnova.a\"") ""))
1060 ;; Don't use the bundled font-liberation.
1061 (substitute* "src/util/Font.cpp"
1062 (("Util::pathFonts\\(\\)\\+\"liberation-fonts/\"")
1063 (string-append "\"" font "/share/fonts/truetype/\"")))
1064 (substitute* "src/util/Util.h"
1065 (("pathData\\(\\)\\+\"data/fonts/\"")
1066 (string-append "\"" font "/share/fonts/\""))))
1067 #t)))
1068 #:tests? #f)) ; no tests
1069 (native-inputs
1070 `(("qttools" ,qttools)))
1071 (inputs
1072 `(("bzip2" ,bzip2)
1073 ("font-liberation" ,font-liberation)
1074 ("libnova" ,libnova)
1075 ("libpng" ,libpng)
1076 ("openjpeg" ,openjpeg)
1077 ("proj.4" ,proj.4)
1078 ("qtbase" ,qtbase)
1079 ("zlib" ,zlib)))
1080 (synopsis "Weather Forecast Visualization")
1081 (description
1082 "XyGrib is a Grib file reader and visualizes meteorological data providing
1083 an off-line capability to analyse weather forecasts or hindcasts. It is
1084 intended to be used as a capable weather work station for anyone with a serious
1085 interest in examining weather. This would include members of the sailing
1086 community, private and sport aviators, farmers, weather buffs and many more.
1087 XyGrib is the continuation of the zyGrib software package with a new team of
1088 volunteers.")
1089 (home-page "https://opengribs.org")
1090 (license license:gpl3+)))
1091
1092 (define-public libspatialindex
1093 (package
1094 (name "libspatialindex")
1095 (version "1.9.3")
1096 (source
1097 (origin
1098 (method url-fetch)
1099 (uri (string-append "https://github.com/libspatialindex/libspatialindex/"
1100 "releases/download/" version "/spatialindex-src-"
1101 version ".tar.bz2"))
1102 (sha256
1103 (base32
1104 "02n5vjcyk04w0djidyp21hfbxfpbbara8ifd9nml6158rwqr8lja"))))
1105 (build-system cmake-build-system)
1106 (home-page "https://libspatialindex.org")
1107 (synopsis "Spatial indexing library")
1108 (description "The purpose of this library is to provide:
1109
1110 @itemize
1111 @item An extensible framework that will support robust spatial indexing
1112 methods.
1113 @item Support for sophisticated spatial queries. Range, point location,
1114 nearest neighbor and k-nearest neighbor as well as parametric queries (defined
1115 by spatial constraints) should be easy to deploy and run.
1116 @item Easy to use interfaces for inserting, deleting and updating information.
1117 @item Wide variety of customization capabilities. Basic index and storage
1118 characteristics like the page size, node capacity, minimum fan-out, splitting
1119 algorithm, etc. should be easy to customize.
1120 @item Index persistence. Internal memory and external memory structures
1121 should be supported. Clustered and non-clustered indices should be easy to be
1122 persisted.
1123 @end itemize
1124 ")
1125 (license license:expat)))
1126
1127 (define-public java-jmapviewer
1128 (package
1129 (name "java-jmapviewer")
1130 (version "2.13")
1131 (source (origin
1132 (method url-fetch)
1133 (uri (string-append "https://svn.openstreetmap.org/applications/"
1134 "viewer/jmapviewer/releases/" version
1135 "/JMapViewer-" version "-Source.zip"))
1136 (sha256
1137 (base32
1138 "0sy6r5fkbb9bclw0is6gwnbzz627m7pjfnsqydxz58pbndakkhrv"))))
1139 (build-system ant-build-system)
1140 (native-inputs
1141 `(("unzip" ,unzip)))
1142 (arguments
1143 `(#:build-target "pack"
1144 #:tests? #f; No tests
1145 #:phases
1146 (modify-phases %standard-phases
1147 (add-before 'build 'clean
1148 (lambda* _
1149 (invoke "ant" "clean")))
1150 (replace 'install
1151 (lambda* (#:key outputs #:allow-other-keys)
1152 (let ((dir (string-append (assoc-ref outputs "out") "/share/java/")))
1153 (mkdir-p dir)
1154 (copy-file "JMapViewer.jar" (string-append dir "JMapViewer.jar"))
1155 #t))))))
1156 (home-page "https://wiki.openstreetmap.org/wiki/JMapViewer")
1157 (synopsis "OSM map integration in Java")
1158 (description "JMapViewer is a Java component which easily
1159 integrates an OSM map view into your Java application. It is maintained as
1160 an independent project by the JOSM team.")
1161 (license license:gpl2)))
1162
1163 (define-public java-opening-hours-parser
1164 (package
1165 (name "java-opening-hours-parser")
1166 (version "0.21.4")
1167 (source (origin
1168 (method git-fetch)
1169 (uri (git-reference
1170 (url "https://github.com/simonpoole/OpeningHoursParser")
1171 (commit version)))
1172 (file-name (git-file-name name version))
1173 (sha256
1174 (base32
1175 "1m8sp0jbjyv1nq3ddj8rk6rf3sva3mkacc6vw7rsj0c2n57k3i50"))))
1176 (build-system ant-build-system)
1177 (arguments
1178 `(#:jar-name "java-opening-hours-parser.jar"
1179 #:source-dir "src/main/java"
1180 #:phases
1181 (modify-phases %standard-phases
1182 (add-before 'build 'copy-resources
1183 (lambda _
1184 (copy-recursively "src/main/resources" "build/classes")
1185 #t))
1186 (add-before 'build 'generate-parser
1187 (lambda* _
1188 (let* ((dir "src/main/java/ch/poole/openinghoursparser")
1189 (file (string-append dir "/OpeningHoursParser.jj")))
1190 (invoke "javacc" "-DEBUG_PARSER=false"
1191 "-DEBUG_TOKEN_MANAGER=false" "-JDK_VERSION=1.8"
1192 "-GRAMMAR_ENCODING=UTF-8"
1193 (string-append "-OUTPUT_DIRECTORY=" dir)
1194 file))
1195 #t)))))
1196 (inputs
1197 `(("java-jetbrains-annotations" ,java-jetbrains-annotations)))
1198 (native-inputs
1199 `(("javacc" ,javacc)
1200 ("java-junit" ,java-junit)
1201 ("java-hamcrest-core" ,java-hamcrest-core)))
1202 (home-page "https://github.com/simonpoole/OpeningHoursParser")
1203 (synopsis "Java parser for the OpenStreetMap opening hour format")
1204 (description "This is a very simplistic parser for string values according
1205 to the OSM opening hours specification.")
1206 (license license:expat)))
1207
1208 (define-public josm
1209 (package
1210 (name "josm")
1211 (version "16731")
1212 (source (origin
1213 (method svn-fetch)
1214 (uri (svn-reference
1215 (url "https://josm.openstreetmap.de/svn/trunk")
1216 (revision (string->number version))
1217 (recursive? #f)))
1218 (sha256
1219 (base32
1220 "036kdb1ckhym5f7lj5ydzblli7f1i1pl8z00hxvagf2rczdf5fi3"))
1221 (file-name (string-append name "-" version "-checkout"))
1222 (modules '((guix build utils)))
1223 (snippet
1224 '(begin
1225 (for-each delete-file (find-files "." ".*.jar$"))
1226 #t))))
1227 (build-system ant-build-system)
1228 (native-inputs
1229 `(("javacc" ,javacc)))
1230 (inputs
1231 `(("java-commons-jcs" ,java-commons-jcs)
1232 ("java-commons-compress" ,java-commons-compress)
1233 ("java-jmapviewer" ,java-jmapviewer)
1234 ("java-jsonp-api" ,java-jsonp-api)
1235 ("java-jsonp-impl" ,java-jsonp-impl); runtime dependency
1236 ("java-metadata-extractor" ,java-metadata-extractor)
1237 ("java-opening-hours-parser" ,java-opening-hours-parser)
1238 ("java-openjfx-media" ,java-openjfx-media)
1239 ("java-signpost-core" ,java-signpost-core)
1240 ("java-svg-salamander" ,java-svg-salamander)))
1241 (arguments
1242 `(#:tests? #f
1243 #:jar-name "josm.jar"
1244 #:phases
1245 (modify-phases %standard-phases
1246 (add-after 'unpack 'rm-build.xml
1247 (lambda* _
1248 (delete-file "build.xml")
1249 #t))
1250 (add-before 'build 'fix-revision
1251 (lambda* _
1252 (with-output-to-file "REVISION.XML"
1253 (lambda _
1254 (display
1255 (string-append "<info><entry><commit revision=\"" ,version "\">"
1256 "<date>1970-01-01 00:00:00 +0000</date>"
1257 "</commit></entry></info>"))))
1258 #t))
1259 (add-before 'build 'fix-jcs
1260 (lambda _
1261 ;; This version of JOSM uses an unreleased version of commons-jcs,
1262 ;; which has renamed its classes to another namespace. Rename them
1263 ;; back so they can be used with our version of jcs.
1264 (substitute* (find-files "." ".*.java$")
1265 (("jcs3") "jcs"))
1266 #t))
1267 (add-before 'build 'fix-classpath
1268 (lambda* (#:key inputs #:allow-other-keys)
1269 (setenv "CLASSPATH"
1270 (string-join
1271 (filter
1272 (lambda (s)
1273 (let ((source (assoc-ref inputs "source")))
1274 (not (equal? (substring s 0 (string-length source)) source))))
1275 (string-split (getenv "CLASSPATH") #\:))
1276 ":"))
1277 #t))
1278 (add-before 'build 'generate-parser
1279 (lambda* _
1280 (let* ((dir "src/org/openstreetmap/josm/gui/mappaint/mapcss")
1281 (out (string-append dir "/parsergen"))
1282 (file (string-append dir "/MapCSSParser.jj")))
1283 (mkdir-p "src/org/openstreetmap/josm/gui/mappaint/mapcss/parsergen")
1284 (invoke "javacc" "-DEBUG_PARSER=false"
1285 "-DEBUG_TOKEN_MANAGER=false" "-JDK_VERSION=1.8"
1286 "-GRAMMAR_ENCODING=UTF-8"
1287 (string-append "-OUTPUT_DIRECTORY=" out)
1288 file))
1289 #t))
1290 (add-after 'build 'generate-epsg
1291 (lambda _
1292 (system* "javac" "scripts/BuildProjectionDefinitions.java"
1293 "-cp" "build/classes")
1294 (mkdir-p "data/projection")
1295 (with-output-to-file "data/projection/custom-epsg"
1296 (lambda _ (display "")))
1297 (invoke "java" "-cp" "build/classes:scripts:."
1298 "BuildProjectionDefinitions" ".")
1299 #t))
1300 (add-after 'generate-epsg 'copy-resources
1301 (lambda _
1302 (copy-recursively "resources" "build/classes")
1303 #t))
1304 (add-before 'install 'regenerate-jar
1305 (lambda _
1306 ;; We need to regenerate the jar file to add data.
1307 (delete-file "build/jar/josm.jar")
1308 (invoke "jar" "-cf" "build/jar/josm.jar" "-C"
1309 "build/classes" ".")
1310 #t))
1311 (add-before 'build 'copy-revision
1312 (lambda _
1313 (mkdir-p "build/classes")
1314 (with-output-to-file "build/classes/REVISION"
1315 (lambda _
1316 (display
1317 (string-append "Revision: " ,version "\n"
1318 "Is-Local-Build: true\n"
1319 "Build-Date: 1970-01-01 00:00:00 +0000\n"))))
1320 #t))
1321 (add-after 'install 'install-bin
1322 (lambda* (#:key outputs inputs #:allow-other-keys)
1323 (let* ((out (assoc-ref outputs "out"))
1324 (bin (string-append out "/bin")))
1325 (mkdir-p bin)
1326 (with-output-to-file (string-append bin "/josm")
1327 (lambda _
1328 (display
1329 (string-append "#!/bin/sh\n"
1330 (assoc-ref inputs "jdk") "/bin/java"
1331 " -cp " out "/share/java/josm.jar:"
1332 (getenv "CLASSPATH")
1333 " org.openstreetmap.josm.gui.MainApplication"))))
1334 (chmod (string-append bin "/josm") #o755))
1335 #t)))))
1336 (home-page "https://josm.openstreetmap.de")
1337 (synopsis "OSM editor")
1338 (description "JOSM is an extensible editor for OpenStreetMap (OSM). It
1339 supports loading GPX tracks, background imagery and OSM data from local
1340 sources as well as from online sources and allows editing the OSM data (nodes,
1341 ways, and relations) and their metadata tags.")
1342 (license license:gpl2+)))
1343
1344 (define-public libmaxminddb
1345 (package
1346 (name "libmaxminddb")
1347 (version "1.4.2")
1348 (source
1349 (origin
1350 (method url-fetch)
1351 (uri (string-append "https://github.com/maxmind/libmaxminddb"
1352 "/releases/download/" version "/"
1353 "/libmaxminddb-" version ".tar.gz"))
1354 (sha256
1355 (base32 "0mnimbaxnnarlw7g1rh8lpxsyf7xnmzwcczcc3lxw8xyf6ljln6x"))))
1356 (build-system gnu-build-system)
1357 (arguments
1358 `(#:phases
1359 (modify-phases %standard-phases
1360 (add-before 'configure 'set-cc-to-gcc
1361 (lambda _
1362 (setenv "CC" "gcc"))))))
1363 (native-inputs
1364 `(("perl" ,perl)))
1365 (home-page "https://maxmind.github.io/libmaxminddb/")
1366 (synopsis "C library for the MaxMind DB file format")
1367 (description "The libmaxminddb library provides a C library for reading
1368 MaxMind DB files, including the GeoIP2 databases from MaxMind. The MaxMind DB
1369 format is a custom, but open, binary format designed to facilitate fast
1370 lookups of IP addresses while allowing flexibility in the type of data
1371 associated with an address.")
1372 (license license:asl2.0)))
1373
1374 (define-public python-maxminddb
1375 (package
1376 (name "python-maxminddb")
1377 (version "1.5.1")
1378 (source
1379 (origin
1380 (method url-fetch)
1381 (uri (pypi-uri "maxminddb" version))
1382 (sha256
1383 (base32
1384 "0y9giw81k4wdmpryr4k42w50z292mf364a6vs1vxf83ksc9ig6j4"))))
1385 (build-system python-build-system)
1386 (arguments
1387 `(#:tests? #f)) ;; Tests require a copy of the maxmind database
1388 (inputs
1389 `(("libmaxminddb" ,libmaxminddb)))
1390 (home-page "https://www.maxmind.com/")
1391 (synopsis "Reader for the MaxMind DB format")
1392 (description "MaxMind DB is a binary file format that stores data indexed
1393 by IP address subnets (IPv4 or IPv6). This is a Python module for reading
1394 MaxMind DB files.")
1395 (license license:asl2.0)))
1396
1397 (define-public python-geoip2
1398 (package
1399 (name "python-geoip2")
1400 (version "2.9.0")
1401 (source
1402 (origin
1403 (method url-fetch)
1404 (uri (pypi-uri "geoip2" version))
1405 (sha256
1406 (base32
1407 "1w7cay5q6zawjzivqbwz5cqx1qbdjw6kbriccb7l46p7b39fkzzp"))))
1408 (build-system python-build-system)
1409 (arguments
1410 `(#:tests? #f)) ;; Tests require a copy of the maxmind database
1411 (inputs
1412 `(("python-maxminddb" ,python-maxminddb)
1413 ("python-requests" ,python-requests)))
1414 (home-page "https://www.maxmind.com/")
1415 (synopsis "MaxMind GeoIP2 API")
1416 (description "Provides an API for the GeoIP2 web services and databases.
1417 The API also works with MaxMind’s free GeoLite2 databases.")
1418 (license license:asl2.0)))
1419
1420 (define-public routino
1421 (package
1422 (name "routino")
1423 (version "3.3.2")
1424 (source
1425 (origin
1426 (method url-fetch)
1427 (uri (string-append "http://www.routino.org/download/routino-"
1428 version ".tgz"))
1429 (sha256
1430 (base32
1431 "1ccx3s99j8syxc1gqkzsaqkmyf44l7h3adildnc5iq2md7bp8wab"))))
1432 (build-system gnu-build-system)
1433 (native-inputs
1434 `(("perl" ,perl)))
1435 (inputs
1436 `(("bzip2" ,bzip2)
1437 ("xz" ,xz)
1438 ("zlib" ,zlib)))
1439 (arguments
1440 `(#:test-target "test"
1441 #:phases
1442 (modify-phases %standard-phases
1443 (replace 'configure
1444 (lambda* (#:key outputs #:allow-other-keys)
1445 (substitute* "Makefile.conf"
1446 (("prefix=/usr/local")
1447 (string-append "prefix=" (assoc-ref outputs "out")))
1448 (("LDFLAGS_LDSO=-Wl,-R\\.")
1449 "LDFLAGS_LDSO=-Wl,-R$(libdir)")
1450 (("#CFLAGS\\+=-DUSE_XZ")
1451 "CFLAGS+=-DUSE_XZ")
1452 (("#LDFLAGS\\+=-llzma")
1453 "LDFLAGS+=-llzma"))
1454 #t)))))
1455 (synopsis "Routing application for OpenStreetMap data")
1456 (description
1457 "Routino is an application for finding a route between two points
1458 using the dataset of topographical information collected by
1459 @url{https://www.OpenStreetMap.org}.")
1460 (home-page "https://www.routino.org/")
1461 (license license:agpl3+)))
1462
1463 (define-public qmapshack
1464 (package
1465 (name "qmapshack")
1466 (version "1.14.0")
1467 (source
1468 (origin
1469 (method git-fetch)
1470 (uri (git-reference
1471 (url "https://github.com/Maproom/qmapshack")
1472 (commit (string-append "V_" version))))
1473 (file-name (git-file-name name version))
1474 (sha256
1475 (base32
1476 "07c2hrq9sn456w7l3gdr599rmjfv2k6mh159zza7p1py8r7ywksa"))))
1477 (build-system qt-build-system)
1478 (native-inputs
1479 `(("pkg-config" ,pkg-config)
1480 ("qttools" ,qttools)))
1481 (inputs
1482 `(("gdal" ,gdal)
1483 ("libjpeg-turbo" ,libjpeg-turbo)
1484 ("proj" ,proj)
1485 ("qtbase" ,qtbase)
1486 ("qtdeclarative" ,qtdeclarative)
1487 ("qtlocation" ,qtlocation)
1488 ("qtwebchannel" ,qtwebchannel)
1489 ("qtwebengine" ,qtwebengine)
1490 ("quazip" ,quazip)
1491 ("routino" ,routino)
1492 ("sqlite" ,sqlite) ; See wrap phase
1493 ("zlib" ,zlib)))
1494 (arguments
1495 `(#:tests? #f
1496 #:phases
1497 (modify-phases %standard-phases
1498 (add-after 'unpack 'fix-cmake-modules
1499 (lambda* (#:key inputs #:allow-other-keys)
1500 (substitute* "CMakeLists.txt"
1501 (("find_package\\(Qt5PrintSupport REQUIRED\\)" all)
1502 (string-append all "\nfind_package(Qt5Positioning REQUIRED)")))
1503 (substitute* "cmake/Modules/FindROUTINO.cmake"
1504 (("/usr/local")
1505 (assoc-ref inputs "routino")))
1506 ;; The following fixes are included as patches in the sources
1507 ;; of QMapShack, but they are not applied by default, for
1508 ;; some reason...
1509 (invoke "patch" "-p1" "-i" "FindPROJ4.patch")
1510 (invoke "patch" "-p1" "-i" "FindQuaZip5.patch")
1511 #t))
1512 (add-after 'install 'wrap
1513 ;; The program fails to find the QtWebEngineProcess program,
1514 ;; so we set QTWEBENGINEPROCESS_PATH to help it.
1515 (lambda* (#:key inputs outputs #:allow-other-keys)
1516 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
1517 (qtwebengineprocess (string-append
1518 (assoc-ref inputs "qtwebengine")
1519 "/lib/qt5/libexec/QtWebEngineProcess")))
1520 (for-each (lambda (program)
1521 (wrap-program program
1522 `("QTWEBENGINEPROCESS_PATH" =
1523 (,qtwebengineprocess))))
1524 (find-files bin ".*")))
1525 #t)))))
1526 (synopsis "GPS mapping application")
1527 (description
1528 "QMapShack can be used to plan your next outdoor trip or to visualize and
1529 archive all the GPS recordings of your past trips. It is the successor of the
1530 QLandkarte GT application.")
1531 (home-page "https://github.com/Maproom/qmapshack/wiki")
1532 (license license:gpl3+)))
1533
1534 (define-public readosm
1535 (package
1536 (name "readosm")
1537 (version "1.1.0")
1538 (source
1539 (origin
1540 (method url-fetch)
1541 (uri (string-append "https://www.gaia-gis.it/gaia-sins/"
1542 "readosm-" version ".tar.gz"))
1543 (sha256
1544 (base32 "1v20pnda67imjd70fn0zw30aar525xicy3d3v49md5cvqklws265"))))
1545 (build-system gnu-build-system)
1546 (inputs
1547 `(("expat" ,expat)
1548 ("zlib" ,zlib)))
1549 (synopsis "Data extractor for OpenStreetMap files")
1550 (description
1551 "ReadOSM is a library to extract valid data from within an OpenStreetMap
1552 input file (in @code{.osm} or @code{.osm.pbf} format).")
1553 (home-page "https://www.gaia-gis.it/fossil/readosm/index")
1554 (license (list license:gpl2+
1555 license:lgpl2.1+
1556 license:mpl1.1))))
1557
1558 (define-public spatialite-tools
1559 (package
1560 (name "spatialite-tools")
1561 (version "4.3.0")
1562 (source
1563 (origin
1564 (method url-fetch)
1565 (uri (string-append "https://www.gaia-gis.it/gaia-sins/"
1566 "spatialite-tools-" version ".tar.gz"))
1567 (sha256
1568 (base32 "12fggjhi8cgwvw8f6nk76f83b8lqkc07abxyj5ap6f2gq2dqafgp"))))
1569 (build-system gnu-build-system)
1570 (native-inputs
1571 `(("pkg-config" ,pkg-config)))
1572 (inputs
1573 `(("expat" ,expat)
1574 ("freexl" ,freexl)
1575 ("geos" ,geos)
1576 ("libspatialite" ,libspatialite)
1577 ("libxml2" ,libxml2)
1578 ("proj.4" ,proj.4)
1579 ("readosm" ,readosm)
1580 ("sqlite" ,sqlite)
1581 ("zlib" ,zlib)))
1582 (synopsis "Collection of command line tools for SpatiaLite")
1583 (description
1584 "@code{spatialite-tools} is a collection of Command Line Interface (CLI)
1585 tools supporting SpatiaLite.")
1586 (home-page "https://www.gaia-gis.it/fossil/spatialite-tools/index")
1587 (license license:gpl3+)))
1588
1589 (define-public virtualpg
1590 (package
1591 (name "virtualpg")
1592 (version "1.0.2")
1593 (source
1594 (origin
1595 (method url-fetch)
1596 (uri (string-append "https://www.gaia-gis.it/gaia-sins/"
1597 "virtualpg-" version ".tar.gz"))
1598 (sha256
1599 (base32 "0kjipcd08vvn188xmwbs7sw41xcs06x47n2hbqshpjcr51mxbarp"))))
1600 (build-system gnu-build-system)
1601 (inputs
1602 `(("postgresql" ,postgresql)
1603 ("sqlite" ,sqlite)))
1604 (synopsis "Allow SQLite/SpatiaLite to access PostgreSQL/PostGIS tables")
1605 (description
1606 "VirtualPG is a dynamic extension for the SQLite DBMS. It implements
1607 the VirtualPostgres driver, allowing to directly exchange data between SQLite
1608 and PostgreSQL; if SpatiaLite is available even PostGIS geometries can be
1609 exchanged form one Spatial DBMS and the other.")
1610 (home-page "https://www.gaia-gis.it/fossil/virtualpg/index")
1611 (license (list license:gpl2+
1612 license:lgpl2.1+
1613 license:mpl1.1))))
1614
1615 (define-public opencpn
1616 (package
1617 (name "opencpn")
1618 (version "5.0.0")
1619 (source
1620 (origin
1621 (method git-fetch)
1622 (uri (git-reference
1623 (url "https://github.com/OpenCPN/OpenCPN")
1624 (commit (string-append "v" version))))
1625 (file-name (git-file-name name version))
1626 (sha256
1627 (base32 "1xv3h6svw9aay5ixpql231md3pf00qxvhg62z88daraf18hlkfja"))))
1628 (build-system cmake-build-system)
1629 (native-inputs
1630 `(("gettext" ,gettext-minimal)
1631 ("pkg-config" ,pkg-config)))
1632 (inputs
1633 `(("bzip2" ,bzip2)
1634 ("cairo" ,cairo)
1635 ("curl" ,curl)
1636 ("glu" ,glu)
1637 ("gtk+" ,gtk+)
1638 ("libarchive" ,libarchive)
1639 ("libelf" ,libelf)
1640 ("libexif" ,libexif)
1641 ("libsndfile" ,libsndfile)
1642 ("lz4" ,lz4)
1643 ("mesa" ,mesa)
1644 ("pango" ,pango)
1645 ("portaudio" ,portaudio)
1646 ("sqlite" ,sqlite)
1647 ("tinyxml" ,tinyxml)
1648 ("wxsvg" ,wxsvg)
1649 ("wxwidgets" ,wxwidgets)
1650 ("xz" ,xz)
1651 ("zlib" ,zlib)))
1652 (arguments
1653 `(#:configure-flags '("-DENABLE_PORTAUDIO=ON"
1654 "-DENABLE_SNDFILE=ON"
1655 "-DBUNDLE_TCDATA=ON"
1656 "-DBUNDLE_GSHHS=CRUDE")
1657 #:tests? #f ; No tests defined
1658 #:phases
1659 (modify-phases %standard-phases
1660 (add-after 'unpack 'fix-build
1661 (lambda _
1662 (substitute* "CMakeLists.txt"
1663 (("set\\(wxWidgets_CONFIG_OPTIONS.*--toolkit=gtk3" all)
1664 (string-append all " --libs all")))
1665 #t)))))
1666 (synopsis "Chart plotter and marine GPS navigation software")
1667 (description
1668 "OpenCPN is a chart plotter and marine navigation software designed to be
1669 used at the helm station of your boat while underway. Chart a course and
1670 track your position right from your laptop.")
1671 (home-page "https://opencpn.org/")
1672 (license (list license:asl2.0
1673 license:cc0
1674 license:bsd-2
1675 license:bsd-3
1676 license:expat
1677 license:gpl3+
1678 license:lgpl2.1+
1679 license:lgpl3+
1680 license:sgifreeb2.0
1681 license:zlib))))
1682
1683 (define-public grass
1684 (let* ((version "7.8.2")
1685 (majorminor (string-join (list-head (string-split version #\.) 2) ""))
1686 (grassxx (string-append "grass" majorminor)))
1687 (package
1688 (name "grass")
1689 (version version)
1690 (source
1691 (origin
1692 (method url-fetch)
1693 (uri (string-append "https://grass.osgeo.org/" grassxx
1694 "/source/grass-" version ".tar.gz"))
1695 (sha256
1696 (base32 "1fwsm99kz0bxvjk7442qq1h45ikrmhba8bqclafb61gqg1q6ymrk"))))
1697 (build-system gnu-build-system)
1698 (inputs
1699 `(("bzip2", bzip2)
1700 ("cairo" ,cairo)
1701 ("fftw" ,fftw)
1702 ("freetype" ,freetype)
1703 ("gdal" ,gdal)
1704 ("geos" ,geos)
1705 ("glu" ,glu)
1706 ("lapack" ,lapack)
1707 ("libpng" ,libpng)
1708 ("libtiff" ,libtiff)
1709 ("mesa" ,mesa)
1710 ("mariadb-dev" ,mariadb "dev")
1711 ("mariadb-lib" ,mariadb "lib")
1712 ("netcdf" ,netcdf)
1713 ("openblas" ,openblas)
1714 ("perl" ,perl)
1715 ("postgresql" ,postgresql)
1716 ("proj.4" ,proj.4)
1717 ("python" ,python)
1718 ("python-dateutil" ,python-dateutil)
1719 ("python-numpy" ,python-numpy)
1720 ("python-wxpython" ,python-wxpython)
1721 ("readline" ,readline)
1722 ("sqlite" ,sqlite)
1723 ("wxwidgets" ,wxwidgets)
1724 ("zlib" ,zlib)
1725 ("zstd" ,zstd "lib")))
1726 (native-inputs
1727 `(("bash" ,bash-minimal)
1728 ("bison" ,bison)
1729 ("flex" ,flex)
1730 ("pkg-config" ,pkg-config)))
1731 (arguments
1732 `(#:tests? #f ; No tests
1733 #:modules ((guix build gnu-build-system)
1734 ((guix build python-build-system) #:prefix python:)
1735 (guix build utils))
1736 #:imported-modules (,@%gnu-build-system-modules
1737 (guix build python-build-system))
1738 #:phases
1739 (modify-phases %standard-phases
1740 (replace 'configure
1741 (lambda* (#:key inputs outputs #:allow-other-keys)
1742 (let ((shell (string-append (assoc-ref inputs "bash")
1743 "/bin/bash")))
1744 (setenv "SHELL" shell)
1745 (setenv "CONFIG_SHELL" shell)
1746 (setenv "LDFLAGS" (string-append "-Wl,-rpath -Wl,"
1747 (assoc-ref outputs "out")
1748 "/" ,grassxx "/lib")))
1749 (invoke "./configure"
1750 (string-append "--prefix="
1751 (assoc-ref outputs "out"))
1752 "--with-blas"
1753 "--with-bzlib"
1754 (string-append "--with-freetype-includes="
1755 (assoc-ref inputs "freetype")
1756 "/include/freetype2")
1757 (string-append "--with-freetype-libs="
1758 (assoc-ref inputs "freetype")
1759 "/lib")
1760 "--with-geos"
1761 "--with-lapack"
1762 "--with-mysql"
1763 (string-append "--with-mysql-includes="
1764 (assoc-ref inputs "mariadb-dev")
1765 "/include/mysql")
1766 (string-append "--with-mysql-libs="
1767 (assoc-ref inputs "mariadb-lib")
1768 "/lib")
1769 "--with-netcdf"
1770 "--with-postgres"
1771 (string-append "--with-proj-share="
1772 (assoc-ref inputs "proj.4")
1773 "/share/proj")
1774 "--with-pthread"
1775 "--with-readline"
1776 "--with-sqlite"
1777 "--with-wxwidgets")))
1778 (add-after 'install 'install-links
1779 (lambda* (#:key outputs #:allow-other-keys)
1780 ;; Put links for includes and libraries in the standard places.
1781 (let* ((out (assoc-ref outputs "out"))
1782 (dir (string-append out "/" ,grassxx)))
1783 (symlink (string-append dir "/include")
1784 (string-append out "/include"))
1785 (symlink (string-append dir "/lib")
1786 (string-append out "/lib")))
1787 #t))
1788 (add-after 'install-links 'wrap-python
1789 (assoc-ref python:%standard-phases 'wrap)))))
1790 (synopsis "GRASS Geographic Information System")
1791 (description
1792 "GRASS (Geographic Resources Analysis Support System), is a Geographic
1793 Information System (GIS) software suite used for geospatial data management and
1794 analysis, image processing, graphics and maps production, spatial modeling, and
1795 visualization.")
1796 (home-page "https://grass.osgeo.org/")
1797 (license license:gpl2+))))
1798
1799 (define-public saga
1800 (package
1801 (name "saga")
1802 (version "7.6.2")
1803 (source
1804 (origin
1805 (method url-fetch)
1806 (uri (string-append "mirror://sourceforge/saga-gis/SAGA%20-%20"
1807 (version-major version) "/SAGA%20-%20" version
1808 "/saga-" version ".tar.gz"))
1809 (sha256
1810 (base32 "09j5magmayq2y620kqa490mfd1kpdp3lng2ifcgbrmssc079ybm0"))))
1811 (build-system gnu-build-system)
1812 (native-inputs
1813 `(("pkg-config" ,pkg-config)
1814 ("swig" ,swig)))
1815 (inputs
1816 `(("curl" ,curl)
1817 ("fftw" ,fftw)
1818 ("gdal" ,gdal)
1819 ("hdf5" ,hdf5)
1820 ("jasper" ,jasper)
1821 ("libharu" ,libharu)
1822 ("libtiff" ,libtiff)
1823 ("opencv" ,opencv)
1824 ("postgresql" ,postgresql)
1825 ("proj.4" ,proj.4)
1826 ("python" ,python)
1827 ("qhull" ,qhull)
1828 ("unixodbc" ,unixodbc)
1829 ("vigra" ,vigra)
1830 ("wxwidgets" ,wxwidgets)))
1831 (arguments
1832 '(#:configure-flags '("--enable-python")))
1833 (synopsis "System for Automated Geoscientific Analyses")
1834 (description
1835 "SAGA (System for Automated Geoscientific Analyses) is a Geographic
1836 Information System (GIS) software. It has been designed for an easy and
1837 effective implementation of spatial algorithms and it offers a comprehensive,
1838 growing set of geoscientific methods.")
1839 (home-page "http://www.saga-gis.org")
1840 (license (list license:gpl2+ license:lgpl2.1+))))
1841
1842 (define-public qgis
1843 (package
1844 (name "qgis")
1845 (version "3.12.1")
1846 (source
1847 (origin
1848 (method url-fetch)
1849 (uri (string-append "https://qgis.org/downloads/qgis-"
1850 version ".tar.bz2"))
1851 (sha256
1852 (base32 "1a41525y8ac44gzcfaffjx0lyrm49hgnr83jrq40r5mqd3vpmp57"))))
1853 (build-system cmake-build-system)
1854 (arguments
1855 `(#:modules ((guix build cmake-build-system)
1856 ((guix build python-build-system) #:prefix python:)
1857 (guix build qt-utils)
1858 (guix build utils))
1859 #:imported-modules (,@%cmake-build-system-modules
1860 (guix build python-build-system)
1861 (guix build qt-utils))
1862 #:phases
1863 (modify-phases %standard-phases
1864 ;; Configure correct path to PyQt5 SIP directory
1865 (add-after 'unpack 'configure-pyqt5-sip-path
1866 (lambda* (#:key inputs #:allow-other-keys)
1867 (substitute* "cmake/FindPyQt5.cmake"
1868 (("\"\\\\\\\\1\" PYQT5_SIP_DIR")
1869 (string-append "\"" (assoc-ref inputs "python-pyqt+qscintilla")
1870 "/share/sip\" PYQT5_SIP_DIR")))
1871 (substitute* (list "scripts/prepare-commit.sh"
1872 "scripts/runtests-local-travis-config.sh"
1873 "scripts/sip_include.sh"
1874 "scripts/sipdiff"
1875 "scripts/sipify_all.sh"
1876 "scripts/spell_check/check_spelling.sh"
1877 "scripts/spell_check/spell_test.sh"
1878 "scripts/verify-indentation.sh"
1879 "tests/code_layout/test_banned_keywords.sh"
1880 "tests/code_layout/test_licenses.sh"
1881 "tests/code_layout/test_shellcheck.sh"
1882 "tests/code_layout/test_sip_include.sh"
1883 "tests/code_layout/test_sipfiles_uptodate.sh"
1884 "tests/code_layout/test_sipify.sh")
1885 (("\\$\\(git rev-parse --show-toplevel\\)")
1886 (getcwd)))
1887 (substitute* "tests/code_layout/test_sip_include.sh"
1888 (("^REV=.*") "REV=currentrev\n"))
1889 #t))
1890 (replace 'check
1891 (lambda* (#:key inputs #:allow-other-keys)
1892 (setenv "HOME" "/tmp")
1893 (system (string-append (assoc-ref inputs "xorg-server")
1894 "/bin/Xvfb :1 &"))
1895 (setenv "DISPLAY" ":1")
1896 (setenv "TRAVIS" "true")
1897 (setenv "CTEST_OUTPUT_ON_FAILURE" "1")
1898 (invoke "ctest"
1899 "-E" (string-join
1900 '(;; Disable tests that require network access
1901 "qgis_filedownloader"
1902 ;; TODO: Find why the following tests fail
1903 "ProcessingQgisAlgorithmsTestPt1"
1904 "ProcessingQgisAlgorithmsTestPt2"
1905 "ProcessingQgisAlgorithmsTestPt3"
1906 "ProcessingQgisAlgorithmsTestPt4"
1907 "ProcessingGdalAlgorithmsRasterTest"
1908 "ProcessingGdalAlgorithmsVectorTest"
1909 "ProcessingGrass7AlgorithmsImageryTest"
1910 "ProcessingGrass7AlgorithmsRasterTest"
1911 "ProcessingGrass7AlgorithmsVectorTest"
1912 "ProcessingOtbAlgorithmsTest"
1913 "qgis_authmanagertest"
1914 "qgis_compositionconvertertest"
1915 "qgis_coordinatereferencesystemtest"
1916 "qgis_geometrytest"
1917 "qgis_layouthtmltest"
1918 "qgis_layoutmaptest"
1919 "qgis_layoutmapgridtest"
1920 "qgis_painteffecttest"
1921 "qgis_pallabelingtest"
1922 "qgis_svgmarkertest"
1923 "qgis_taskmanagertest"
1924 "qgis_ziplayertest"
1925 "qgis_processingtest"
1926 "qgis_wcsprovidertest"
1927 "qgis_arcgisrestutilstest"
1928 "qgis_grassprovidertest7"
1929 "qgis_gpsinformationwidget"
1930 "PyCoreAdittions"
1931 "PyQgsPythonProvider"
1932 "PyQgsAnnotation"
1933 "PyQgsAuthenticationSystem"
1934 "PyQgsProject"
1935 "PyQgsFileUtils"
1936 "PyQgsGeometryTest"
1937 "PyQgsImageCache"
1938 "PyQgsLayerMetadata"
1939 "PyQgsLayout"
1940 "PyQgsLayoutHtml"
1941 "PyQgsLayoutMapGrid"
1942 "PyQgsMetadataBase"
1943 "PyQgsLayoutExporter"
1944 "PyQgsLayoutLegend"
1945 "PyQgsMapLayer"
1946 "PyQgsOGRProviderGpkg"
1947 "PyQgsPalLabelingLayout"
1948 "PyQgsImportIntoPostGIS"
1949 "PyQgsProviderConnectionPostgres"
1950 "PyQgsProviderConnectionGpkg"
1951 "PyQgsShapefileProvider"
1952 "PyQgsSvgCache"
1953 "PyQgsTextRenderer"
1954 "PyQgsOGRProvider"
1955 "PyQgsSpatialiteProvider"
1956 "PyQgsVectorFileWriter"
1957 "PyQgsVectorLayer"
1958 "PyQgsVectorLayerUtils"
1959 "PyQgsVirtualLayerProvider"
1960 "PyQgsWFSProvider"
1961 "PyQgsOapifProvider"
1962 "PyQgsLayerDependencies"
1963 "PyQgsDBManagerGpkg"
1964 "PyQgsDBManagerSpatialite"
1965 "PyQgsSettings"
1966 "PyQgsAuxiliaryStorage"
1967 "PyQgsSelectiveMasking"
1968 "PyQgsAppStartup"
1969 "qgis_geometrycheckstest"
1970 "qgis_shellcheck"
1971 "qgis_sipify"
1972 "qgis_sip_include"
1973 "qgis_sip_uptodate")
1974 "|"))))
1975 (add-after 'install 'wrap-python
1976 (assoc-ref python:%standard-phases 'wrap))
1977 (add-after 'wrap-python 'wrap-qt
1978 (lambda* (#:key outputs #:allow-other-keys)
1979 (wrap-qt-program (assoc-ref outputs "out") "qgis")
1980 #t))
1981 (add-after 'wrap-qt 'wrap-gis
1982 (lambda* (#:key inputs outputs #:allow-other-keys)
1983 (let* ((out (assoc-ref outputs "out"))
1984 (saga (string-append (assoc-ref inputs "saga") "/bin"))
1985 (grass-version ,(package-version grass))
1986 (grass-majorminor (string-join
1987 (list-head
1988 (string-split grass-version #\.) 2)
1989 ""))
1990 (grass (string-append (assoc-ref inputs "grass")
1991 "/grass" grass-majorminor)))
1992 (wrap-program (string-append out "/bin/qgis")
1993 `("PATH" ":" prefix (,saga))
1994 `("QGIS_PREFIX_PATH" = (,out))
1995 `("GISBASE" = (,grass))))
1996 #t)))))
1997 (inputs
1998 `(("exiv2" ,exiv2)
1999 ("expat" ,expat)
2000 ("gdal" ,gdal)
2001 ("geos" ,geos)
2002 ("gpsbabel" ,gpsbabel)
2003 ("grass" ,grass)
2004 ("gsl" ,gsl)
2005 ("hdf5" ,hdf5)
2006 ("libspatialindex" ,libspatialindex)
2007 ("libspatialite" ,libspatialite)
2008 ("libxml2" ,libxml2)
2009 ("libzip" ,libzip)
2010 ("netcdf" ,netcdf)
2011 ("postgresql" ,postgresql)
2012 ("proj" ,proj)
2013 ("python" ,python)
2014 ("python-chardet" ,python-chardet)
2015 ("python-dateutil" ,python-dateutil)
2016 ("python-gdal" ,python-gdal)
2017 ("python-jinja2" ,python-jinja2)
2018 ("python-numpy" ,python-numpy)
2019 ("python-owslib" ,python-owslib)
2020 ("python-psycopg2" ,python-psycopg2)
2021 ("python-pygments" ,python-pygments)
2022 ("python-pyqt+qscintilla" ,python-pyqt+qscintilla)
2023 ("python-pytz" ,python-pytz)
2024 ("python-pyyaml" ,python-pyyaml)
2025 ("python-requests" ,python-requests)
2026 ("python-sip" ,python-sip)
2027 ("python-six" ,python-six)
2028 ("python-urllib3" ,python-urllib3)
2029 ("qca" ,qca)
2030 ("qscintilla" ,qscintilla)
2031 ("qtbase" ,qtbase)
2032 ("qtdeclarative" ,qtdeclarative)
2033 ("qtkeychain" ,qtkeychain)
2034 ("qtlocation" ,qtlocation)
2035 ("qtserialport" ,qtserialport)
2036 ("qtsvg" ,qtsvg)
2037 ("qtwebkit" ,qtwebkit)
2038 ("qwt" ,qwt)
2039 ("saga" ,saga)
2040 ("sqlite" ,sqlite)))
2041 (native-inputs
2042 `(("bison" ,bison)
2043 ("flex" ,flex)
2044 ("perl" ,perl)
2045 ("perl-yaml-tiny" ,perl-yaml-tiny)
2046 ("pkg-config" ,pkg-config)
2047 ("python-mock" ,python-mock)
2048 ("python-nose2" ,python-nose2)
2049 ("qttools" ,qttools)
2050 ("shellcheck" ,shellcheck)
2051 ("xorg-server" ,xorg-server-for-tests)))
2052 (home-page "https://qgis.org")
2053 (synopsis "Geographical information system")
2054 (description "QGIS is an easy to use Geographical Information
2055 System (GIS). It is a GIS data viewer and editor. QGIS supports a number of
2056 raster and vector data formats, with new support easily added using the plugin
2057 architecture.")
2058 (license
2059 (list
2060 license:asl1.1
2061 license:asl2.0
2062 license:bsd-2
2063 license:bsd-3
2064 license:boost1.0
2065 license:cc-by3.0
2066 license:cc-by4.0
2067 license:cc-by-sa3.0
2068 license:cc-by-sa4.0
2069 (license:fsdg-compatible "https://www.deviantart.com/elvensword")
2070 (license:fsf-free "file://debian/copyright" "Go Squared")
2071 license:expat
2072 license:fdl1.2+
2073 (license:fsf-free
2074 "https://www.deviantart.com/webgoddess/art/Reddish-Inspired-Gradients-42208824")
2075 (license:fsf-free
2076 "file://debian/copyright"
2077 "QT-Commercial or LGPL-2.1 with Digia Qt LGPL Exception 1.1 or GPL-3")
2078 license:gpl2
2079 license:gpl2+
2080 license:gpl3
2081 license:gpl3+
2082 license:isc
2083 license:lgpl2.0+
2084 license:lgpl2.1
2085 license:lgpl2.1+
2086 license:lgpl3
2087 (license:non-copyleft "file://debian/copyright" "BSD-like-gist")
2088 (license:non-copyleft "file://debian/copyright" "Jim Mossman Attribution")
2089 (license:non-copyleft
2090 "https://www.ncl.ucar.edu/Download/NCL_source_license.shtml"
2091 "NCL Source Code License")
2092 license:ogl-psi1.0
2093 license:opl1.0+
2094 license:public-domain
2095 license:qwt1.0))))