[Git][debian-gis-team/pyosmium][upstream] New upstream version 2.14.2
Bas Couwenberg
gitlab at salsa.debian.org
Tue Aug 7 06:43:02 BST 2018
Bas Couwenberg pushed to branch upstream at Debian GIS Project / pyosmium
Commits:
3645c6aa by Bas Couwenberg at 2018-08-07T05:17:39Z
New upstream version 2.14.2
- - - - -
5 changed files:
- CHANGELOG.md
- 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
=====================================
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/commit/3645c6aae1d235766ea1f0bd5e7f695e9abc6e9a
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyosmium/commit/3645c6aae1d235766ea1f0bd5e7f695e9abc6e9a
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/a23f1061/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list