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