geo.scm 34 KB

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