Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (5)
New upstream version 2.14.2
· 3645c6aa
Bas Couwenberg
authored
Aug 07, 2018
3645c6aa
Merge tag 'upstream/2.14.2'
· 65b8a304
Bas Couwenberg
authored
Aug 07, 2018
Upstream version 2.14.2
65b8a304
New upstream release.
· 230947f1
Bas Couwenberg
authored
Aug 07, 2018
230947f1
Bump minimum required libosmium2-dev to 2.14.2.
· ead0563e
Bas Couwenberg
authored
Aug 07, 2018
ead0563e
Set distribution to unstable.
· c389a76f
Bas Couwenberg
authored
Aug 07, 2018
c389a76f
Show whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
c389a76f
...
...
@@ -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
View file @
c389a76f
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@debian.org>
Mon, 23 Jul
2018
11
:1
5
:3
5
+0200
-- Bas Couwenberg <sebastic@debian.org>
Tue, 07 Aug
2018
07
:1
9
:3
8
+0200
pyosmium (2.14.1-2) unstable; urgency=medium
...
...
debian/control
View file @
c389a76f
...
...
@@ -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
View file @
c389a76f
#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
View file @
c389a76f
...
...
@@ -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
View file @
c389a76f
...
...
@@ -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
View file @
c389a76f
...
...
@@ -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
)