summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorPatrick Noll <patrick@patricknoll.com>2024-01-26 01:16:17 +0000
committerSharlatan Hellseher <sharlatanus@gmail.com>2024-01-28 22:31:18 +0000
commit39c490b1ca62872163ad81c495204833326b65d3 (patch)
treed36bdf4542306ccda8e8c4516b098814f8cadcd5 /gnu
parent39e6994081af7cd0d93698cb6748dd9b16166c57 (diff)
downloadguix-39c490b1ca62872163ad81c495204833326b65d3.tar.gz
gnu: Add python-ogr2osm.
* gnu/packages/geo.scm (python-ogr2osm): New variable.

Co-authored-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Change-Id: Id083d89dd05a9e1cdeca500daff5fab872fa15b4
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/geo.scm59
1 files changed, 58 insertions, 1 deletions
diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index 53e765da7d..16a6858907 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -14,10 +14,11 @@
 ;;; Copyright © 2020, 2022 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2020 Christopher Baines <mail@cbaines.net>
 ;;; Copyright © 2020, 2021, 2022, 2023 Felix Gruber <felgru@posteo.net>
-;;; Copyright © 2021, 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2021, 2023, 2024 Sharlatan Hellseher <sharlatanus@gmail.com>
 ;;; Copyright © 2021, 2023, 2024 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2021 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2021, 2022 Nikolay Korotkiy <sikmir@disroot.org>
+;;; Copyright © 2022 Patrick Noll <patrick@patricknoll.com>
 ;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
 ;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
@@ -61,6 +62,7 @@
   #:use-module (gnu packages audio)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages backup)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
@@ -974,6 +976,61 @@ enables you to easily do operations in Python that would otherwise
 require a spatial database such as PostGIS.")
     (license license:bsd-3)))
 
+(define-public python-ogr2osm
+  (package
+    (name "python-ogr2osm")
+    (version "1.2.0")
+    (source
+     (origin
+       (method git-fetch) ; no tests data in PyPi package
+       (uri
+        (git-reference
+         (url "https://github.com/roelderickx/ogr2osm/")
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0hwqnx3cdqxmniydpj1v31kglq1xjsx41d8p10c9j4hg8kb43j80"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      ;; There are tests in git checkout but non of the examples taken from
+      ;; GitHub Actions worked for me. Disabling them to be checked later
+      ;; <https://github.com/roelderickx/ogr2osm/blob/main/.github/workflows/test.yml>.
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                ;; TODO: Fix provided tests.
+                ;; (invoke "cram" "test/basic_usage.t")
+                ;; (invoke "cram" "test/osm_output.t")
+                ;; (invoke "cram" "test/pbf_output.t")
+
+                ;; Run simple tests to ensure that the command is working.
+                (invoke "ogr2osm" "--help")
+                (invoke
+                 "ogr2osm" "-f" "test/shapefiles/basic_geometries.kml")))))))
+    (inputs
+     (list gdal))
+    (native-inputs
+     (list coreutils
+           diffutils
+           libxml2
+           python-cram
+           which))
+    (propagated-inputs
+     (list python-lxml
+           python-protobuf))
+    (home-page "https://github.com/roelderickx/ogr2osm")
+    (synopsis "Convert ogr-readable files like shapefiles into OSM or PDF formats")
+    (description
+     "@code{ogr2osm} is a tool for converting ogr-readable files into
+@acronym{OSM, OpenStreetMap} format.  It supports reading from OGR files like
+shapefiles or PostgresSQL database and converts data into @code{osm} or
+@code{osm.pbf} formats.  A translation file can be used to manipulate the data
+during conversion.")
+    (license license:expat)))
+
 (define-public python-osmnx
   (package
     (name "python-osmnx")