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