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