[Git][debian-gis-team/pyosmium][master] 5 commits: New upstream version 2.14.2

Bas Couwenberg gitlab at salsa.debian.org
Tue Aug 7 06:42:59 BST 2018


Bas Couwenberg pushed to branch master at Debian GIS Project / pyosmium


Commits:
3645c6aa by Bas Couwenberg at 2018-08-07T05:17:39Z
New upstream version 2.14.2
- - - - -
65b8a304 by Bas Couwenberg at 2018-08-07T05:17:42Z
Merge tag 'upstream/2.14.2'

Upstream version 2.14.2

- - - - -
230947f1 by Bas Couwenberg at 2018-08-07T05:17:58Z
New upstream release.

- - - - -
ead0563e by Bas Couwenberg at 2018-08-07T05:19:37Z
Bump minimum required libosmium2-dev to 2.14.2.

- - - - -
c389a76f by Bas Couwenberg at 2018-08-07T05:19:52Z
Set distribution to unstable.

- - - - -


7 changed files:

- CHANGELOG.md
- debian/changelog
- debian/control
- lib/geom.cc
- setup.py
- src/osmium/version.py
- test/test_geom.py


Changes:

=====================================
CHANGELOG.md
=====================================
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,19 @@ This project adheres to [Semantic Versioning](http://semver.org/).
 
 ### Fixed
 
+## [2.14.2] - 2018-08-07
+
+### Added
+
+- expose Coordinates struct and mercator projection functions
+
+### Changed
+
+- use current libosmium and protozero
+
+### Fixed
+
+
 ## [2.14.1] - 2018-04-24
 
 ### Added


=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,13 @@
-pyosmium (2.14.1-3) UNRELEASED; urgency=medium
+pyosmium (2.14.2-1) unstable; urgency=medium
 
+  * New upstream release.
   * Update osmcode.org URLs to use HTTPS.
   * Bump Standards-Version to 4.2.0, no changes.
   * Drop autopkgtests to test installability & module import.
   * Add lintian override for testsuite-autopkgtest-missing.
+  * Bump minimum required libosmium2-dev to 2.14.2.
 
- -- Bas Couwenberg <sebastic at debian.org>  Mon, 23 Jul 2018 11:15:35 +0200
+ -- Bas Couwenberg <sebastic at debian.org>  Tue, 07 Aug 2018 07:19:38 +0200
 
 pyosmium (2.14.1-2) unstable; urgency=medium
 


=====================================
debian/control
=====================================
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends: debhelper (>= 9),
                libexpat1-dev,
                libgdal-dev,
                libgeos++-dev,
-               libosmium2-dev (>= 2.14.0),
+               libosmium2-dev (>= 2.14.2),
                libsparsehash-dev,
                python-all-dev,
                python-setuptools,


=====================================
lib/geom.cc
=====================================
--- a/lib/geom.cc
+++ b/lib/geom.cc
@@ -1,5 +1,7 @@
 #include <boost/python.hpp>
 
+#include <osmium/geom/mercator_projection.hpp>
+#include <osmium/geom/coordinates.hpp>
 #include <osmium/geom/haversine.hpp>
 #include <osmium/geom/factory.hpp>
 #include <osmium/geom/wkb.hpp>
@@ -38,6 +40,23 @@ BOOST_PYTHON_MODULE(geom)
         "curvature of earth into account. If a :py:class:`WayNodeList` is given "
         "as a parameter the total length of the way in meters is computed.");
 
