Skip to content
Commits on Source (24)
......@@ -12,6 +12,29 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
## [2.14.3] - 2018-08-08
### Added
### Changed
### Fixed
- fix rounding error in tests
## [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
......
pyosmium (2.14.3-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
-- Bas Couwenberg <sebastic@debian.org> Tue, 14 Aug 2018 07:00:03 +0200
pyosmium (2.14.3-1) unstable; urgency=medium
* New upstream release.
* Drop patch to fix i386 test failure, included upstream.
-- Bas Couwenberg <sebastic@debian.org> Wed, 08 Aug 2018 22:54:21 +0200
pyosmium (2.14.2-3) unstable; urgency=medium
* Add upstream patch to fix test failure on i386.
* Don't ignore test failures on i386 & hurd-i386.
-- Bas Couwenberg <sebastic@debian.org> Tue, 07 Aug 2018 21:34:17 +0200
pyosmium (2.14.2-2) unstable; urgency=medium
* Ignore test failures on i386 & hurd-i386.
-- Bas Couwenberg <sebastic@debian.org> Tue, 07 Aug 2018 18:37:29 +0200
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@debian.org> Tue, 07 Aug 2018 07:19:38 +0200
pyosmium (2.14.1-2) unstable; urgency=medium
* Strip trailing whitespace from control & rules files.
* Bump Standards-Version to 4.1.5, no changes.
-- Bas Couwenberg <sebastic@debian.org> Wed, 11 Jul 2018 14:46:25 +0200
pyosmium (2.14.1-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
......
......@@ -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,
......@@ -23,10 +23,10 @@ Build-Depends: debhelper (>= 9),
python3-nose,
python3-sphinx,
python3-sphinxcontrib.autoprogram
Standards-Version: 4.1.4
Standards-Version: 4.2.0
Vcs-Browser: https://salsa.debian.org/debian-gis-team/pyosmium/
Vcs-Git: https://salsa.debian.org/debian-gis-team/pyosmium.git -b stretch-backports
Homepage: http://osmcode.org/pyosmium/
Homepage: https://osmcode.org/pyosmium/
Package: pyosmium
Architecture: all
......@@ -102,4 +102,3 @@ Description: Osmium library bindings for Python - Documentation
functions.
.
This package contains the PyOsmium documentation.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: PyOsmium
Upstream-Contact: Osmium Developers (http://osmcode.org/contact)
Upstream-Contact: Osmium Developers (https://osmcode.org/contact)
Source: https://github.com/osmcode/pyosmium
Files: *
......
......@@ -39,4 +39,3 @@ override_dh_install:
# Remove embedded underscore.js in favor of libjs-underscore
$(RM) debian/*/usr/share/doc/*/html/_static/underscore.js
# Not worth the effort
testsuite-autopkgtest-missing
# Test installability
Depends: @
Test-Command: /bin/true
# Test module import (Python 2)
Depends: python-all, python-pyosmium
Test-Command: set -e ; for py in $(pyversions -r 2>/dev/null) ; do cd "$ADTTMP" ; echo "Testing with $py:" ; $py -c "import osmium; print(osmium)" ; done
# Test module import (Python 3)
Depends: python3-all, python3-pyosmium
Test-Command: set -e ; for py in $(py3versions -r 2>/dev/null) ; do cd "$ADTTMP" ; echo "Testing with $py:" ; $py -c "import osmium; print(osmium)" ; done
---
Bug-Database: https://github.com/osmcode/pyosmium/issues
Bug-Submit: https://github.com/osmcode/pyosmium/issues/new
Contact: Osmium Developers (http://osmcode.org/contact)
Contact: Osmium Developers (https://osmcode.org/contact)
Name: PyOsmium
Repository: https://github.com/osmcode/pyosmium.git
Repository-Browse: https://github.com/osmcode/pyosmium
#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,
......
......@@ -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)
......@@ -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.3'
# 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'
......@@ -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_almost_equals(c.x, 0)
assert_almost_equals(c.y, 0)
def test_mercator_lonlat(self):
c = o.geom.mercator_to_lonlat(o.geom.Coordinates(0,0))
assert_almost_equals(c.x, 0)
assert_almost_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_almost_equals(c.x, 10.0)
assert_almost_equals(c.y, -3.0)