gnu: Add python-plotly.
[jackhill/guix/guix.git] / gnu / packages / geo.scm
CommitLineData
03c1662e
LF
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
ad1ff78d 3;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
f6c507e1 4;;; Copyright © 2017, 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
af63f03f 5;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
8d26f48e 6;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
f2b005f6 7;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
03c1662e
LF
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages geo)
25 #:use-module (guix build-system glib-or-gtk)
065d0125 26 #:use-module (guix build-system gnu)
f25e1e24 27 #:use-module (guix build-system python)
f2b005f6 28 #:use-module (guix build-system scons)
03c1662e 29 #:use-module (guix download)
065d0125 30 #:use-module ((guix licenses) #:prefix license:)
03c1662e
LF
31 #:use-module (guix packages)
32 #:use-module (guix utils)
f2b005f6 33 #:use-module (gnu packages boost)
f25e1e24 34 #:use-module (gnu packages check)
1a39141d 35 #:use-module (gnu packages compression)
f2b005f6
AI
36 #:use-module (gnu packages databases)
37 #:use-module (gnu packages fontutils)
03c1662e
LF
38 #:use-module (gnu packages glib)
39 #:use-module (gnu packages gnome)
40 #:use-module (gnu packages gtk)
1a39141d 41 #:use-module (gnu packages image)
f2b005f6 42 #:use-module (gnu packages icu4c)
03c1662e 43 #:use-module (gnu packages pkg-config)
f2b005f6 44 #:use-module (gnu packages python)
03c1662e 45 #:use-module (gnu packages webkit)
a2a53274 46 #:use-module (gnu packages wxwidgets)
03c1662e
LF
47 #:use-module (gnu packages xml))
48
a7607572
BH
49(define-public geos
50 (package
51 (name "geos")
af63f03f 52 (version "3.6.2")
a7607572
BH
53 (source (origin
54 (method url-fetch)
55 (uri (string-append "http://download.osgeo.org/geos/geos-"
56 version
57 ".tar.bz2"))
58 (sha256
59 (base32
af63f03f 60 "0ak5szby29l9l0vy43dm5z2g92xzdky20q1gc1kah1fnhkgi6nh4"))))
a7607572
BH
61 (build-system gnu-build-system)
62 (arguments `(#:phases
63 (modify-phases %standard-phases
64 (add-after
65 'unpack 'patch-test-shebangs
66 (lambda _
67 (substitute* '("tests/xmltester/testrunner.sh"
68 "tests/geostest/testrunner.sh")
69 (("/bin/sh") (which "sh")))
70 #t)))))
71 (inputs
72 `(("glib" ,glib)))
73 (home-page "https://geos.osgeo.org/")
74 (synopsis "Geometry Engine for Geographic Information Systems")
75 (description
76 "GEOS provides a spatial object model and fundamental geometric
77functions. It is a C++ port of the Java Topology Suite (JTS). As such,
78it aims to contain the complete functionality of JTS in C++. This
79includes all the OpenGIS Simple Features for SQL spatial predicate
80functions and spatial operators, as well as specific JTS enhanced
81topology functions.")
82 (license (list license:lgpl2.1+ ; Main distribution.
83 license:zlib ; tests/xmltester/tinyxml/*
84 license:public-domain)))) ; include/geos/timeval.h
85
03c1662e
LF
86(define-public gnome-maps
87 (package
88 (name "gnome-maps")
67bd376b 89 (version "3.26.2")
03c1662e
LF
90 (source (origin
91 (method url-fetch)
92 (uri (string-append "mirror://gnome/sources/" name "/"
93 (version-major+minor version) "/"
94 name "-" version ".tar.xz"))
95 (sha256
96 (base32
67bd376b 97 "0l40l7m9dyphvasiq1jxrn6ivavs1xwzn0bzz2x1z7x73955q783"))))
03c1662e
LF
98 (build-system glib-or-gtk-build-system)
99 (arguments
67bd376b 100 `(#:configure-flags ;; Ensure that geoclue is referred to by output.
03c1662e
LF
101 (list (string-append "LDFLAGS=-L"
102 (assoc-ref %build-inputs "geoclue") "/lib")
103 (string-append "CFLAGS=-I"
104 (assoc-ref %build-inputs "geoclue") "/include"))
105 #:phases
106 (modify-phases %standard-phases
67bd376b
KK
107 (add-after 'install 'wrap
108 (lambda* (#:key inputs outputs #:allow-other-keys)
109 (let ((out (assoc-ref outputs "out"))
110 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
111 (goa-path (string-append
03c1662e 112 (assoc-ref inputs "gnome-online-accounts")
67bd376b
KK
113 "/lib"))
114 (webkitgtk-path (string-append
115 (assoc-ref inputs "webkitgtk")
116 "/lib")))
117 (wrap-program (string-append out "/bin/gnome-maps")
118 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
03c1662e 119
67bd376b
KK
120 ;; There seems to be no way to embed the path of
121 ;; libgoa-1.0.so.0, libwebkit2gtk-4.0.so.37 and
122 ;; libjavascriptcoregtk-4.0.so.18.
123 `("LD_LIBRARY_PATH" ":" prefix (,goa-path ,webkitgtk-path)))
124 #t))))))
03c1662e
LF
125 (native-inputs
126 `(("gobject-introspection" ,gobject-introspection)
127 ("intltool" ,intltool)
128 ("pkg-config" ,pkg-config)))
129 (inputs
130 `(("folks" ,folks)
131 ("libchamplain" ,libchamplain)
132 ("libgee" ,libgee)
8d26f48e
RW
133 ("libsecret" ,libsecret)
134 ("libsoup" ,libsoup)
135 ("libgweather" ,libgweather)
03c1662e 136 ("libxml2" ,libxml2)
8d26f48e
RW
137 ("gdk-pixbuf" ,gdk-pixbuf)
138 ("glib-networking" ,glib-networking)
03c1662e
LF
139 ("geoclue" ,geoclue)
140 ("geocode-glib" ,geocode-glib)
141 ("gfbgraph" ,gfbgraph)
142 ("gjs" ,gjs)
143 ("glib" ,glib)
144 ("gnome-online-accounts" ,gnome-online-accounts)
8d26f48e 145 ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
03c1662e
LF
146 ("rest" ,rest)
147 ("webkitgtk" ,webkitgtk)))
148 (propagated-inputs
149 `(("gtk+3" ,gtk+)))
150 (synopsis "Graphical map viewer and wayfinding program")
151 (description "GNOME Maps is a graphical map viewer. It uses map data from
152the OpenStreetMap project. It can provide directions for walking, bicycling,
153and driving.")
154 (home-page "https://wiki.gnome.org/Apps/Maps")
065d0125
BH
155 (license license:gpl2+)))
156
22c7c775
BH
157(define-public libgaiagraphics
158 (package
159 (name "libgaiagraphics")
160 (version "0.5")
161 (source
162 (origin
163 (method url-fetch)
164 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libgaiagraphics-"
165 version ".tar.gz"))
166 (sha256
167 (base32
168 "076afqv417ag3hfvnif0qc7qscmnq1dsf6y431yygwgf34rjkayc"))))
169 (build-system gnu-build-system)
170 (native-inputs
171 `(("pkg-config" ,pkg-config)))
172 (inputs
173 `(("cairo" ,cairo)
174 ("libpng" ,libpng)
175 ("libjepeg-turbo" ,libjpeg-turbo)
176 ("libtiff" ,libtiff)
177 ("libgeotiff" ,libgeotiff)
178 ("proj.4" ,proj.4)
179 ("libxml2" ,libxml2)
180 ("zlib" ,zlib)))
181 (synopsis "Gaia common graphics support")
182 (description "libgaiagraphics is a library supporting
183 common-utility raster handling methods.")
184 (home-page "https://www.gaia-gis.it/fossil/libgaiagraphics/index")
185 (license license:lgpl3+)))
186
1a39141d
BH
187(define-public libgeotiff
188 (package
189 (name "libgeotiff")
190 (version "1.4.2")
191 (source
192 (origin
193 (method url-fetch)
194 (uri (string-append "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-"
195 version ".tar.gz"))
196 (sha256
197 (base32
198 "0vjy3bwfhljjx66p9w999i4mdhsf7vjshx29yc3pn5livf5091xd"))
199 (modules '((guix build utils)))
200 (snippet
201 '(begin
202 ;; Remove .csv files, distributed from EPSG under a restricted
203 ;; license. See LICENSE for full license text.
204 (for-each delete-file (find-files "." "\\.csv$"))
205 ;; Now that we have removed the csv files, we need to modify the Makefile.
206 (substitute* "Makefile.in"
207 (("^all-am: .*$")
208 "all-am: Makefile $(LTLIBRARIES) $(HEADERS) geo_config.h\n")
209 (("^install-data-am: .*$")
210 "install-data-am: install-includeHEADERS"))))))
211 (build-system gnu-build-system)
212 (inputs
213 `(("libjpeg-turbo" ,libjpeg-turbo)
214 ("libtiff" ,libtiff)
215 ("proj.4" ,proj.4)
216 ("zlib" ,zlib)))
217 (arguments
218 `(#:configure-flags
219 (list (string-append "--with-zlib")
220 (string-append "--with-jpeg")
221 (string-append "--with-libtiff=" (assoc-ref %build-inputs "libtiff")))))
222 (synopsis "Library for handling GeoTIFF (geographic enabled TIFF)")
223 (description "libgeotiff is a library on top of libtiff for reading and
224writing GeoTIFF information tags.")
225 (home-page "https://trac.osgeo.org/geotiff/")
226 ;; This is a mixture of various contributions under different licenses.
227 ;; Note that the EPSG database is NOT "free to use" as the LICENSE file
228 ;; states, as its commercial redistribution is restricted. Hence, we have
229 ;; removed it from the package.
230 (license (list license:public-domain
231 license:x11
232 license:bsd-3
233 (license:non-copyleft "file://LICENSE"
234 "See LICENSE in the distribution.")))))
235
f6c507e1
BH
236(define-public libspatialite
237 (package
238 (name "libspatialite")
239 (version "4.3.0a")
240 (source
241 (origin
242 (method url-fetch)
243 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libspatialite-"
244 version ".tar.gz"))
245 (sha256
246 (base32
247 "16d4lpl7xrm9zy4gphy6nwanpjp8wn9g4wq2i2kh8abnlhq01448"))))
248 (build-system gnu-build-system)
249 (native-inputs
250 `(("pkg-config" ,pkg-config)))
251 (inputs
252 `(("freexl" ,freexl)
253 ("geos" ,geos)
254 ("libxml2" ,libxml2)
255 ("proj.4" ,proj.4)
256 ("sqlite" ,sqlite)
257 ("zlib" ,zlib)))
258 (arguments
259 `(#:phases
260 (modify-phases %standard-phases
261 ;; 3 tests are failing, ignore them:
262 (add-after 'unpack 'ignore-broken-tests
263 (lambda _
264 (substitute* '("test/Makefile.in")
265 (("\tcheck_sql_stm.*" all) "\tcheck_multithread$(EXEEXT) \\\n")
266 (("(\tch.*) check_v.*ble2.*$" all vt1) (string-append vt1 " \\\n"))
267 (("\tch.* (check_v.*ble4.*)$" all vt4) (string-append "\t" vt4)))
268 #t)))))
269 (synopsis "Extend SQLite to support Spatial SQL capabilities")
270 (description
271 "SpatiaLite is a library intended to extend the SQLite core to support
272fully fledged Spatial SQL capabilities.")
273 (home-page "https://www.gaia-gis.it/fossil/libspatialite/index")
274 ;; For the genuine libspatialite-sources holds:
275 ;; Any of the licenses MPL1.1, GPL2+ or LGPL2.1+ may be picked.
276 ;; Files under src/control_points are from GRASS
277 ;; and are licensed under GPL2+ only.
278 ;; src/md5.[ch]: Placed into the public domain by Alexander Peslyak.
279 (license (list license:gpl2+
280 license:lgpl2.1+
281 license:mpl1.1
282 license:public-domain))))
283
065d0125
BH
284(define-public proj.4
285 (package
286 (name "proj.4")
287 (version "4.9.3")
288 (source (origin
289 (method url-fetch)
290 (uri (string-append "http://download.osgeo.org/proj/proj-"
291 version ".tar.gz"))
292 (sha256
293 (base32
294 "1xw5f427xk9p2nbsj04j6m5zyjlyd66sbvl2bkg8hd1kx8pm9139"))))
295 (build-system gnu-build-system)
296 (arguments
297 `(#:phases
298 (modify-phases %standard-phases
299 (add-after 'unpack 'patch-test-paths
300 (lambda _
301 (substitute* '("nad/test27"
302 "nad/test83"
303 "nad/testvarious"
304 "nad/testdatumfile"
305 "nad/testflaky"
306 "nad/testIGNF")
307 (("/bin/rm") (which "rm")))
308 #t))
309 ;; Precision problems on i686 and other platforms. See:
310 ;; https://web.archive.org/web/20151006134301/http://trac.osgeo.org/proj/ticket/255
311 ;; Disable failing test.
312 (add-after 'patch-test-paths 'ignore-failing-tests
313 (lambda _
314 (substitute* '("nad/Makefile.in")
315 (("\tPROJ_LIB.*" all) (string-append "#" all)))
316 #t)))))
317 (inputs
318 `(("glib" ,glib)))
319 (home-page "http://proj4.org/")
320 (synopsis "Cartographic Projections Library")
321 (description
322 "Proj.4 is a library for converting coordinates between cartographic
323projections.")
324 (license (list license:expat
325 ;; src/PJ_patterson.c
326 license:asl2.0
327 ;; src/geodesic.c/h
328 license:x11
329 ;; Embedded EPSG database.
330 (license:non-copyleft "http://www.epsg.org/TermsOfUse")
331 ;; cmake/*
332 license:boost1.0))))
f2b005f6
AI
333
334(define-public mapnik
335 (package
336 (name "mapnik")
337 (version "3.0.18")
338 (source
339 (origin
340 (method url-fetch)
341 (uri (string-append "https://github.com/mapnik/mapnik/releases/download/v"
342 version "/mapnik-v" version ".tar.bz2"))
343 (sha256
344 (base32
345 "06frcikaj2mgz3abfk5h0z4j3hbksi0zikwjngbjv4p5f3pwxf8q"))))
346 (build-system scons-build-system)
347 (inputs
348 `(("boost" ,boost)
349 ("cairo" ,cairo)
350 ("freetype" ,freetype)
351 ("harfbuzz" ,harfbuzz)
352 ("icu4c" ,icu4c)
353 ("libjpeg-turbo" ,libjpeg-turbo)
354 ("libpng" ,libpng)
355 ("libtiff" ,libtiff)
356 ("libwebp" ,libwebp)
357 ("libxml2" ,libxml2)
358 ("proj.4" ,proj.4)
359 ("sqlite" ,sqlite)
360 ("zlib" ,zlib)))
361 (native-inputs
362 `(("pkg-config" ,pkg-config)))
363 (arguments
364 `(#:scons ,scons-python2
365 #:scons-flags
366 (list "CC=gcc"
367 (string-append "PREFIX=" %output)
368 (string-append "CUSTOM_LDFLAGS=-Wl,-rpath=" %output "/lib"))))
369 (home-page "http://mapnik.org/")
370 (synopsis "Toolkit for developing mapping applications")
371 (description "Mapnik is a toolkit for developing mapping applications. It
372is basically a collection of geographic objects like maps, layers,
373datasources, features, and geometries. At its core is a C++ shared library
374providing algorithms and patterns for spatial data access and visualization.
375The library does not rely on any specific windowing system and can be deployed
376to any server environment. It is intended to play fair in a multi-threaded
377environment and is aimed primarily, but not exclusively, at web-based
378development.")
379 (license (list license:lgpl2.1+
380 ;; demo/viewer, demo/python/rundemo.py
381 license:gpl2+
382 ;; deps/boost, deps/mapbox, deps/agg/include/agg_conv_offset.h
383 license:boost1.0
384 ;; deps/mapnik/sparsehash
385 license:bsd-3
386 ;; deps/agg
387 (license:non-copyleft "file://deps/agg/copying")))))
388
f25e1e24
AI
389(define-public python2-mapnik
390 (package
391 (name "python2-mapnik")
392 (version "3.0.16")
393 (source
394 (origin
395 (method url-fetch)
396 (uri (string-append "https://github.com/mapnik/python-mapnik/archive/v"
397 version ".tar.gz"))
398 (file-name (string-append name "-" version ".tar.gz"))
399 (sha256
400 (base32
401 "0w7wg72gnwmbjani9sqk42p2jwqkrl9hsdkawahni5m05xsifcb4"))))
402 (build-system python-build-system)
403 (inputs
404 `(("boost" ,boost)
405 ("harfbuzz" ,harfbuzz)
406 ("icu4c" ,icu4c)
407 ("libjpeg-turbo" ,libjpeg-turbo)
408 ("libpng" ,libpng)
409 ("libtiff" ,libtiff)
410 ("libwebp" ,libwebp)
411 ("mapnik" ,mapnik)
412 ("proj.4" ,proj.4)
413 ("python2-pycairo" ,python2-pycairo)))
414 (native-inputs
415 (let ((test-data-input
416 (lambda (repository version hash)
417 (origin
418 (method url-fetch)
419 (uri (string-append "https://github.com/mapnik/" repository
420 "/archive/v" version ".tar.gz"))
421 (file-name (string-append "python-mapnik-" repository
422 "-" version ".tar.gz"))
423 (sha256 (base32 hash))))))
424 `(("python2-nose" ,python2-nose)
425 ;; Test data is released as separate tarballs
426 ("test-data"
427 ,(test-data-input "test-data" "3.0.18"
428 "10cvgn5gxn8ldrszj24zr1vzm5w76kqk4s7bl2zzp5yvkhh8lj1n"))
429 ("test-data-visual"
430 ,(test-data-input "test-data-visual" "3.0.18"
431 "1cb9ghy8sis0w5fkp0dvwxdqqx44rhs9a9w8g9r9i7md1c40r80i")))))
432 (arguments
433 `(#:python ,python-2 ; Python 3 support is incomplete, and the build fails
434 #:phases
435 (modify-phases %standard-phases
436 ;; Unpack test data into the source tree
437 (add-after 'unpack 'unpack-submodules
438 (lambda* (#:key inputs #:allow-other-keys)
439 (let ((unpack (lambda (source target)
440 (with-directory-excursion target
441 (invoke "tar" "xvf" (assoc-ref inputs source)
442 "--strip-components=1")))))
443 (unpack "test-data" "test/data")
444 (unpack "test-data-visual" "test/data-visual"))))
445 ;; Skip failing tests
446 (add-after 'unpack 'skip-tests
447 (lambda _
448 (let ((skipped-tests (list "test_vrt_referring_to_missing_files"
449 "test_unicode_regex_replace"
450 "test_proj_antimeridian_bbox"
451 "test_render_with_scale_factor")))
452 (substitute* "setup.cfg"
453 (("\\[nosetests\\]" all)
454 (string-append all "\nexclude=^("
455 (string-join skipped-tests "|") ")$")))))))))
456 (home-page "https://github.com/mapnik/python-mapnik")
457 (synopsis "Python bindings for Mapnik")
458 (description "This package provides Python bindings for Mapnik.")
459 (license license:lgpl2.1+)))
a2a53274
BH
460
461(define-public spatialite-gui
462 (package
463 (name "spatialite-gui")
464 (version "1.7.1")
465 (source
466 (origin
467 (method url-fetch)
468 (uri (string-append "https://www.gaia-gis.it/gaia-sins/spatialite_gui-"
469 version ".tar.gz"))
470 (sha256
471 (base32
472 "1r05dz9pyc8vsd2wbqxcsracpfbaamz470rcyp2myfpqwznv376b"))))
473 (build-system gnu-build-system)
474 (native-inputs
475 `(("pkg-config" ,pkg-config)))
476 (inputs
477 `(("freexl" ,freexl)
478 ("geos" ,geos)
479 ("libgaiagraphics" ,libgaiagraphics)
480 ("libspatialite" ,libspatialite)
481 ("libxml2" ,libxml2)
482 ("proj.4" ,proj.4)
483 ("sqlite" ,sqlite)
484 ("wxwidgets" ,wxwidgets-2)
485 ("zlib" ,zlib)))
486 (synopsis "Graphical user interface for SpatiaLite")
487 (description "Spatialite-gui provides a visual interface for viewing and
488 maintaining a spatialite database. You can easily see the structure of the
489 tables and data contents using point and click functions, many of which
490 construct common SQL queries, or craft your own SQL queries.")
491 (home-page "https://www.gaia-gis.it/fossil/spatialite_gui/index")
492 (license license:gpl3+)))