gnu: r-rhdf5lib: Update to 1.2.1.
[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 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>
9 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages geo)
27 #:use-module (guix build-system glib-or-gtk)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system python)
30 #:use-module (guix build-system scons)
31 #:use-module (guix build-system r)
32 #:use-module (guix download)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix utils)
36 #:use-module (gnu packages boost)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages databases)
40 #:use-module (gnu packages fontutils)
41 #:use-module (gnu packages cran)
42 #:use-module (gnu packages glib)
43 #:use-module (gnu packages gnome)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages image)
46 #:use-module (gnu packages icu4c)
47 #:use-module (gnu packages pcre)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages statistics)
52 #:use-module (gnu packages web)
53 #:use-module (gnu packages webkit)
54 #:use-module (gnu packages wxwidgets)
55 #:use-module (gnu packages xml))
56
57 (define-public geos
58 (package
59 (name "geos")
60 (version "3.6.2")
61 (source (origin
62 (method url-fetch)
63 (uri (string-append "http://download.osgeo.org/geos/geos-"
64 version
65 ".tar.bz2"))
66 (sha256
67 (base32
68 "0ak5szby29l9l0vy43dm5z2g92xzdky20q1gc1kah1fnhkgi6nh4"))))
69 (build-system gnu-build-system)
70 (arguments `(#:phases
71 (modify-phases %standard-phases
72 (add-after
73 'unpack 'patch-test-shebangs
74 (lambda _
75 (substitute* '("tests/xmltester/testrunner.sh"
76 "tests/geostest/testrunner.sh")
77 (("/bin/sh") (which "sh")))
78 #t)))))
79 (inputs
80 `(("glib" ,glib)))
81 (home-page "https://geos.osgeo.org/")
82 (synopsis "Geometry Engine for Geographic Information Systems")
83 (description
84 "GEOS provides a spatial object model and fundamental geometric
85 functions. It is a C++ port of the Java Topology Suite (JTS). As such,
86 it aims to contain the complete functionality of JTS in C++. This
87 includes all the OpenGIS Simple Features for SQL spatial predicate
88 functions and spatial operators, as well as specific JTS enhanced
89 topology functions.")
90 (license (list license:lgpl2.1+ ; Main distribution.
91 license:zlib ; tests/xmltester/tinyxml/*
92 license:public-domain)))) ; include/geos/timeval.h
93
94 (define-public gnome-maps
95 (package
96 (name "gnome-maps")
97 (version "3.26.2")
98 (source (origin
99 (method url-fetch)
100 (uri (string-append "mirror://gnome/sources/" name "/"
101 (version-major+minor version) "/"
102 name "-" version ".tar.xz"))
103 (sha256
104 (base32
105 "0l40l7m9dyphvasiq1jxrn6ivavs1xwzn0bzz2x1z7x73955q783"))))
106 (build-system glib-or-gtk-build-system)
107 (arguments
108 `(#:configure-flags ;; Ensure that geoclue is referred to by output.
109 (list (string-append "LDFLAGS=-L"
110 (assoc-ref %build-inputs "geoclue") "/lib")
111 (string-append "CFLAGS=-I"
112 (assoc-ref %build-inputs "geoclue") "/include"))
113 #:phases
114 (modify-phases %standard-phases
115 (add-after 'install 'wrap
116 (lambda* (#:key inputs outputs #:allow-other-keys)
117 (let ((out (assoc-ref outputs "out"))
118 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
119 (goa-path (string-append
120 (assoc-ref inputs "gnome-online-accounts")
121 "/lib"))
122 (webkitgtk-path (string-append
123 (assoc-ref inputs "webkitgtk")
124 "/lib")))
125 (wrap-program (string-append out "/bin/gnome-maps")
126 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
127
128 ;; There seems to be no way to embed the path of
129 ;; libgoa-1.0.so.0, libwebkit2gtk-4.0.so.37 and
130 ;; libjavascriptcoregtk-4.0.so.18.
131 `("LD_LIBRARY_PATH" ":" prefix (,goa-path ,webkitgtk-path)))
132 #t))))))
133 (native-inputs
134 `(("gobject-introspection" ,gobject-introspection)
135 ("intltool" ,intltool)
136 ("pkg-config" ,pkg-config)))
137 (inputs
138 `(("folks" ,folks)
139 ("libchamplain" ,libchamplain)
140 ("libgee" ,libgee)
141 ("libsecret" ,libsecret)
142 ("libsoup" ,libsoup)
143 ("libgweather" ,libgweather)
144 ("libxml2" ,libxml2)
145 ("gdk-pixbuf" ,gdk-pixbuf)
146 ("glib-networking" ,glib-networking)
147 ("geoclue" ,geoclue)
148 ("geocode-glib" ,geocode-glib)
149 ("gfbgraph" ,gfbgraph)
150 ("gjs" ,gjs)
151 ("glib" ,glib)
152 ("gnome-online-accounts" ,gnome-online-accounts)
153 ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
154 ("rest" ,rest)
155 ("webkitgtk" ,webkitgtk)))
156 (propagated-inputs
157 `(("gtk+3" ,gtk+)))
158 (synopsis "Graphical map viewer and wayfinding program")
159 (description "GNOME Maps is a graphical map viewer. It uses map data from
160 the OpenStreetMap project. It can provide directions for walking, bicycling,
161 and driving.")
162 (home-page "https://wiki.gnome.org/Apps/Maps")
163 (license license:gpl2+)))
164
165 (define-public libgaiagraphics
166 (package
167 (name "libgaiagraphics")
168 (version "0.5")
169 (source
170 (origin
171 (method url-fetch)
172 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libgaiagraphics-"
173 version ".tar.gz"))
174 (sha256
175 (base32
176 "076afqv417ag3hfvnif0qc7qscmnq1dsf6y431yygwgf34rjkayc"))))
177 (build-system gnu-build-system)
178 (native-inputs
179 `(("pkg-config" ,pkg-config)))
180 (inputs
181 `(("cairo" ,cairo)
182 ("libpng" ,libpng)
183 ("libjepeg-turbo" ,libjpeg-turbo)
184 ("libtiff" ,libtiff)
185 ("libgeotiff" ,libgeotiff)
186 ("proj.4" ,proj.4)
187 ("libxml2" ,libxml2)
188 ("zlib" ,zlib)))
189 (synopsis "Gaia common graphics support")
190 (description "libgaiagraphics is a library supporting
191 common-utility raster handling methods.")
192 (home-page "https://www.gaia-gis.it/fossil/libgaiagraphics/index")
193 (license license:lgpl3+)))
194
195 (define-public libgeotiff
196 (package
197 (name "libgeotiff")
198 (version "1.4.2")
199 (source
200 (origin
201 (method url-fetch)
202 (uri (string-append "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-"
203 version ".tar.gz"))
204 (sha256
205 (base32
206 "0vjy3bwfhljjx66p9w999i4mdhsf7vjshx29yc3pn5livf5091xd"))
207 (modules '((guix build utils)))
208 (snippet
209 '(begin
210 ;; Remove .csv files, distributed from EPSG under a restricted
211 ;; license. See LICENSE for full license text.
212 (for-each delete-file (find-files "." "\\.csv$"))
213 ;; Now that we have removed the csv files, we need to modify the Makefile.
214 (substitute* "Makefile.in"
215 (("^all-am: .*$")
216 "all-am: Makefile $(LTLIBRARIES) $(HEADERS) geo_config.h\n")
217 (("^install-data-am: .*$")
218 "install-data-am: install-includeHEADERS"))))))
219 (build-system gnu-build-system)
220 (inputs
221 `(("libjpeg-turbo" ,libjpeg-turbo)
222 ("libtiff" ,libtiff)
223 ("proj.4" ,proj.4)
224 ("zlib" ,zlib)))
225 (arguments
226 `(#:configure-flags
227 (list (string-append "--with-zlib")
228 (string-append "--with-jpeg")
229 (string-append "--with-libtiff=" (assoc-ref %build-inputs "libtiff")))))
230 (synopsis "Library for handling GeoTIFF (geographic enabled TIFF)")
231 (description "libgeotiff is a library on top of libtiff for reading and
232 writing GeoTIFF information tags.")
233 (home-page "https://trac.osgeo.org/geotiff/")
234 ;; This is a mixture of various contributions under different licenses.
235 ;; Note that the EPSG database is NOT "free to use" as the LICENSE file
236 ;; states, as its commercial redistribution is restricted. Hence, we have
237 ;; removed it from the package.
238 (license (list license:public-domain
239 license:x11
240 license:bsd-3
241 (license:non-copyleft "file://LICENSE"
242 "See LICENSE in the distribution.")))))
243
244 (define-public libspatialite
245 (package
246 (name "libspatialite")
247 (version "4.3.0a")
248 (source
249 (origin
250 (method url-fetch)
251 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libspatialite-"
252 version ".tar.gz"))
253 (sha256
254 (base32
255 "16d4lpl7xrm9zy4gphy6nwanpjp8wn9g4wq2i2kh8abnlhq01448"))))
256 (build-system gnu-build-system)
257 (native-inputs
258 `(("pkg-config" ,pkg-config)))
259 (inputs
260 `(("freexl" ,freexl)
261 ("geos" ,geos)
262 ("libxml2" ,libxml2)
263 ("proj.4" ,proj.4)
264 ("sqlite" ,sqlite)
265 ("zlib" ,zlib)))
266 (arguments
267 `(#:phases
268 (modify-phases %standard-phases
269 ;; 3 tests are failing, ignore them:
270 (add-after 'unpack 'ignore-broken-tests
271 (lambda _
272 (substitute* '("test/Makefile.in")
273 (("\tcheck_sql_stm.*" all) "\tcheck_multithread$(EXEEXT) \\\n")
274 (("(\tch.*) check_v.*ble2.*$" all vt1) (string-append vt1 " \\\n"))
275 (("\tch.* (check_v.*ble4.*)$" all vt4) (string-append "\t" vt4)))
276 #t)))))
277 (synopsis "Extend SQLite to support Spatial SQL capabilities")
278 (description
279 "SpatiaLite is a library intended to extend the SQLite core to support
280 fully fledged Spatial SQL capabilities.")
281 (home-page "https://www.gaia-gis.it/fossil/libspatialite/index")
282 ;; For the genuine libspatialite-sources holds:
283 ;; Any of the licenses MPL1.1, GPL2+ or LGPL2.1+ may be picked.
284 ;; Files under src/control_points are from GRASS
285 ;; and are licensed under GPL2+ only.
286 ;; src/md5.[ch]: Placed into the public domain by Alexander Peslyak.
287 (license (list license:gpl2+
288 license:lgpl2.1+
289 license:mpl1.1
290 license:public-domain))))
291
292 (define-public proj.4
293 (package
294 (name "proj.4")
295 (version "4.9.3")
296 (source (origin
297 (method url-fetch)
298 (uri (string-append "http://download.osgeo.org/proj/proj-"
299 version ".tar.gz"))
300 (sha256
301 (base32
302 "1xw5f427xk9p2nbsj04j6m5zyjlyd66sbvl2bkg8hd1kx8pm9139"))))
303 (build-system gnu-build-system)
304 (arguments
305 `(#:phases
306 (modify-phases %standard-phases
307 (add-after 'unpack 'patch-test-paths
308 (lambda _
309 (substitute* '("nad/test27"
310 "nad/test83"
311 "nad/testvarious"
312 "nad/testdatumfile"
313 "nad/testflaky"
314 "nad/testIGNF")
315 (("/bin/rm") (which "rm")))
316 #t))
317 ;; Precision problems on i686 and other platforms. See:
318 ;; https://web.archive.org/web/20151006134301/http://trac.osgeo.org/proj/ticket/255
319 ;; Disable failing test.
320 (add-after 'patch-test-paths 'ignore-failing-tests
321 (lambda _
322 (substitute* '("nad/Makefile.in")
323 (("\tPROJ_LIB.*" all) (string-append "#" all)))
324 #t)))))
325 (inputs
326 `(("glib" ,glib)))
327 (home-page "http://proj4.org/")
328 (synopsis "Cartographic Projections Library")
329 (description
330 "Proj.4 is a library for converting coordinates between cartographic
331 projections.")
332 (license (list license:expat
333 ;; src/PJ_patterson.c
334 license:asl2.0
335 ;; src/geodesic.c/h
336 license:x11
337 ;; Embedded EPSG database.
338 (license:non-copyleft "http://www.epsg.org/TermsOfUse")
339 ;; cmake/*
340 license:boost1.0))))
341
342 (define-public mapnik
343 (package
344 (name "mapnik")
345 (version "3.0.18")
346 (source
347 (origin
348 (method url-fetch)
349 (uri (string-append "https://github.com/mapnik/mapnik/releases/download/v"
350 version "/mapnik-v" version ".tar.bz2"))
351 (sha256
352 (base32
353 "06frcikaj2mgz3abfk5h0z4j3hbksi0zikwjngbjv4p5f3pwxf8q"))))
354 (build-system scons-build-system)
355 (inputs
356 `(("boost" ,boost)
357 ("cairo" ,cairo)
358 ("freetype" ,freetype)
359 ("harfbuzz" ,harfbuzz)
360 ("icu4c" ,icu4c)
361 ("libjpeg-turbo" ,libjpeg-turbo)
362 ("libpng" ,libpng)
363 ("libtiff" ,libtiff)
364 ("libwebp" ,libwebp)
365 ("libxml2" ,libxml2)
366 ("proj.4" ,proj.4)
367 ("sqlite" ,sqlite)
368 ("zlib" ,zlib)))
369 (native-inputs
370 `(("pkg-config" ,pkg-config)))
371 (arguments
372 `(#:scons ,scons-python2
373 #:scons-flags
374 (list "CC=gcc"
375 (string-append "PREFIX=" %output)
376 (string-append "CUSTOM_LDFLAGS=-Wl,-rpath=" %output "/lib"))))
377 (home-page "http://mapnik.org/")
378 (synopsis "Toolkit for developing mapping applications")
379 (description "Mapnik is a toolkit for developing mapping applications. It
380 is basically a collection of geographic objects like maps, layers,
381 datasources, features, and geometries. At its core is a C++ shared library
382 providing algorithms and patterns for spatial data access and visualization.
383 The library does not rely on any specific windowing system and can be deployed
384 to any server environment. It is intended to play fair in a multi-threaded
385 environment and is aimed primarily, but not exclusively, at web-based
386 development.")
387 (license (list license:lgpl2.1+
388 ;; demo/viewer, demo/python/rundemo.py
389 license:gpl2+
390 ;; deps/boost, deps/mapbox, deps/agg/include/agg_conv_offset.h
391 license:boost1.0
392 ;; deps/mapnik/sparsehash
393 license:bsd-3
394 ;; deps/agg
395 (license:non-copyleft "file://deps/agg/copying")))))
396
397 (define-public python2-mapnik
398 (package
399 (name "python2-mapnik")
400 (version "3.0.16")
401 (source
402 (origin
403 (method url-fetch)
404 (uri (string-append "https://github.com/mapnik/python-mapnik/archive/v"
405 version ".tar.gz"))
406 (file-name (string-append name "-" version ".tar.gz"))
407 (sha256
408 (base32
409 "0w7wg72gnwmbjani9sqk42p2jwqkrl9hsdkawahni5m05xsifcb4"))))
410 (build-system python-build-system)
411 (inputs
412 `(("boost" ,boost)
413 ("harfbuzz" ,harfbuzz)
414 ("icu4c" ,icu4c)
415 ("libjpeg-turbo" ,libjpeg-turbo)
416 ("libpng" ,libpng)
417 ("libtiff" ,libtiff)
418 ("libwebp" ,libwebp)
419 ("mapnik" ,mapnik)
420 ("proj.4" ,proj.4)
421 ("python2-pycairo" ,python2-pycairo)))
422 (native-inputs
423 (let ((test-data-input
424 (lambda (repository version hash)
425 (origin
426 (method url-fetch)
427 (uri (string-append "https://github.com/mapnik/" repository
428 "/archive/v" version ".tar.gz"))
429 (file-name (string-append "python-mapnik-" repository
430 "-" version ".tar.gz"))
431 (sha256 (base32 hash))))))
432 `(("python2-nose" ,python2-nose)
433 ;; Test data is released as separate tarballs
434 ("test-data"
435 ,(test-data-input "test-data" "3.0.18"
436 "10cvgn5gxn8ldrszj24zr1vzm5w76kqk4s7bl2zzp5yvkhh8lj1n"))
437 ("test-data-visual"
438 ,(test-data-input "test-data-visual" "3.0.18"
439 "1cb9ghy8sis0w5fkp0dvwxdqqx44rhs9a9w8g9r9i7md1c40r80i")))))
440 (arguments
441 `(#:python ,python-2 ; Python 3 support is incomplete, and the build fails
442 #:phases
443 (modify-phases %standard-phases
444 ;; Unpack test data into the source tree
445 (add-after 'unpack 'unpack-submodules
446 (lambda* (#:key inputs #:allow-other-keys)
447 (let ((unpack (lambda (source target)
448 (with-directory-excursion target
449 (invoke "tar" "xvf" (assoc-ref inputs source)
450 "--strip-components=1")))))
451 (unpack "test-data" "test/data")
452 (unpack "test-data-visual" "test/data-visual"))))
453 ;; Skip failing tests
454 (add-after 'unpack 'skip-tests
455 (lambda _
456 (let ((skipped-tests (list "test_vrt_referring_to_missing_files"
457 "test_unicode_regex_replace"
458 "test_proj_antimeridian_bbox"
459 "test_render_with_scale_factor")))
460 (substitute* "setup.cfg"
461 (("\\[nosetests\\]" all)
462 (string-append all "\nexclude=^("
463 (string-join skipped-tests "|") ")$")))))))))
464 (home-page "https://github.com/mapnik/python-mapnik")
465 (synopsis "Python bindings for Mapnik")
466 (description "This package provides Python bindings for Mapnik.")
467 (license license:lgpl2.1+)))
468
469 (define-public spatialite-gui
470 (package
471 (name "spatialite-gui")
472 (version "1.7.1")
473 (source
474 (origin
475 (method url-fetch)
476 (uri (string-append "https://www.gaia-gis.it/gaia-sins/spatialite_gui-"
477 version ".tar.gz"))
478 (sha256
479 (base32
480 "1r05dz9pyc8vsd2wbqxcsracpfbaamz470rcyp2myfpqwznv376b"))))
481 (build-system gnu-build-system)
482 (native-inputs
483 `(("pkg-config" ,pkg-config)))
484 (inputs
485 `(("freexl" ,freexl)
486 ("geos" ,geos)
487 ("libgaiagraphics" ,libgaiagraphics)
488 ("libspatialite" ,libspatialite)
489 ("libxml2" ,libxml2)
490 ("proj.4" ,proj.4)
491 ("sqlite" ,sqlite)
492 ("wxwidgets" ,wxwidgets-2)
493 ("zlib" ,zlib)))
494 (synopsis "Graphical user interface for SpatiaLite")
495 (description "Spatialite-gui provides a visual interface for viewing and
496 maintaining a spatialite database. You can easily see the structure of the
497 tables and data contents using point and click functions, many of which
498 construct common SQL queries, or craft your own SQL queries.")
499 (home-page "https://www.gaia-gis.it/fossil/spatialite_gui/index")
500 (license license:gpl3+)))
501
502 (define-public r-maps
503 (package
504 (name "r-maps")
505 (version "3.3.0")
506 (source
507 (origin
508 (method url-fetch)
509 (uri (cran-uri "maps" version))
510 (sha256
511 (base32
512 "05i2ppl5z4p8rawgqmy3z4ia05fcblpq1vvrmrkgkkpdlhczx6hr"))))
513 (build-system r-build-system)
514 (home-page "https://cran.r-project.org/web/packages/maps")
515 (synopsis "Draw geographical maps")
516 (description "This package provies an R module for display of maps.
517 Projection code and larger maps are in separate packages ('mapproj' and
518 'mapdata').")
519 (license license:gpl2)))
520
521 (define-public r-mapproj
522 (package
523 (name "r-mapproj")
524 (version "1.2.6")
525 (source
526 (origin
527 (method url-fetch)
528 (uri (cran-uri "mapproj" version))
529 (sha256
530 (base32
531 "1rggww8cbwv0vzlj5afzhbsbngg4bzj5znbkz7wmxsbshfbsm9b2"))))
532 (build-system r-build-system)
533 (propagated-inputs `(("r-maps" ,r-maps)))
534 (home-page "https://cran.r-project.org/web/packages/mapproj")
535 (synopsis "Map projection in R")
536 (description "This package converts latitude/longitude into projected
537 coordinates.")
538 (license (list license:gpl2 ; The R interface
539 (license:non-copyleft ; The C code
540 "https://www.gnu.org/licenses/license-list.en.html#lucent102"
541 "Lucent Public License Version 1.02")))))
542
543 (define-public r-rgooglemaps
544 (package
545 (name "r-rgooglemaps")
546 (version "1.4.1")
547 (source
548 (origin
549 (method url-fetch)
550 (uri (cran-uri "RgoogleMaps" version))
551 (sha256
552 (base32
553 "0fsmlnhl4kw2j4972kfanzw9njhnzk695gsyw8g6yppsmz2clcaq"))))
554 (properties `((upstream-name . "RgoogleMaps")))
555 (build-system r-build-system)
556 (propagated-inputs `(("r-png" ,r-png)))
557 (home-page "https://cran.r-project.org/web/packages/RgoogleMaps")
558 (synopsis "Use Google Maps in R")
559 (description "This package serves two purposes: (i) Provide a comfortable R
560 interface to query the Google server for static maps, and (ii) Use the map as a
561 background image to overlay plots within R. This requires proper coordinate
562 scaling.")
563 (license license:gpl2+)))
564
565 (define-public r-geosphere
566 (package
567 (name "r-geosphere")
568 (version "1.5-7")
569 (source
570 (origin
571 (method url-fetch)
572 (uri (cran-uri "geosphere" version))
573 (sha256
574 (base32
575 "186qdm5niq7v3d4w4rngx71znsgi44hnam7698bsx9ar5mg5b6wx"))))
576 (build-system r-build-system)
577 (propagated-inputs `(("r-sp" ,r-sp)))
578 (home-page "https://cran.r-project.org/web/packages/geosphere")
579 (synopsis "Spherical trigonometry")
580 (description "This package computes spherical trigonometry for geographic
581 applications. That is, compute distances and related measures for angular
582 (longitude/latitude) locations.")
583 (license license:gpl3+)))
584
585 (define-public r-ggmap
586 (package
587 (name "r-ggmap")
588 (version "2.6.1")
589 (source
590 (origin
591 (method url-fetch)
592 (uri (cran-uri "ggmap" version))
593 (sha256
594 (base32
595 "0mssb09w818jv58h7mly9y181pzv22sgcd4a079cfpq04bs0wigw"))))
596 (build-system r-build-system)
597 (propagated-inputs
598 `(("r-digest" ,r-digest)
599 ("r-geosphere" ,r-geosphere)
600 ("r-ggplot2" ,r-ggplot2)
601 ("r-jpeg" ,r-jpeg)
602 ("r-mapproj" ,r-mapproj)
603 ("r-plyr" ,r-plyr)
604 ("r-png" ,r-png)
605 ("r-proto" ,r-proto)
606 ("r-reshape2" ,r-reshape2)
607 ("r-rgooglemaps" ,r-rgooglemaps)
608 ("r-rjson" ,r-rjson)
609 ("r-scales" ,r-scales)))
610 (home-page "https://github.com/dkahle/ggmap")
611 (synopsis "Spatial visualization with ggplot2")
612 (description "This package provides a collection of functions to visualize
613 spatial data and models on top of static maps from various online sources (e.g
614 Google Maps and Stamen Maps). It includes tools common to those tasks,
615 including functions for geolocation and routing.")
616 (license license:gpl2)))
617
618 (define-public gdal
619 (package
620 (name "gdal")
621 (version "2.2.4")
622 (source (origin
623 (method url-fetch)
624 (uri (string-append
625 "http://download.osgeo.org/gdal/" version "/gdal-"
626 version ".tar.gz"))
627 (sha256
628 (base32
629 "1951f7b69x3d1vic0rmq92q8f4bj3hbxnxmj5jl0cc3zg0isgmdr"))
630 (modules '((guix build utils)))
631 (snippet
632 `(begin
633 ;; TODO: frmts contains a lot more bundled code.
634 (for-each delete-file-recursively
635 ;; bundled code
636 '("frmts/png/libpng"
637 "frmts/gif/giflib"
638 "frmts/jpeg/libjpeg"
639 "frmts/jpeg/libjpeg12"
640 "frmts/gtiff/libtiff"
641 "frmts/gtiff/libgeotiff"
642 "frmts/zlib"
643 "ogr/ogrsf_frmts/geojson/libjson"))))))
644 (build-system gnu-build-system)
645 (arguments
646 `(#:tests? #f
647 #:configure-flags
648 (let-syntax ((with (syntax-rules ()
649 ((_ option input)
650 (string-append option "="
651 (assoc-ref %build-inputs input))))))
652 (list
653 ;; TODO: --with-pcidsk, --with-pcraster
654 (with "--with-freexl" "freexl")
655 (with "--with-libjson-c" "json-c")
656 (with "--with-png" "libpng")
657 (with "--with-webp" "libwebp")
658 (with "--with-gif" "giflib")
659 (with "--with-jpeg" "libjpeg-turbo")
660 (with "--with-libtiff" "libtiff")
661 (with "--with-geotiff" "libgeotiff")
662 (with "--with-libz" "zlib")
663 "--with-pcre"))
664 #:phases
665 (modify-phases %standard-phases
666 (add-before 'build 'fix-path
667 (lambda _
668 (substitute* "frmts/mrf/mrf_band.cpp"
669 (("\"../zlib/zlib.h\"") "<zlib.h>")))))))
670 (inputs
671 `(("freexl" ,freexl)
672 ("geos" ,geos)
673 ("giflib" ,giflib)
674 ("json-c" ,json-c)
675 ("libgeotiff" ,libgeotiff)
676 ("libjpeg-turbo" ,libjpeg-turbo)
677 ("libpng" ,libpng)
678 ("libtiff" ,libtiff)
679 ("libwebp" ,libwebp)
680 ("pcre" ,pcre)
681 ("zlib" ,zlib)))
682 (home-page "http://www.gdal.org/")
683 (synopsis "Raster and vector geospatial data format library")
684 (description "GDAL is a translator library for raster and vector geospatial
685 data formats. As a library, it presents a single raster abstract data model
686 and single vector abstract data model to the calling application for all
687 supported formats. It also comes with a variety of useful command line
688 utilities for data translation and processing.")
689 (license (list
690 ;; general license
691 license:expat
692 ;; frmts/gtiff/tif_float.c, frmts/pcraster/libcsf,
693 ;; ogr/ogrsf_frmts/dxf/intronurbs.cpp, frmts/pdf/pdfdataset.cpp
694 ;; frmts/mrf/
695 license:bsd-3
696 ;; frmts/hdf4/hdf-eos/*
697 ;; similar to the expat license, but without guarantee exclusion
698 (license:non-copyleft "file://frmts/hdf4/hdf-eos/README")
699 ;; frmts/grib/degrib/
700 license:public-domain ; with guarantee exclusion
701 ;; port/cpl_minizip*
702 ;; Some bsd-inspired license
703 (license:non-copyleft "file://port/LICENCE_minizip")
704 ;; alg/internal_libqhull
705 ;; Some 5-clause license
706 (license:non-copyleft "file://alg/internal_libqhull/COPYING.txt")
707 ;; frmts/mrf/libLERC
708 license:asl2.0))))
709
710 (define-public postgis
711 (package
712 (name "postgis")
713 (version "2.4.4")
714 (source (origin
715 (method url-fetch)
716 (uri (string-append "https://download.osgeo.org/postgis/source/postgis-"
717 version ".tar.gz"))
718 (sha256
719 (base32
720 "1hm8migjb53cymp4qvg1h20yqllmy9f7x0awv5450391i6syyqq6"))))
721 (build-system gnu-build-system)
722 (arguments
723 `(#:tests? #f
724 #:make-flags
725 (list (string-append "datadir=" (assoc-ref %outputs "out") "/share")
726 (string-append "docdir="(assoc-ref %outputs "out") "/share/doc")
727 (string-append "pkglibdir="(assoc-ref %outputs "out") "/lib")
728 (string-append "bindir=" (assoc-ref %outputs "out") "/bin"))
729 #:phases
730 (modify-phases %standard-phases
731 (add-before 'build 'fix-install-path
732 (lambda* (#:key outputs #:allow-other-keys)
733 (substitute* '("raster/loader/Makefile" "raster/scripts/python/Makefile")
734 (("\\$\\(DESTDIR\\)\\$\\(PGSQL_BINDIR\\)")
735 (string-append (assoc-ref outputs "out") "/bin"))))))))
736 (inputs
737 `(("gdal" ,gdal)
738 ("geos" ,geos)
739 ("libxml2" ,libxml2)
740 ("pcre" ,pcre)
741 ("postgresql" ,postgresql)
742 ("proj.4" ,proj.4)))
743 (native-inputs
744 `(("perl" ,perl)
745 ("pkg-config" ,pkg-config)))
746 (home-page "https://postgis.net")
747 (synopsis "Spatial database extender for PostgreSQL")
748 (description "PostGIS is a spatial database extender for PostgreSQL
749 object-relational database. It adds support for geographic objects allowing
750 location queries to be run in SQL.")
751 (license (list
752 ;; General license
753 license:gpl2+
754 ;; loader/dbfopen, safileio.*, shapefil.h, shpopen.c
755 license:expat
756 ;; loader/getopt.*
757 license:public-domain
758 ;; doc/xsl
759 license:bsd-3 ; files only say "BSD"
760 ;; doc
761 license:cc-by-sa3.0))))