Merge branch 'staging' into core-updates
[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 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 astronomy)
50 #:use-module (gnu packages autotools)
51 #:use-module (gnu packages boost)
52 #:use-module (gnu packages check)
53 #:use-module (gnu packages compression)
54 #:use-module (gnu packages databases)
55 #:use-module (gnu packages datastructures)
56 #:use-module (gnu packages documentation)
57 #:use-module (gnu packages fonts)
58 #:use-module (gnu packages fontutils)
59 #:use-module (gnu packages glib)
60 #:use-module (gnu packages gnome)
61 #:use-module (gnu packages gtk)
62 #:use-module (gnu packages image)
63 #:use-module (gnu packages icu4c)
64 #:use-module (gnu packages java)
65 #:use-module (gnu packages lua)
66 #:use-module (gnu packages maths)
67 #:use-module (gnu packages pcre)
68 #:use-module (gnu packages perl)
69 #:use-module (gnu packages pkg-config)
70 #:use-module (gnu packages protobuf)
71 #:use-module (gnu packages python)
72 #:use-module (gnu packages python-web)
73 #:use-module (gnu packages python-xyz)
74 #:use-module (gnu packages qt)
75 #:use-module (gnu packages sqlite)
76 #:use-module (gnu packages web)
77 #:use-module (gnu packages webkit)
78 #:use-module (gnu packages wxwidgets)
79 #:use-module (gnu packages xml))
80
81 (define-public geos
82 (package
83 (name "geos")
84 (version "3.8.0")
85 (source (origin
86 (method url-fetch)
87 (uri (string-append "http://download.osgeo.org/geos/geos-"
88 version
89 ".tar.bz2"))
90 (sha256
91 (base32
92 "1mb2v9fy1gnbjhcgv0xny11ggfb17vkzsajdyibigwsxr4ylq4cr"))))
93 (build-system gnu-build-system)
94 (arguments `(#:phases
95 (modify-phases %standard-phases
96 (add-after
97 'unpack 'patch-test-shebangs
98 (lambda _
99 (substitute* '("tests/xmltester/testrunner.sh"
100 "tests/geostest/testrunner.sh")
101 (("/bin/sh") (which "sh")))
102 #t)))))
103 (inputs
104 `(("glib" ,glib)))
105 (home-page "https://geos.osgeo.org/")
106 (synopsis "Geometry Engine for Geographic Information Systems")
107 (description
108 "GEOS provides a spatial object model and fundamental geometric
109 functions. It is a C++ port of the Java Topology Suite (JTS). As such,
110 it aims to contain the complete functionality of JTS in C++. This
111 includes all the OpenGIS Simple Features for SQL spatial predicate
112 functions and spatial operators, as well as specific JTS enhanced
113 topology functions.")
114 (license (list license:lgpl2.1+ ; Main distribution.
115 license:zlib ; tests/xmltester/tinyxml/*
116 license:public-domain)))) ; include/geos/timeval.h
117
118 (define-public gnome-maps
119 (package
120 (name "gnome-maps")
121 (version "3.32.2.1")
122 (source (origin
123 (method url-fetch)
124 (uri (string-append "mirror://gnome/sources/" name "/"
125 (version-major+minor version) "/"
126 name "-" version ".tar.xz"))
127 (sha256
128 (base32
129 "1m191iq1gjaqz79ci3dkbmwrkxp7pzknngimlf5bqib5x8yairlb"))))
130 (build-system meson-build-system)
131 (arguments
132 `(#:glib-or-gtk? #t
133 #:phases
134 (modify-phases %standard-phases
135 (add-after 'unpack 'skip-gtk-update-icon-cache
136 ;; Don't create 'icon-theme.cache'.
137 (lambda _
138 (substitute* "meson_post_install.py"
139 (("gtk-update-icon-cache") "true"))
140 #t))
141 (add-after 'install 'wrap
142 (lambda* (#:key inputs outputs #:allow-other-keys)
143 (let ((out (assoc-ref outputs "out"))
144 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
145 (geocode-glib-path (string-append
146 (assoc-ref inputs "geocode-glib")
147 "/lib"))
148 (goa-path (string-append
149 (assoc-ref inputs "gnome-online-accounts:lib")
150 "/lib"))
151 (gdk-pixbuf-path (string-append
152 (assoc-ref inputs "gdk-pixbuf")
153 "/lib"))
154 (webkitgtk-path (string-append
155 (assoc-ref inputs "webkitgtk")
156 "/lib")))
157 (wrap-program (string-append out "/bin/gnome-maps")
158 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
159
160 ;; There seems to be no way to embed the path of
161 ;; libgoa-1.0.so.0, libwebkit2gtk-4.0.so.37,
162 ;; libgdk_pixbuf-2.0.so, libjavascriptcoregtk-4.0.so.18, and
163 ;; libgeocode-glib.so.0
164 `("LD_LIBRARY_PATH" ":" prefix (,goa-path
165 ,webkitgtk-path
166 ,gdk-pixbuf-path
167 ,geocode-glib-path)))
168 #t))))))
169 (native-inputs
170 `(("gobject-introspection" ,gobject-introspection)
171 ("intltool" ,intltool)
172 ("pkg-config" ,pkg-config)))
173 (inputs
174 `(("folks" ,folks)
175 ("libchamplain" ,libchamplain)
176 ("libgee" ,libgee)
177 ("libsecret" ,libsecret)
178 ("libsoup" ,libsoup)
179 ("libgweather" ,libgweather)
180 ("libxml2" ,libxml2)
181 ("gdk-pixbuf" ,gdk-pixbuf+svg)
182 ("glib-networking" ,glib-networking)
183 ("geoclue" ,geoclue)
184 ("geocode-glib" ,geocode-glib)
185 ("gfbgraph" ,gfbgraph)
186 ("gjs" ,gjs)
187 ("glib" ,glib)
188 ("gnome-online-accounts:lib" ,gnome-online-accounts "lib")
189 ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
190 ("rest" ,rest)
191 ("webkitgtk" ,webkitgtk)))
192 (propagated-inputs
193 `(("gtk+3" ,gtk+)))
194 (synopsis "Graphical map viewer and wayfinding program")
195 (description "GNOME Maps is a graphical map viewer. It uses map data from
196 the OpenStreetMap project. It can provide directions for walking, bicycling,
197 and driving.")
198 (home-page "https://wiki.gnome.org/Apps/Maps")
199 (license license:gpl2+)))
200
201 (define-public libgaiagraphics
202 (package
203 (name "libgaiagraphics")
204 (version "0.5")
205 (source
206 (origin
207 (method url-fetch)
208 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libgaiagraphics-"
209 version ".tar.gz"))
210 (sha256
211 (base32
212 "076afqv417ag3hfvnif0qc7qscmnq1dsf6y431yygwgf34rjkayc"))))
213 (build-system gnu-build-system)
214 (native-inputs
215 `(("pkg-config" ,pkg-config)))
216 (inputs
217 `(("cairo" ,cairo)
218 ("libpng" ,libpng)
219 ("libjpeg-turbo" ,libjpeg-turbo)
220 ("libtiff" ,libtiff)
221 ("libgeotiff" ,libgeotiff)
222 ("proj.4" ,proj.4)
223 ("libxml2" ,libxml2)
224 ("zlib" ,zlib)))
225 (synopsis "Gaia common graphics support")
226 (description "libgaiagraphics is a library supporting
227 common-utility raster handling methods.")
228 (home-page "https://www.gaia-gis.it/fossil/libgaiagraphics/index")
229 (license license:lgpl3+)))
230
231 (define-public libgeotiff
232 (package
233 (name "libgeotiff")
234 (version "1.5.1")
235 (source
236 (origin
237 (method url-fetch)
238 (uri (string-append "http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-"
239 version ".tar.gz"))
240 (patches (search-patches
241 ;; See libgeotiff 1.5.1 issue
242 ;; https://github.com/OSGeo/libgeotiff/issues/22
243 "libgeotiff-adapt-test-script-for-proj-6.2.patch"))
244 (sha256
245 (base32 "0b31mlzcv5b1y7jdvb7p0pa3xradrg3x5g32ym911lbhq4rrgsgr"))
246 (modules '((guix build utils)))
247 (snippet
248 '(begin
249 ;; Remove .csv files, distributed from EPSG under a restricted
250 ;; license. See LICENSE for full license text.
251 (for-each delete-file (find-files "." "\\.csv$"))
252 #t))))
253 (build-system gnu-build-system)
254 (inputs
255 `(("libjpeg-turbo" ,libjpeg-turbo)
256 ("libtiff" ,libtiff)
257 ("zlib" ,zlib)))
258 (propagated-inputs
259 `(;; libgeotiff headers include proj headers, so ensure those are available.
260 ("proj" ,proj)))
261 (arguments
262 `(#:configure-flags
263 (list "--disable-static"
264 "--with-zlib" "--with-jpeg"
265 (string-append "--with-libtiff=" (assoc-ref %build-inputs "libtiff")))))
266 (synopsis "Library for handling GeoTIFF (geographic enabled TIFF)")
267 (description "libgeotiff is a library on top of libtiff for reading and
268 writing GeoTIFF information tags.")
269 (home-page "https://trac.osgeo.org/geotiff/")
270 ;; This is a mixture of various contributions under different licenses.
271 ;; Note that the EPSG database is NOT "free to use" as the LICENSE file
272 ;; states, as its commercial redistribution is restricted. Hence, we have
273 ;; removed it from the package.
274 (license (list license:public-domain
275 license:x11
276 license:bsd-3
277 (license:non-copyleft "file://LICENSE"
278 "See LICENSE in the distribution.")))))
279
280 (define-public libspatialite
281 (package
282 (name "libspatialite")
283 (version "4.3.0a")
284 (source
285 (origin
286 (method url-fetch)
287 (uri (string-append "https://www.gaia-gis.it/gaia-sins/libspatialite-"
288 version ".tar.gz"))
289 (sha256
290 (base32
291 "16d4lpl7xrm9zy4gphy6nwanpjp8wn9g4wq2i2kh8abnlhq01448"))))
292 (build-system gnu-build-system)
293 (native-inputs
294 `(("pkg-config" ,pkg-config)))
295 (inputs
296 `(("freexl" ,freexl)
297 ("geos" ,geos)
298 ("libxml2" ,libxml2)
299 ("proj.4" ,proj.4)
300 ("sqlite" ,sqlite)
301 ("zlib" ,zlib)))
302 (arguments
303 `(#:phases
304 (modify-phases %standard-phases
305 ;; 3 tests are failing, ignore them:
306 (add-after 'unpack 'ignore-broken-tests
307 (lambda _
308 (substitute* '("test/Makefile.in")
309 (("\tcheck_sql_stm.*" all) "\tcheck_multithread$(EXEEXT) \\\n")
310 (("(\tch.*) check_v.*ble2.*$" all vt1) (string-append vt1 " \\\n"))
311 (("\tch.* (check_v.*ble4.*)$" all vt4) (string-append "\t" vt4)))
312 #t)))))
313 (synopsis "Extend SQLite to support Spatial SQL capabilities")
314 (description
315 "SpatiaLite is a library intended to extend the SQLite core to support
316 fully fledged Spatial SQL capabilities.")
317 (home-page "https://www.gaia-gis.it/fossil/libspatialite/index")
318 ;; For the genuine libspatialite-sources holds:
319 ;; Any of the licenses MPL1.1, GPL2+ or LGPL2.1+ may be picked.
320 ;; Files under src/control_points are from GRASS
321 ;; and are licensed under GPL2+ only.
322 ;; src/md5.[ch]: Placed into the public domain by Alexander Peslyak.
323 (license (list license:gpl2+
324 license:lgpl2.1+
325 license:mpl1.1
326 license:public-domain))))
327
328 (define-public proj
329 (package
330 (name "proj")
331 (version "6.2.0")
332 (source
333 (origin
334 (method url-fetch)
335 (uri (string-append "http://download.osgeo.org/proj/proj-"
336 version ".tar.gz"))
337 (sha256
338 (base32
339 "0l1as8f4zfg74fms6h5p5psziw0lpznja1xnirzsscpnfbwc005k"))))
340 (build-system gnu-build-system)
341 (inputs
342 `(("sqlite" ,sqlite)))
343 (native-inputs
344 `(("pkg-config" ,pkg-config)))
345 (home-page "https://proj.org/")
346 (synopsis "Coordinate transformation software")
347 (description
348 "Proj is a generic coordinate transformation software that transforms
349 geospatial coordinates from one coordinate reference system (CRS) to another.
350 This includes cartographic projections as well as geodetic transformations.
351 PROJ includes command line applications for easy conversion of coordinates
352 from text files or directly from user input. In addition, proj also exposes
353 an application programming interface that lets developers use the
354 functionality of proj in their own software.")
355 (license (list license:expat
356 ;; src/projections/patterson.cpp
357 license:asl2.0
358 ;; src/geodesic.*, src/tests/geodtest.cpp
359 license:x11))))
360
361 (define-public proj.4
362 (package
363 (name "proj.4")
364 (version "4.9.3")
365 (source (origin
366 (method url-fetch)
367 (uri (string-append "http://download.osgeo.org/proj/proj-"
368 version ".tar.gz"))
369 (sha256
370 (base32
371 "1xw5f427xk9p2nbsj04j6m5zyjlyd66sbvl2bkg8hd1kx8pm9139"))))
372 (build-system gnu-build-system)
373 (arguments
374 `(#:phases
375 (modify-phases %standard-phases
376 (add-after 'unpack 'patch-test-paths
377 (lambda _
378 (substitute* '("nad/test27"
379 "nad/test83"
380 "nad/testvarious"
381 "nad/testdatumfile"
382 "nad/testflaky"
383 "nad/testIGNF")
384 (("/bin/rm") (which "rm")))
385 #t))
386 ;; Precision problems on i686 and other platforms. See:
387 ;; https://web.archive.org/web/20151006134301/http://trac.osgeo.org/proj/ticket/255
388 ;; Disable failing test.
389 (add-after 'patch-test-paths 'ignore-failing-tests
390 (lambda _
391 (substitute* '("nad/Makefile.in")
392 (("\tPROJ_LIB.*" all) (string-append "#" all)))
393 #t)))))
394 (inputs
395 `(("glib" ,glib)))
396 (home-page "http://proj4.org/")
397 (synopsis "Cartographic Projections Library")
398 (description
399 "Proj.4 is a library for converting coordinates between cartographic
400 projections.")
401 (license (list license:expat
402 ;; src/PJ_patterson.c
403 license:asl2.0
404 ;; src/geodesic.c/h
405 license:x11
406 ;; Embedded EPSG database.
407 (license:non-copyleft "http://www.epsg.org/TermsOfUse")
408 ;; cmake/*
409 license:boost1.0))))
410
411 (define-public mapnik
412 (package
413 (name "mapnik")
414 (version "3.0.18")
415 (source
416 (origin
417 (method url-fetch)
418 (uri (string-append "https://github.com/mapnik/mapnik/releases/download/v"
419 version "/mapnik-v" version ".tar.bz2"))
420 (sha256
421 (base32
422 "06frcikaj2mgz3abfk5h0z4j3hbksi0zikwjngbjv4p5f3pwxf8q"))))
423 (build-system scons-build-system)
424 (inputs
425 `(("boost" ,boost)
426 ("cairo" ,cairo)
427 ("freetype" ,freetype)
428 ("harfbuzz" ,harfbuzz)
429 ("icu4c" ,icu4c)
430 ("libjpeg-turbo" ,libjpeg-turbo)
431 ("libpng" ,libpng)
432 ("libtiff" ,libtiff)
433 ("libwebp" ,libwebp)
434 ("libxml2" ,libxml2)
435 ("proj.4" ,proj.4)
436 ("sqlite" ,sqlite)
437 ("zlib" ,zlib)))
438 (native-inputs
439 `(("pkg-config" ,pkg-config)))
440 (arguments
441 `(#:scons ,scons-python2
442 #:scons-flags
443 (list "CC=gcc"
444 (string-append "PREFIX=" %output)
445 (string-append "CUSTOM_LDFLAGS=-Wl,-rpath=" %output "/lib"))))
446 (home-page "http://mapnik.org/")
447 (synopsis "Toolkit for developing mapping applications")
448 (description "Mapnik is a toolkit for developing mapping applications. It
449 is basically a collection of geographic objects like maps, layers,
450 datasources, features, and geometries. At its core is a C++ shared library
451 providing algorithms and patterns for spatial data access and visualization.
452 The library does not rely on any specific windowing system and can be deployed
453 to any server environment. It is intended to play fair in a multi-threaded
454 environment and is aimed primarily, but not exclusively, at web-based
455 development.")
456 (license (list license:lgpl2.1+
457 ;; demo/viewer, demo/python/rundemo.py
458 license:gpl2+
459 ;; deps/boost, deps/mapbox, deps/agg/include/agg_conv_offset.h
460 license:boost1.0
461 ;; deps/mapnik/sparsehash
462 license:bsd-3
463 ;; deps/agg
464 (license:non-copyleft "file://deps/agg/copying")))))
465
466 (define-public python2-mapnik
467 (package
468 (name "python2-mapnik")
469 (version "3.0.16")
470 (source
471 (origin
472 (method url-fetch)
473 (uri (string-append "https://github.com/mapnik/python-mapnik/archive/v"
474 version ".tar.gz"))
475 (file-name (string-append name "-" version ".tar.gz"))
476 (sha256
477 (base32
478 "0w7wg72gnwmbjani9sqk42p2jwqkrl9hsdkawahni5m05xsifcb4"))))
479 (build-system python-build-system)
480 (inputs
481 `(("boost" ,boost)
482 ("harfbuzz" ,harfbuzz)
483 ("icu4c" ,icu4c)
484 ("libjpeg-turbo" ,libjpeg-turbo)
485 ("libpng" ,libpng)
486 ("libtiff" ,libtiff)
487 ("libwebp" ,libwebp)
488 ("mapnik" ,mapnik)
489 ("proj.4" ,proj.4)
490 ("python2-pycairo" ,python2-pycairo)))
491 (native-inputs
492 (let ((test-data-input
493 (lambda (repository version hash)
494 (origin
495 (method url-fetch)
496 (uri (string-append "https://github.com/mapnik/" repository
497 "/archive/v" version ".tar.gz"))
498 (file-name (string-append "python-mapnik-" repository
499 "-" version ".tar.gz"))
500 (sha256 (base32 hash))))))
501 `(("python2-nose" ,python2-nose)
502 ;; Test data is released as separate tarballs
503 ("test-data"
504 ,(test-data-input "test-data" "3.0.18"
505 "10cvgn5gxn8ldrszj24zr1vzm5w76kqk4s7bl2zzp5yvkhh8lj1n"))
506 ("test-data-visual"
507 ,(test-data-input "test-data-visual" "3.0.18"
508 "1cb9ghy8sis0w5fkp0dvwxdqqx44rhs9a9w8g9r9i7md1c40r80i")))))
509 (arguments
510 `(#:python ,python-2 ; Python 3 support is incomplete, and the build fails
511 #:phases
512 (modify-phases %standard-phases
513 ;; Unpack test data into the source tree
514 (add-after 'unpack 'unpack-submodules
515 (lambda* (#:key inputs #:allow-other-keys)
516 (let ((unpack (lambda (source target)
517 (with-directory-excursion target
518 (invoke "tar" "xvf" (assoc-ref inputs source)
519 "--strip-components=1")))))
520 (unpack "test-data" "test/data")
521 (unpack "test-data-visual" "test/data-visual"))))
522 ;; Skip failing tests
523 (add-after 'unpack 'skip-tests
524 (lambda _
525 (let ((skipped-tests (list "test_vrt_referring_to_missing_files"
526 "test_unicode_regex_replace"
527 "test_proj_antimeridian_bbox"
528 "test_render_with_scale_factor")))
529 (substitute* "setup.cfg"
530 (("\\[nosetests\\]" all)
531 (string-append all "\nexclude=^("
532 (string-join skipped-tests "|") ")$")))))))))
533 (home-page "https://github.com/mapnik/python-mapnik")
534 (synopsis "Python bindings for Mapnik")
535 (description "This package provides Python bindings for Mapnik.")
536 (license license:lgpl2.1+)))
537
538 (define-public spatialite-gui
539 (package
540 (name "spatialite-gui")
541 (version "1.7.1")
542 (source
543 (origin
544 (method url-fetch)
545 (uri (string-append "https://www.gaia-gis.it/gaia-sins/spatialite_gui-"
546 version ".tar.gz"))
547 (sha256
548 (base32
549 "1r05dz9pyc8vsd2wbqxcsracpfbaamz470rcyp2myfpqwznv376b"))))
550 (build-system gnu-build-system)
551 (native-inputs
552 `(("pkg-config" ,pkg-config)))
553 (inputs
554 `(("freexl" ,freexl)
555 ("geos" ,geos)
556 ("libgaiagraphics" ,libgaiagraphics)
557 ("libspatialite" ,libspatialite)
558 ("libxml2" ,libxml2)
559 ("proj.4" ,proj.4)
560 ("sqlite" ,sqlite)
561 ("wxwidgets" ,wxwidgets-2)
562 ("zlib" ,zlib)))
563 (synopsis "Graphical user interface for SpatiaLite")
564 (description "Spatialite-gui provides a visual interface for viewing and
565 maintaining a spatialite database. You can easily see the structure of the
566 tables and data contents using point and click functions, many of which
567 construct common SQL queries, or craft your own SQL queries.")
568 (home-page "https://www.gaia-gis.it/fossil/spatialite_gui/index")
569 (license license:gpl3+)))
570
571 (define-public gdal
572 (package
573 (name "gdal")
574 (version "3.0.2")
575 (source (origin
576 (method url-fetch)
577 (uri (string-append
578 "http://download.osgeo.org/gdal/" version "/gdal-"
579 version ".tar.gz"))
580 (sha256
581 (base32
582 "0f80izh9wshrsw55kg9abpip74hk6frk3hgqrkqbyn3f6i8g2z3q"))
583 (modules '((guix build utils)))
584 (snippet
585 `(begin
586 ;; TODO: frmts contains a lot more bundled code.
587 (for-each delete-file-recursively
588 ;; bundled code
589 '("frmts/png/libpng"
590 "frmts/gif/giflib"
591 "frmts/jpeg/libjpeg"
592 "frmts/jpeg/libjpeg12"
593 "frmts/gtiff/libtiff"
594 "frmts/gtiff/libgeotiff"
595 "frmts/zlib"
596 "ogr/ogrsf_frmts/geojson/libjson"))))))
597 (build-system gnu-build-system)
598 (arguments
599 `(#:tests? #f
600 #:configure-flags
601 (let-syntax ((with (syntax-rules ()
602 ((_ option input)
603 (string-append option "="
604 (assoc-ref %build-inputs input))))))
605 (list
606 ;; TODO: --with-pcidsk, --with-pcraster
607 (with "--with-freexl" "freexl")
608 (with "--with-libjson-c" "json-c")
609 (with "--with-png" "libpng")
610 (with "--with-webp" "libwebp")
611 (with "--with-gif" "giflib")
612 (with "--with-jpeg" "libjpeg-turbo")
613 (with "--with-libtiff" "libtiff")
614 (with "--with-geotiff" "libgeotiff")
615 (with "--with-libz" "zlib")
616 (with "--with-expat" "expat")
617 (with "--with-sqlite3" "sqlite")
618 "--with-pcre"))
619 #:phases
620 (modify-phases %standard-phases
621 (add-before 'build 'fix-path
622 (lambda _
623 (substitute* "frmts/mrf/mrf_band.cpp"
624 (("\"../zlib/zlib.h\"") "<zlib.h>")))))))
625 (inputs
626 `(("expat" ,expat)
627 ("freexl" ,freexl)
628 ("geos" ,geos)
629 ("giflib" ,giflib)
630 ("json-c" ,json-c)
631 ("libgeotiff" ,libgeotiff)
632 ("libjpeg-turbo" ,libjpeg-turbo)
633 ("libpng" ,libpng)
634 ("libtiff" ,libtiff)
635 ("libwebp" ,libwebp)
636 ("netcdf" ,netcdf)
637 ("pcre" ,pcre)
638 ("proj" ,proj)
639 ("sqlite" ,sqlite)
640 ("zlib" ,zlib)))
641 (home-page "https://gdal.org/")
642 (synopsis "Raster and vector geospatial data format library")
643 (description "GDAL is a translator library for raster and vector geospatial
644 data formats. As a library, it presents a single raster abstract data model
645 and single vector abstract data model to the calling application for all
646 supported formats. It also comes with a variety of useful command line
647 utilities for data translation and processing.")
648 (license (list
649 ;; general license
650 license:expat
651 ;; frmts/gtiff/tif_float.c, frmts/pcraster/libcsf,
652 ;; ogr/ogrsf_frmts/dxf/intronurbs.cpp, frmts/pdf/pdfdataset.cpp
653 ;; frmts/mrf/
654 license:bsd-3
655 ;; frmts/hdf4/hdf-eos/*
656 ;; similar to the expat license, but without guarantee exclusion
657 (license:non-copyleft "file://frmts/hdf4/hdf-eos/README")
658 ;; frmts/grib/degrib/
659 license:public-domain ; with guarantee exclusion
660 ;; port/cpl_minizip*
661 ;; Some bsd-inspired license
662 (license:non-copyleft "file://port/LICENCE_minizip")
663 ;; alg/internal_libqhull
664 ;; Some 5-clause license
665 (license:non-copyleft "file://alg/internal_libqhull/COPYING.txt")
666 ;; frmts/mrf/libLERC
667 license:asl2.0))))
668
669 (define-public python-gdal
670 (package (inherit gdal)
671 (name "python-gdal")
672 (build-system python-build-system)
673 (arguments
674 '(#:tests? #f ; no tests
675 #:phases
676 (modify-phases %standard-phases
677 (add-before 'build 'chdir
678 (lambda _
679 (chdir "swig/python")
680 #t)))))
681 (native-inputs '())
682 (propagated-inputs
683 `(("python-numpy" ,python-numpy)))
684 (inputs
685 `(("gdal" ,gdal)))
686 (synopsis "GDAL (Geospatial Data Abstraction Library) python bindings")))
687
688 (define-public postgis
689 (package
690 (name "postgis")
691 (version "3.0.0")
692 (source (origin
693 (method url-fetch)
694 (uri (string-append "https://download.osgeo.org/postgis/source/postgis-"
695 version ".tar.gz"))
696 (sha256
697 (base32
698 "15557fbk0xkngihwhqsbdyz2ng49blisf5zydw81j0gabk6x4vy0"))))
699 (build-system gnu-build-system)
700 (arguments
701 `(#:tests? #f
702 #:make-flags
703 (list (string-append "datadir=" (assoc-ref %outputs "out") "/share")
704 (string-append "docdir="(assoc-ref %outputs "out") "/share/doc")
705 (string-append "pkglibdir="(assoc-ref %outputs "out") "/lib")
706 (string-append "bindir=" (assoc-ref %outputs "out") "/bin"))
707 #:phases
708 (modify-phases %standard-phases
709 (add-before 'build 'fix-install-path
710 (lambda* (#:key outputs #:allow-other-keys)
711 (substitute* '("raster/loader/Makefile" "raster/scripts/python/Makefile")
712 (("\\$\\(DESTDIR\\)\\$\\(PGSQL_BINDIR\\)")
713 (string-append (assoc-ref outputs "out") "/bin"))))))))
714 (inputs
715 `(("gdal" ,gdal)
716 ("geos" ,geos)
717 ("json-c" ,json-c)
718 ("libjpeg" ,libjpeg-turbo)
719 ("libxml2" ,libxml2)
720 ("pcre" ,pcre)
721 ("postgresql" ,postgresql)
722 ("proj" ,proj)))
723 (native-inputs
724 `(("perl" ,perl)
725 ("pkg-config" ,pkg-config)))
726 (home-page "https://postgis.net")
727 (synopsis "Spatial database extender for PostgreSQL")
728 (description "PostGIS is a spatial database extender for PostgreSQL
729 object-relational database. It adds support for geographic objects allowing
730 location queries to be run in SQL. This package provides a PostgreSQL
731 extension.")
732 (license (list
733 ;; General license
734 license:gpl2+
735 ;; loader/dbfopen, safileio.*, shapefil.h, shpopen.c
736 license:expat
737 ;; loader/getopt.*
738 license:public-domain
739 ;; doc/xsl
740 license:bsd-3 ; files only say "BSD"
741 ;; doc
742 license:cc-by-sa3.0))))
743
744 (define-public tegola
745 (package
746 (name "tegola")
747 (version "0.7.0")
748 (source (origin
749 (method url-fetch)
750 (uri (string-append
751 "https://github.com/go-spatial/tegola/archive/v"
752 version ".tar.gz"))
753 (file-name (string-append name "-" version ".tar.gz"))
754 (sha256
755 (base32
756 "09vnzxfn0r70kmd776kcdfqxhzdj11syxa0b27z4ci1k367v7viw"))))
757 (build-system go-build-system)
758 (arguments
759 `(#:import-path "github.com/go-spatial/tegola/cmd/tegola"
760 #:unpack-path "github.com/go-spatial/tegola"
761 #:phases
762 (modify-phases %standard-phases
763 (add-before 'build 'set-version
764 (lambda _
765 (with-directory-excursion "src/github.com/go-spatial/tegola"
766 (substitute* '("cmd/tegola/cmd/root.go"
767 "cmd/tegola_lambda/main.go")
768 (("version not set") ,version)))
769 #t)))))
770 (home-page "http://tegola.io")
771 (synopsis "Vector tile server for maps")
772 (description "Tegola is a free vector tile server written in Go. Tegola
773 takes geospatial data and slices it into vector tiles that can be efficiently
774 delivered to any client.")
775 (license (list
776 license:expat
777 ;; Some packages in vendor have other licenses
778 license:asl2.0
779 license:bsd-2
780 license:bsd-3
781 license:wtfpl2))))
782
783 (define-public imposm3
784 (package
785 (name "imposm3")
786 (version "0.6.0-alpha.4")
787 (source
788 (origin
789 (method url-fetch)
790 (uri (string-append "https://github.com/omniscale/imposm3/archive/v"
791 version ".tar.gz"))
792 (file-name (string-append name "-" version ".tar.gz"))
793 (sha256
794 (base32
795 "06f0kwmv52yd5m9jlckqxqmkf0cnqy3hamakrvg9lspplyqrds80"))))
796 (build-system go-build-system)
797 (arguments
798 `(#:import-path "github.com/omniscale/imposm3/cmd/imposm"
799 #:unpack-path "github.com/omniscale/imposm3"
800 #:phases
801 (modify-phases %standard-phases
802 (add-before 'build 'set-version
803 (lambda _
804 (substitute* "src/github.com/omniscale/imposm3/version.go"
805 (("0.0.0-dev") ,version))
806 #t)))))
807 (inputs
808 `(("geos" ,geos)
809 ("leveldb" ,leveldb)))
810 (home-page "https://imposm.org/")
811 (synopsis "OpenStreetMap importer for PostGIS")
812 (description "Imposm is an importer for OpenStreetMap data. It reads PBF
813 files and imports the data into PostgreSQL/PostGIS databases. It is designed
814 to create databases that are optimized for rendering/tile/map-services.")
815 (license (list
816 license:asl2.0
817 ;; Some dependencies in vendor have different licenses
818 license:expat
819 license:bsd-2
820 license:bsd-3))))
821
822 (define-public libosmium
823 (package
824 (name "libosmium")
825 (version "2.14.2")
826 (source
827 (origin
828 (method git-fetch)
829 (uri (git-reference
830 (url "https://github.com/osmcode/libosmium.git")
831 (commit (string-append "v" version))))
832 (file-name (git-file-name name version))
833 (sha256
834 (base32 "123ri1l0a2b9fljgpwsl7z2w4i3kmgxz79d4ns9z4mwbp8sw0250"))))
835 (build-system cmake-build-system)
836 (propagated-inputs
837 `(("boost" ,boost)
838 ("expat" ,expat)
839 ("gdal" ,gdal)
840 ("geos" ,geos)
841 ("proj.4" ,proj.4)
842 ("protozero" ,protozero)
843 ("sparsehash" ,sparsehash)
844 ("zlib" ,zlib)))
845 (native-inputs
846 `(("doxygen" ,doxygen)))
847 (home-page "https://osmcode.org/libosmium/")
848 (synopsis "C++ library for working with OpenStreetMap data")
849 (description "Libosmium is a fast and flexible C++ library for working with
850 OpenStreetMap data.")
851 (license license:boost1.0)))
852
853 (define-public osm2pgsql
854 (package
855 (name "osm2pgsql")
856 (version "0.96.0")
857 (source
858 (origin
859 (method git-fetch)
860 (uri (git-reference
861 (url "https://github.com/openstreetmap/osm2pgsql.git")
862 (commit version)))
863 (file-name (git-file-name name version))
864 (sha256
865 (base32 "032cydh8ynaqfhdzmkvgbmqyjql668y6qln1l59l2s3ni9963bbl"))
866 (modules '((guix build utils)))
867 (snippet
868 '(begin
869 (delete-file-recursively "contrib/protozero")
870 (delete-file-recursively "contrib/libosmium")
871 #t))))
872 (build-system cmake-build-system)
873 (arguments
874 `(#:tests? #f; tests fail because we need to setup a database
875 #:configure-flags
876 (list (string-append "-DOSMIUM_INCLUDE_DIR="
877 (assoc-ref %build-inputs "libosmium")
878 "/include")
879 (string-append "-DPROTOZERO_INCLUDE_DIR="
880 (assoc-ref %build-inputs "protozero")
881 "/include"))))
882 (inputs
883 `(("boost" ,boost)
884 ("expat" ,expat)
885 ("libosmium" ,libosmium)
886 ("lua" ,lua)
887 ("postgresql" ,postgresql)
888 ("proj.4" ,proj.4)
889 ("protozero" ,protozero)
890 ("zlib" ,zlib)))
891 (native-inputs
892 `(("python-2" ,python-2)
893 ("python2-psycopg2" ,python2-psycopg2)))
894 (home-page "https://github.com/openstreetmap/osm2pgsql")
895 (synopsis "OSM data importer to postgresql")
896 (description "Osm2pgsql is a tool for loading OpenStreetMap data into a
897 PostgreSQL / PostGIS database suitable for applications like rendering into a
898 map, geocoding with Nominatim, or general analysis.")
899 (license license:gpl2+)))
900
901 (define-public tippecanoe
902 (package
903 (name "tippecanoe")
904 (version "1.31.5")
905 (source
906 (origin
907 (method git-fetch)
908 (uri (git-reference
909 (url "https://github.com/mapbox/tippecanoe.git")
910 (commit version)))
911 (file-name (git-file-name name version))
912 (sha256
913 (base32 "1m0x931a945sr7axyhcvpwh798m58hx1zxh6ikgf9gsgqhdhmszz"))))
914 (build-system gnu-build-system)
915 (arguments
916 `(#:phases
917 (modify-phases %standard-phases (delete 'configure))
918 #:test-target "test"
919 #:make-flags
920 (list "CC=gcc"
921 (string-append "PREFIX=" (assoc-ref %outputs "out")))))
922 (inputs
923 `(("perl" ,perl)
924 ("sqlite" ,sqlite)
925 ("zlib" ,zlib)))
926 (home-page "https://github.com/mapbox/tippecanoe")
927 (synopsis "Vector tile server for maps")
928 (description "Tippecanoe creates scale-independent view of data, so that
929 the texture and density of features is visible at every zoom level, instead of
930 dropping features at lower levels.")
931 (license license:bsd-2)))
932
933 (define-public osmctools
934 (package
935 (name "osmctools")
936 (version "0.9")
937 (source
938 (origin
939 (method git-fetch)
940 (uri (git-reference
941 (url "https://gitlab.com/osm-c-tools/osmctools")
942 (commit version)))
943 (file-name (git-file-name name version))
944 (sha256
945 (base32
946 "1m8d3r1q1v05pkr8k9czrmb4xjszw6hvgsf3kn9pf0v14gpn4r8f"))))
947 (build-system gnu-build-system)
948 (native-inputs
949 `(("autoconf" ,autoconf)
950 ("automake" ,automake)))
951 (inputs
952 `(("zlib" ,zlib)))
953 (home-page "https://gitlab.com/osm-c-tools/osmctools")
954 (synopsis "Tools to convert, filter and update OpenStreetMap data files")
955 (description "This project contains a few tools which are used in the
956 OpenStreetMap project. They can be used to convert, filter and update
957 OpenStreetMap data files.")
958 (license license:agpl3)))
959
960 (define-public osm-gps-map
961 (package
962 (name "osm-gps-map")
963 (version "1.1.0")
964 (source
965 (origin
966 (method url-fetch)
967 (uri (string-append
968 "https://github.com/nzjrs/osm-gps-map/releases/download/"
969 version "/osm-gps-map-" version ".tar.gz"))
970 (sha256
971 (base32
972 "11imsf4cz1dpxdjh178k2s29axmq86rkfg1pqmn7incyxmjzhbwg"))))
973 (build-system gnu-build-system)
974 (native-inputs
975 `(("gnome-common" ,gnome-common)
976 ("gtk-doc" ,gtk-doc)
977 ("pkg-config" ,pkg-config)))
978 (inputs
979 `(("cairo" ,cairo)
980 ("glib" ,glib)
981 ("gobject-introspection" ,gobject-introspection)
982 ("gtk+" ,gtk+)
983 ("libsoup" ,libsoup)))
984 (home-page "https://nzjrs.github.io/osm-gps-map/")
985 (synopsis "GTK+ widget for displaying OpenStreetMap tiles")
986 (description
987 "This package provides a GTK+ widget (and Python bindings) that when
988 given GPS coordinates,draws a GPS track, and points of interest on a moving
989 map display. Downloads map data from a number of websites, including
990 @url{https://www.openstreetmap.org}.")
991 (license license:gpl2+)))
992
993 (define-public xygrib
994 (package
995 (name "xygrib")
996 (version "1.2.6.1")
997 (source (origin
998 (method git-fetch)
999 (uri (git-reference
1000 (url "https://github.com/opengribs/XyGrib.git")
1001 (commit (string-append "v" version))))
1002 (file-name (git-file-name name version))
1003 (sha256
1004 (base32
1005 "0xzsm8pr0zjk3f8j880fg5n82jyxn8xf1330qmmq1fqv7rsrg9ia"))
1006 (modules '((guix build utils)))
1007 (snippet
1008 '(begin (delete-file-recursively "data/fonts") #t))))
1009 (build-system cmake-build-system)
1010 (arguments
1011 `(#:phases
1012 (modify-phases %standard-phases
1013 (add-after 'unpack 'patch-directories
1014 (lambda* (#:key inputs #:allow-other-keys)
1015 (let ((jpeg (assoc-ref inputs "openjpeg"))
1016 (font (assoc-ref inputs "font-liberation")))
1017 (substitute* "CMakeLists.txt"
1018 ;; Find libjpeg.
1019 (("/usr") jpeg)
1020 ;; Fix install locations.
1021 (("set\\(PREFIX_BIN.*") "set(PREFIX_BIN \"bin\")\n")
1022 (("set\\(PREFIX_PKGDATA.*") "set(PREFIX_PKGDATA \"share/${PROJECT_NAME}\")\n")
1023 ;; Skip looking for the static library.
1024 (("\"libnova.a\"") ""))
1025 ;; Don't use the bundled font-liberation.
1026 (substitute* "src/util/Font.cpp"
1027 (("Util::pathFonts\\(\\)\\+\"liberation-fonts/\"")
1028 (string-append "\"" font "/share/fonts/truetype/\"")))
1029 (substitute* "src/util/Util.h"
1030 (("pathData\\(\\)\\+\"data/fonts/\"")
1031 (string-append "\"" font "/share/fonts/\""))))
1032 #t)))
1033 #:tests? #f)) ; no tests
1034 (native-inputs
1035 `(("qttools" ,qttools)))
1036 (inputs
1037 `(("bzip2" ,bzip2)
1038 ("font-liberation" ,font-liberation)
1039 ("libnova" ,libnova)
1040 ("libpng" ,libpng)
1041 ("openjpeg" ,openjpeg)
1042 ("proj.4" ,proj.4)
1043 ("qtbase" ,qtbase)
1044 ("zlib" ,zlib)))
1045 (synopsis "Weather Forecast Visualization")
1046 (description
1047 "XyGrib is a Grib file reader and visualizes meteorological data providing
1048 an off-line capability to analyse weather forecasts or hindcasts. It is
1049 intended to be used as a capable weather work station for anyone with a serious
1050 interest in examining weather. This would include members of the sailing
1051 community, private and sport aviators, farmers, weather buffs and many more.
1052 XyGrib is the continuation of the zyGrib software package with a new team of
1053 volunteers.")
1054 (home-page "https://opengribs.org")
1055 (license license:gpl3+)))
1056
1057 (define-public libspatialindex
1058 (package
1059 (name "libspatialindex")
1060 (version "1.9.3")
1061 (source
1062 (origin
1063 (method url-fetch)
1064 (uri (string-append "https://github.com/libspatialindex/libspatialindex/"
1065 "releases/download/" version "/spatialindex-src-"
1066 version ".tar.bz2"))
1067 (sha256
1068 (base32
1069 "02n5vjcyk04w0djidyp21hfbxfpbbara8ifd9nml6158rwqr8lja"))))
1070 (build-system cmake-build-system)
1071 (home-page "https://libspatialindex.org")
1072 (synopsis "Spatial indexing library")
1073 (description "The purpose of this library is to provide:
1074
1075 @itemize
1076 @item An extensible framework that will support robust spatial indexing
1077 methods.
1078 @item Support for sophisticated spatial queries. Range, point location,
1079 nearest neighbor and k-nearest neighbor as well as parametric queries (defined
1080 by spatial constraints) should be easy to deploy and run.
1081 @item Easy to use interfaces for inserting, deleting and updating information.
1082 @item Wide variety of customization capabilities. Basic index and storage
1083 characteristics like the page size, node capacity, minimum fan-out, splitting
1084 algorithm, etc. should be easy to customize.
1085 @item Index persistence. Internal memory and external memory structures
1086 should be supported. Clustered and non-clustered indices should be easy to be
1087 persisted.
1088 @end itemize
1089 ")
1090 (license license:expat)))
1091
1092 (define-public java-jmapviewer
1093 (package
1094 (name "java-jmapviewer")
1095 (version "2.12")
1096 (source (origin
1097 (method url-fetch)
1098 (uri (string-append "https://svn.openstreetmap.org/applications/"
1099 "viewer/jmapviewer/releases/" version
1100 "/JMapViewer-" version "-Source.zip"))
1101 (sha256
1102 (base32
1103 "08hbqsbs859v4m5d90560fdifavd1apnpz9v9iry1v31dsvy5707"))))
1104 (build-system ant-build-system)
1105 (native-inputs
1106 `(("unzip" ,unzip)))
1107 (arguments
1108 `(#:build-target "pack"
1109 #:tests? #f; No tests
1110 #:phases
1111 (modify-phases %standard-phases
1112 (add-before 'build 'clean
1113 (lambda* _
1114 (invoke "ant" "clean")))
1115 (replace 'install
1116 (lambda* (#:key outputs #:allow-other-keys)
1117 (let ((dir (string-append (assoc-ref outputs "out") "/share/java/")))
1118 (mkdir-p dir)
1119 (copy-file "JMapViewer.jar" (string-append dir "JMapViewer.jar"))))))))
1120 (home-page "https://wiki.openstreetmap.org/wiki/JMapViewer")
1121 (synopsis "OSM map integration in Java")
1122 (description "JMapViewer is a Java component which allows to easily
1123 integrate an OSM map view into your Java application. It is maintained as
1124 an independent project by the JOSM team.")
1125 (license license:gpl2)))
1126
1127 (define-public josm
1128 (package
1129 (name "josm")
1130 (version "15553")
1131 (source (origin
1132 (method svn-fetch)
1133 (uri (svn-reference
1134 (url "https://josm.openstreetmap.de/svn/trunk")
1135 (revision (string->number version))
1136 (recursive? #f)))
1137 (sha256
1138 (base32
1139 "091pbcn4fnmk42fmxplhis3nw5dbljf6ws8acyhx5dflyn49xzmx"))
1140 (file-name (string-append name "-" version "-checkout"))
1141 (modules '((guix build utils)))
1142 (snippet
1143 '(begin
1144 (for-each delete-file (find-files "." ".*.jar$"))
1145 #t))))
1146 (build-system ant-build-system)
1147 (native-inputs
1148 `(("javacc" ,javacc)))
1149 (inputs
1150 `(("java-commons-jcs" ,java-commons-jcs)
1151 ("java-commons-compress" ,java-commons-compress)
1152 ("java-jmapviewer" ,java-jmapviewer)
1153 ("java-jsonp-api" ,java-jsonp-api)
1154 ("java-jsonp-impl" ,java-jsonp-impl); runtime dependency
1155 ("java-metadata-extractor" ,java-metadata-extractor)
1156 ("java-openjfx-media" ,java-openjfx-media)
1157 ("java-signpost-core" ,java-signpost-core)
1158 ("java-svg-salamander" ,java-svg-salamander)))
1159 (arguments
1160 `(#:tests? #f
1161 #:jar-name "josm.jar"
1162 #:phases
1163 (modify-phases %standard-phases
1164 (add-after 'unpack 'rm-build.xml
1165 (lambda* _
1166 (delete-file "build.xml")
1167 #t))
1168 (add-before 'build 'fix-revision
1169 (lambda* _
1170 (with-output-to-file "REVISION.XML"
1171 (lambda _
1172 (display
1173 (string-append "<info><entry><commit revision=\"" ,version "\">"
1174 "<date>1970-01-01 00:00:00 +0000</date>"
1175 "</commit></entry></info>"))))
1176 #t))
1177 (add-before 'build 'fix-classpath
1178 (lambda* (#:key inputs #:allow-other-keys)
1179 (setenv "CLASSPATH"
1180 (string-join
1181 (filter
1182 (lambda (s)
1183 (let ((source (assoc-ref inputs "source")))
1184 (not (equal? (substring s 0 (string-length source)) source))))
1185 (string-split (getenv "CLASSPATH") #\:))
1186 ":"))
1187 #t))
1188 (add-before 'build 'generate-parser
1189 (lambda* _
1190 (let* ((dir "src/org/openstreetmap/josm/gui/mappaint/mapcss")
1191 (out (string-append dir "/parsergen"))
1192 (file (string-append dir "/MapCSSParser.jj")))
1193 (mkdir-p "src/org/openstreetmap/josm/gui/mappaint/mapcss/parsergen")
1194 (invoke "javacc" "-DEBUG_PARSER=false"
1195 "-DEBUG_TOKEN_MANAGER=false" "-JDK_VERSION=1.8"
1196 "-GRAMMAR_ENCODING=UTF-8"
1197 (string-append "-OUTPUT_DIRECTORY=" out)
1198 file))
1199 #t))
1200 (add-after 'build 'generate-epsg
1201 (lambda _
1202 (system* "javac" "scripts/BuildProjectionDefinitions.java"
1203 "-cp" "build/classes")
1204 (mkdir-p "data/projection")
1205 (with-output-to-file "data/projection/custom-epsg"
1206 (lambda _ (display "")))
1207 (invoke "java" "-cp" "build/classes:scripts:."
1208 "BuildProjectionDefinitions" ".")
1209 #t))
1210 (add-after 'generate-epsg 'copy-data
1211 (lambda _
1212 (mkdir-p "build/classes")
1213 (rename-file "data" "build/classes/data")
1214 #t))
1215 (add-before 'install 'regenerate-jar
1216 (lambda _
1217 ;; We need to regenerate the jar file to add data.
1218 (delete-file "build/jar/josm.jar")
1219 (invoke "jar" "-cf" "build/jar/josm.jar" "-C"
1220 "build/classes" ".")
1221 #t))
1222 (add-before 'build 'copy-styles
1223 (lambda _
1224 (mkdir-p "build/classes")
1225 (rename-file "styles" "build/classes/styles")
1226 #t))
1227 (add-before 'build 'copy-images
1228 (lambda _
1229 (mkdir-p "build/classes")
1230 (rename-file "images" "build/classes/images")
1231 #t))
1232 (add-before 'build 'copy-revision
1233 (lambda _
1234 (mkdir-p "build/classes")
1235 (with-output-to-file "build/classes/REVISION"
1236 (lambda _
1237 (display
1238 (string-append "Revision: " ,version "\n"
1239 "Is-Local-Build: true\n"
1240 "Build-Date: 1970-01-01 00:00:00 +0000\n"))))
1241 #t))
1242 (add-after 'install 'install-bin
1243 (lambda* (#:key outputs inputs #:allow-other-keys)
1244 (let* ((out (assoc-ref outputs "out"))
1245 (bin (string-append out "/bin")))
1246 (mkdir-p bin)
1247 (with-output-to-file (string-append bin "/josm")
1248 (lambda _
1249 (display
1250 (string-append "#!/bin/sh\n"
1251 (assoc-ref inputs "jdk") "/bin/java"
1252 " -cp " out "/share/java/josm.jar:"
1253 (getenv "CLASSPATH")
1254 " org.openstreetmap.josm.gui.MainApplication"))))
1255 (chmod (string-append bin "/josm") #o755))
1256 #t)))))
1257 (home-page "https://josm.openstreetmap.de")
1258 (synopsis "OSM editor")
1259 (description "JOSM is an extensible editor for OpenStreetMap (OSM). It
1260 supports loading GPX tracks, background imagery and OSM data from local
1261 sources as well as from online sources and allows to edit the OSM data (nodes,
1262 ways, and relations) and their metadata tags.")
1263 (license license:gpl2+)))
1264
1265 (define-public libmaxminddb
1266 (package
1267 (name "libmaxminddb")
1268 (version "1.4.2")
1269 (source
1270 (origin
1271 (method url-fetch)
1272 (uri (string-append "https://github.com/maxmind/libmaxminddb"
1273 "/releases/download/" version "/"
1274 "/libmaxminddb-" version ".tar.gz"))
1275 (sha256
1276 (base32 "0mnimbaxnnarlw7g1rh8lpxsyf7xnmzwcczcc3lxw8xyf6ljln6x"))))
1277 (build-system gnu-build-system)
1278 (arguments
1279 `(#:phases
1280 (modify-phases %standard-phases
1281 (add-before 'configure 'set-cc-to-gcc
1282 (lambda _
1283 (setenv "CC" "gcc"))))))
1284 (native-inputs
1285 `(("perl" ,perl)))
1286 (home-page "https://maxmind.github.io/libmaxminddb/")
1287 (synopsis "C library for the MaxMind DB file format")
1288 (description "The libmaxminddb library provides a C library for reading
1289 MaxMind DB files, including the GeoIP2 databases from MaxMind. The MaxMind DB
1290 format is a custom, but open, binary format designed to facilitate fast
1291 lookups of IP addresses while allowing flexibility in the type of data
1292 associated with an address.")
1293 (license license:asl2.0)))
1294
1295 (define-public python-maxminddb
1296 (package
1297 (name "python-maxminddb")
1298 (version "1.5.1")
1299 (source
1300 (origin
1301 (method url-fetch)
1302 (uri (pypi-uri "maxminddb" version))
1303 (sha256
1304 (base32
1305 "0y9giw81k4wdmpryr4k42w50z292mf364a6vs1vxf83ksc9ig6j4"))))
1306 (build-system python-build-system)
1307 (arguments
1308 `(#:tests? #f)) ;; Tests require a copy of the maxmind database
1309 (inputs
1310 `(("libmaxminddb" ,libmaxminddb)))
1311 (home-page "https://www.maxmind.com/")
1312 (synopsis "Reader for the MaxMind DB format")
1313 (description "MaxMind DB is a binary file format that stores data indexed
1314 by IP address subnets (IPv4 or IPv6). This is a Python module for reading
1315 MaxMind DB files.")
1316 (license license:asl2.0)))
1317
1318 (define-public python-geoip2
1319 (package
1320 (name "python-geoip2")
1321 (version "2.9.0")
1322 (source
1323 (origin
1324 (method url-fetch)
1325 (uri (pypi-uri "geoip2" version))
1326 (sha256
1327 (base32
1328 "1w7cay5q6zawjzivqbwz5cqx1qbdjw6kbriccb7l46p7b39fkzzp"))))
1329 (build-system python-build-system)
1330 (arguments
1331 `(#:tests? #f)) ;; Tests require a copy of the maxmind database
1332 (inputs
1333 `(("python-maxminddb" ,python-maxminddb)
1334 ("python-requests" ,python-requests)))
1335 (home-page "https://www.maxmind.com/")
1336 (synopsis "MaxMind GeoIP2 API")
1337 (description "Provides an API for the GeoIP2 web services and databases.
1338 The API also works with MaxMind’s free GeoLite2 databases.")
1339 (license license:asl2.0)))
1340
1341 (define-public routino
1342 (package
1343 (name "routino")
1344 (version "3.3.2")
1345 (source
1346 (origin
1347 (method url-fetch)
1348 (uri (string-append "http://www.routino.org/download/routino-"
1349 version ".tgz"))
1350 (sha256
1351 (base32
1352 "1ccx3s99j8syxc1gqkzsaqkmyf44l7h3adildnc5iq2md7bp8wab"))))
1353 (build-system gnu-build-system)
1354 (native-inputs
1355 `(("perl" ,perl)))
1356 (inputs
1357 `(("bzip2" ,bzip2)
1358 ("xz" ,xz)
1359 ("zlib" ,zlib)))
1360 (arguments
1361 `(#:test-target "test"
1362 #:phases
1363 (modify-phases %standard-phases
1364 (replace 'configure
1365 (lambda* (#:key outputs #:allow-other-keys)
1366 (substitute* "Makefile.conf"
1367 (("prefix=/usr/local")
1368 (string-append "prefix=" (assoc-ref outputs "out")))
1369 (("LDFLAGS_LDSO=-Wl,-R\\.")
1370 "LDFLAGS_LDSO=-Wl,-R$(libdir)")
1371 (("#CFLAGS\\+=-DUSE_XZ")
1372 "CFLAGS+=-DUSE_XZ")
1373 (("#LDFLAGS\\+=-llzma")
1374 "LDFLAGS+=-llzma"))
1375 #t)))))
1376 (synopsis "Routing application for OpenStreetMap data")
1377 (description
1378 "Routino is an application for finding a route between two points
1379 using the dataset of topographical information collected by
1380 @url{https://www.OpenStreetMap.org}.")
1381 (home-page "https://www.routino.org/")
1382 (license license:agpl3+)))
1383
1384 (define-public qmapshack
1385 (package
1386 (name "qmapshack")
1387 (version "1.14.0")
1388 (source
1389 (origin
1390 (method git-fetch)
1391 (uri (git-reference
1392 (url "https://github.com/Maproom/qmapshack.git")
1393 (commit (string-append "V_" version))))
1394 (file-name (git-file-name name version))
1395 (sha256
1396 (base32
1397 "07c2hrq9sn456w7l3gdr599rmjfv2k6mh159zza7p1py8r7ywksa"))))
1398 (build-system qt-build-system)
1399 (native-inputs
1400 `(("pkg-config" ,pkg-config)
1401 ("qttools" ,qttools)))
1402 (inputs
1403 `(("gdal" ,gdal)
1404 ("libjpeg-turbo" ,libjpeg-turbo)
1405 ("proj" ,proj)
1406 ("qtbase" ,qtbase)
1407 ("qtdeclarative" ,qtdeclarative)
1408 ("qtlocation" ,qtlocation)
1409 ("qtwebchannel" ,qtwebchannel)
1410 ("qtwebengine" ,qtwebengine)
1411 ("quazip" ,quazip)
1412 ("routino" ,routino)
1413 ("sqlite" ,sqlite) ; See wrap phase
1414 ("zlib" ,zlib)))
1415 (arguments
1416 `(#:tests? #f
1417 #:phases
1418 (modify-phases %standard-phases
1419 (add-after 'unpack 'fix-cmake-modules
1420 (lambda* (#:key inputs #:allow-other-keys)
1421 (substitute* "CMakeLists.txt"
1422 (("find_package\\(Qt5PrintSupport REQUIRED\\)" all)
1423 (string-append all "\nfind_package(Qt5Positioning REQUIRED)")))
1424 (substitute* "cmake/Modules/FindROUTINO.cmake"
1425 (("/usr/local")
1426 (assoc-ref inputs "routino")))
1427 ;; The following fixes are included as patches in the sources
1428 ;; of QMapShack, but they are not applied by default, for
1429 ;; some reason...
1430 (invoke "patch" "-p1" "-i" "FindPROJ4.patch")
1431 (invoke "patch" "-p1" "-i" "FindQuaZip5.patch")
1432 #t))
1433 (add-after 'install 'wrap
1434 ;; The program fails to run with the error:
1435 ;; undefined symbol: sqlite3_column_table_name16
1436 ;; Forcing the program to use sqlite-with-column-metadata instead
1437 ;; of sqlite using LD_LIBRARY_PATH solves the problem.
1438 ;;
1439 ;; The program also fails to find the QtWebEngineProcess program,
1440 ;; so we set QTWEBENGINEPROCESS_PATH to help it.
1441 (lambda* (#:key inputs outputs #:allow-other-keys)
1442 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
1443 (qtwebengineprocess (string-append
1444 (assoc-ref inputs "qtwebengine")
1445 "/lib/qt5/libexec/QtWebEngineProcess"))
1446 (sqlite-lib (string-append (assoc-ref inputs "sqlite")
1447 "/lib")))
1448 (for-each (lambda (program)
1449 (wrap-program program
1450 `("LD_LIBRARY_PATH" ":" prefix (,sqlite-lib))
1451 `("QTWEBENGINEPROCESS_PATH" =
1452 (,qtwebengineprocess))))
1453 (find-files bin ".*")))
1454 #t)))))
1455 (synopsis "GPS mapping application")
1456 (description
1457 "QMapShack can be used to plan your next outdoor trip or to visualize and
1458 archive all the GPS recordings of your past trips. It is the successor of the
1459 QLandkarte GT application.")
1460 (home-page "https://github.com/Maproom/qmapshack/wiki")
1461 (license license:gpl3+)))