Skip to content

Commit 711721c

Browse files
committed
Remove support for projection using the Proj library
This has been deprecated a while because it only works with very old versions of the Proj library.
1 parent 83424e2 commit 711721c

File tree

6 files changed

+3
-312
lines changed

6 files changed

+3
-312
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ if(BUILD_HEADERS)
401401
file(MAKE_DIRECTORY header_check)
402402

403403
foreach(hpp ${ALL_HPPS})
404-
if((GDAL_FOUND AND PROJ_FOUND) OR NOT ((hpp STREQUAL "osmium/area/problem_reporter_ogr.hpp") OR (hpp STREQUAL "osmium/geom/ogr.hpp") OR (hpp STREQUAL "osmium/geom/projection.hpp")))
404+
if((GDAL_FOUND) OR NOT ((hpp STREQUAL "osmium/area/problem_reporter_ogr.hpp") OR (hpp STREQUAL "osmium/geom/ogr.hpp")))
405405
string(REPLACE ".hpp" "" tmp ${hpp})
406406
string(REPLACE "/" "__" libname ${tmp})
407407

include/osmium/geom/projection.hpp

Lines changed: 0 additions & 213 deletions
This file was deleted.

test/CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ if(NOT GEOS_FOUND)
105105
set(GEOS_FOUND FALSE)
106106
endif()
107107

108-
if(NOT PROJ_FOUND)
109-
set(PROJ_FOUND FALSE)
110-
endif()
111-
112108
if(NOT SPARSEHASH_FOUND)
113109
set(SPARSEHASH_FOUND FALSE)
114110
endif()
@@ -157,15 +153,14 @@ add_unit_test(builder test_attr)
157153
add_unit_test(builder test_object_builder)
158154

159155
add_unit_test(geom test_coordinates)
160-
add_unit_test(geom test_crs ENABLE_IF ${PROJ_FOUND} LIBS ${PROJ_LIBRARY})
161156
add_unit_test(geom test_exception)
162-
add_unit_test(geom test_factory_with_projection ENABLE_IF ${PROJ_FOUND} LIBS ${PROJ_LIBRARY})
157+
add_unit_test(geom test_factory_with_projection)
163158
add_unit_test(geom test_geojson)
164159
add_unit_test(geom test_geos ENABLE_IF ${GEOS_FOUND} LIBS ${GEOS_LIBRARY})
165160
add_unit_test(geom test_mercator)
166161
add_unit_test(geom test_ogr ENABLE_IF ${GDAL_FOUND} LIBS ${GDAL_LIBRARY})
167162
add_unit_test(geom test_ogr_wkb ENABLE_IF ${GDAL_FOUND} LIBS ${GDAL_LIBRARY})
168-
add_unit_test(geom test_projection ENABLE_IF ${PROJ_FOUND} LIBS ${PROJ_LIBRARY})
163+
add_unit_test(geom test_projection)
169164
add_unit_test(geom test_tile)
170165
add_unit_test(geom test_wkb)
171166
add_unit_test(geom test_wkt)

test/t/geom/test_crs.cpp

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "catch.hpp"
22

33
#include <osmium/geom/mercator_projection.hpp>
4-
#include <osmium/geom/projection.hpp>
54
#include <osmium/geom/wkt.hpp>
65

76
#include <string>
@@ -13,10 +12,3 @@ TEST_CASE("Projection using MercatorProjection class to WKT") {
1312
REQUIRE(wkt == "POINT(356222.37 467961.14)");
1413
}
1514

16-
TEST_CASE("Projection using Projection class to WKT") {
17-
osmium::geom::WKTFactory<osmium::geom::Projection> factory{osmium::geom::Projection{3857}, 2};
18-
19-
const std::string wkt{factory.create_point(osmium::Location{3.2, 4.2})};
20-
REQUIRE(wkt == "POINT(356222.37 467961.14)");
21-
}
22-

test/t/geom/test_projection.cpp

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,78 +2,13 @@
22

