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