+    def("lonlat_to_mercator", &osmium::geom::lonlat_to_mercator,
+        arg("coordinate"),
+        "Convert coordinates from WGS84 to Mercator projection.");
+
+    def("mercator_to_lonlat", &osmium::geom::mercator_to_lonlat,
+        arg("coordinate"),
+        "Convert coordinates from WGS84 to Mercator projection.");
+
+    class_<osmium::geom::Coordinates>("Coordinates",
+        "A pair of coordiante values.")
+        .def(init<double, double>())
+        .def(init<osmium::Location const &>())
+        .add_property("x", &osmium::geom::Coordinates::x)
+        .add_property("y", &osmium::geom::Coordinates::y)
+        .def("valid", &osmium::geom::Coordinates::valid,
+             "Coordinates are invalid if they have been default constructed.");
+
     class_<WKBFactory>("WKBFactory",
         "Factory that creates WKB from osmium geometries.")
         .add_property("epsg", &WKBFactory::epsg,


=====================================
setup.py
=====================================
--- a/setup.py
+++ b/setup.py
@@ -5,6 +5,7 @@ from subprocess import call
 from sys import version_info as pyversion, platform as osplatform
 from ctypes.util import find_library
 import os
+import os.path as osp
 
 includes = []
 libs = []
@@ -37,6 +38,30 @@ def get_versions():
 
     return v['pyosmium_release'], v['libosmium_version'], v['protozero_version']
 
+
+def find_includes(libname, chk_file=None, prefix=None, version_postfix=None):
+    if chk_file is None:
+        chk_file = osp.join('include', libname, 'version.hpp')
+
+    if prefix is not None:
+        if not os.path.isfile(osp.join(prefix, chk_file)):
+            raise RuntimeError("Prefix for %s set but library not found in '%s'."
+                               % (libname, prefix))
+        return osp.join(prefix, 'include')
+
+    search_paths = []
+    if version_postfix:
+        search_paths.append('%s-%s' % (libname, version_postfix))
+    search_paths.append(osp.join('..', libname))
+
+    for p in search_paths:
+        if os.path.isfile(osp.join(p, chk_file)):
+            print("%s found in '%s'." % (libname, p))
+            return osp.join(p, 'include')
+
+    print("Using global %s" % libname)
+
+
 pyosmium_release, libosmium_version, protozero_version = get_versions()
 
 ## boost dependencies
@@ -45,12 +70,21 @@ boost_prefix = os.environ.get('BOOST_PREFIX',
 
 includes.append(os.path.join(boost_prefix, 'include'))
 if 'BOOST_VERSION' in os.environ:
-    includes.append(os.path.join(boost_prefix, 'include',
-                                 "boost-%s" %os.environ['BOOST_VERSION']))
+    for boost_dir in ('boost-%s', 'boost%s'):
+        if os.path.isdir(os.path.join(boost_prefix, 'include', boost_dir % os.environ['BOOST_VERSION'])):
+            includes.append(os.path.join(boost_prefix, 'include', boost_dir %os.environ['BOOST_VERSION']))
+            break
+    else:
+        raise Exception("Cannot find boost headers")
+elif 'BOOST_PREFIX' in os.environ:
+    if os.path.isdir(os.path.join(boost_prefix, 'include', 'boost')):
+        includes.append(os.path.join(boost_prefix, 'include', 'boost'))
+    else:
+        raise Exception("Cannot find boost headers")
 
-if 'BOOST_VERSION' in os.environ:
+if 'BOOST_PREFIX' in os.environ:
     libdirs.append(os.path.join(boost_prefix, 'lib'))
-elif osplatform in ["linux", "linux2"]:
+elif osplatform in ["linux", "linux2"] and os.path.isdir('/usr/lib/x86_64-linux-gnu/'):
     libdirs.append('/usr/lib/x86_64-linux-gnu/')
 else:
     libdirs.append(os.path.join(boost_prefix, 'lib'))
@@ -100,28 +134,19 @@ if osplatform != "win32":
     setuptools_build_ext.customize_compiler = cpp_compiler
 
 ### osmium dependencies
-osmium_prefixes = [ 'libosmium-' + libosmium_version, '../libosmium' ]
-if 'LIBOSMIUM_PREFIX' in os.environ:
-    lo_version_h = os.path.join(os.environ['LIBOSMIUM_PREFIX'],
-                                'include/osmium/version.hpp')
-    if not os.path.isfile(lo_version_h):
-        raise RuntimeError("LIBOSMIUM_PREFIX is set but no libosmium was found in '%s'" % os.environ['LIBOSMIUM_PREFIX'])
-    includes.insert(0, os.path.join(os.environ['LIBOSMIUM_PREFIX'], 'include'))
-else:
-    # default search paths for libosmium
-    for prefix in [ 'libosmium-' + libosmium_version, '../libosmium' ]:
-        if os.path.isfile(os.path.join(prefix, 'include/osmium/version.hpp')):
-            print("libosmium found in '%s'" % prefix)
-            includes.insert(0, os.path.join(prefix, 'include'))
-            break
-    else:
-        print("Using global libosmium.")
+osmium_inc = find_includes('libosmium',
+                           chk_file=osp.join('include', 'osmium', 'version.hpp'),
+                           prefix=os.environ.get('LIBOSMIUM_PREFIX'),
+                           version_postfix=libosmium_version)
+if osmium_inc is not None:
+    includes.insert(0, osmium_inc)
 
 ### protozero dependencies
-for prefix in [ 'protozero-' + protozero_version, '../protozero' ]:
-    if os.path.isfile(os.path.join(prefix, 'include/protozero/version.hpp')):
-        print("protozero found in '%s'" % prefix)
-        includes.insert(0, os.path.join(prefix, 'include'))
+protozero_inc = find_includes('protozero',
+                              prefix=os.environ.get('PROTOZERO_PREFIX'),
+                              version_postfix=protozero_version)
+if protozero_inc is not None:
+    includes.insert(0, protozero_inc)
 
 if osplatform == "win32" :
     osmium_libs = ('expat', 'zlib', 'bzip2', 'ws2_32')
@@ -202,4 +227,3 @@ setup (name = 'osmium',
        cmdclass={'sdist' : My_sdist},
        ext_modules = extensions)
 
-


=====================================
src/osmium/version.py
=====================================
--- a/src/osmium/version.py
+++ b/src/osmium/version.py
@@ -5,9 +5,9 @@ Version information.
 # the major version
 pyosmium_major = '2.14'
 # current release (Pip version)
-pyosmium_release = '2.14.1'
+pyosmium_release = '2.14.2'
 
 # libosmium version shipped with the Pip release
-libosmium_version = '2.14.0'
+libosmium_version = '2.14.2'
 # protozero version shipped with the Pip release
-protozero_version = '1.6.2'
+protozero_version = '1.6.3'


=====================================
test/test_geom.py
=====================================
--- a/test/test_geom.py
+++ b/test/test_geom.py
@@ -51,3 +51,22 @@ class TestWkbCreatePoly(HandlerTestBase, unittest.TestCase):
 
     def check_result(self):
         assert_equals(1, len(self.handler.wkbs))
+
+class TestCoordinateConversion(unittest.TestCase):
+
+    def test_lonlat_to_mercator(self):
+        c = o.geom.lonlat_to_mercator(o.geom.Coordinates(0,0))
+        assert_equals(c.x, 0)
+        assert_equals(c.y, 0)
+
+    def test_mercator_lonlat(self):
+        c = o.geom.mercator_to_lonlat(o.geom.Coordinates(0,0))
+        assert_equals(c.x, 0)
+        assert_equals(c.y, 0)
+
+class TestCoordinates(unittest.TestCase):
+
+    def test_coordinate_from_location(self):
+        c = o.geom.Coordinates(o.osm.Location(10.0, -3.0))
+        assert_equals(c.x, 10.0)
+        assert_equals(c.y, -3.0)



View it on GitLab: https://salsa.debian.org/debian-gis-team/pyosmium/compare/6756e0a61dc1503af141c25654dd108e49c7c301...c389a76faef9f12c8695127043d4a4770972b38e

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyosmium/compare/6756e0a61dc1503af141c25654dd108e49c7c301...c389a76faef9f12c8695127043d4a4770972b38e
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20180807/b5cc89ba/attachment-0001.html>


More information about the Pkg-grass-devel mailing list