33
#include <osmium/geom/factory.hpp>
44
#include <osmium/geom/mercator_projection.hpp>
5-
#include <osmium/geom/projection.hpp>
65

76
TEST_CASE("Indentity Projection") {
87
const osmium::geom::IdentityProjection projection;
98
REQUIRE(4326 == projection.epsg());
109
REQUIRE("+proj=longlat +datum=WGS84 +no_defs" == projection.proj_string());
1110
}
1211

13-
TEST_CASE("Projection 4326") {
14-
const osmium::geom::Projection projection{4326};
15-
REQUIRE(4326 == projection.epsg());
16-
REQUIRE("+init=epsg:4326" == projection.proj_string());
17-
18-
const osmium::Location loc{1.0, 2.0};
19-
const osmium::geom::Coordinates c{1.0, 2.0};
20-
REQUIRE(projection(loc).x == Approx(c.x).epsilon(0.00001));
21-
REQUIRE(projection(loc).y == Approx(c.y).epsilon(0.00001));
22-
}
23-
24-
TEST_CASE("Projection 4326 from init string") {
25-
const osmium::geom::Projection projection{"+init=epsg:4326"};
26-
REQUIRE(-1 == projection.epsg());
27-
REQUIRE("+init=epsg:4326" == projection.proj_string());
28-
29-
const osmium::Location loc{1.0, 2.0};
30-
const osmium::geom::Coordinates c{1.0, 2.0};
31-
REQUIRE(projection(loc).x == Approx(c.x).epsilon(0.00001));
32-
REQUIRE(projection(loc).y == Approx(c.y).epsilon(0.00001));
33-
}
34-
35-
TEST_CASE("Creating projection from unknown init string") {
36-
REQUIRE_THROWS_AS(osmium::geom::Projection{"abc"}, osmium::projection_error);
37-
}
38-
39-
TEST_CASE("Creating projection from unknown EPSG code") {
40-
REQUIRE_THROWS_AS(osmium::geom::Projection{9999999}, osmium::projection_error);
41-
}
42-
43-
TEST_CASE("Projection 3857") {
44-
const osmium::geom::Projection projection{3857};
45-
REQUIRE(3857 == projection.epsg());
46-
REQUIRE("+init=epsg:3857" == projection.proj_string());
47-
48-
SECTION("Zero coordinates") {
49-
const osmium::Location loc{0.0, 0.0};
50-
const osmium::geom::Coordinates c{0.0, 0.0};
51-
REQUIRE(projection(loc).x == Approx(c.x).epsilon(0.00001));
52-
REQUIRE(projection(loc).y == Approx(c.y).epsilon(0.00001));
53-
}
54-
55-
SECTION("Max longitude") {
56-
const osmium::Location loc{180.0, 0.0};
57-
const osmium::geom::Coordinates c{20037508.34, 0.0};
58-
REQUIRE(projection(loc).x == Approx(c.x).epsilon(0.00001));
59-
REQUIRE(projection(loc).y == Approx(c.y).epsilon(0.00001));
60-
}
61-
62-
SECTION("Min longitude") {
63-
const osmium::Location loc{-180.0, 0.0};
64-
const osmium::geom::Coordinates c{-20037508.34, 0.0};
65-
REQUIRE(projection(loc).x == Approx(c.x).epsilon(0.00001));
66-
REQUIRE(projection(loc).y == Approx(c.y).epsilon(0.00001));
67-
}
68-
69-
SECTION("Max latitude") {
70-
const osmium::Location loc{0.0, 85.0511288};
71-
const osmium::geom::Coordinates c{0.0, 20037508.34};
72-
REQUIRE(projection(loc).x == Approx(c.x).epsilon(0.00001));
73-
REQUIRE(projection(loc).y == Approx(c.y).epsilon(0.00001));
74-
}
75-
}
76-
7712
TEST_CASE("MercatorProjection: Zero coordinates") {
7813
const osmium::geom::MercatorProjection projection;
7914
const osmium::Location loc{0.0, 0.0};

0 commit comments

Comments
 (0)