Opened 6 years ago
Last modified 6 years ago
#12439 new Bugs
Problems with 180 and -180 meridian, using bg::cs::geographic<bg::degree>
Reported by: | Owned by: | Barend Gehrels | |
---|---|---|---|
Milestone: | To Be Determined | Component: | geometry |
Version: | Boost 1.61.0 | Severity: | Problem |
Keywords: | geographic return_envelope | Cc: |
Description
While calculating the envelope:
#include <boost/range.hpp> #include <boost/iterator/iterator_facade.hpp> #include <boost/geometry/geometries/concepts/ring_concept.hpp> #include <boost/geometry/geometries/register/ring.hpp> #include <boost/geometry.hpp> #include <boost/geometry/geometries/geometries.hpp> namespace bg = boost::geometry; namespace bgi = boost::geometry::index; typedef bg::model::point<double, 2, bg::cs::geographic< bg::degree>> point_t; typedef bg::model::ring<point_t> ring_t; ring_t ring {{-180, 0}, {180, 0}, {180, -85}, {-180, -85}, {-180, 0}}; auto aabb = bg::return_envelope< bg::model::box<point_t> >(ring); std::cout << "max_corner lon =" << aabb.max_corner().get<0>(); std::cout << "min_corner lon =" << aabb.min_corner().get<0>();
It prints both max_corner and min_corner longitude as 180
Note:
See TracTickets
for help on using tickets.
It's because in spherical and geographic coordinate systems degrees
-180
and180
are the same longitude. The Geometry you created is segment-like Ring (invalid, with area = 0) lying on antimeridian so the envelope of this Ring should beBOX(180 -85, 180 0)
. Or am I missing something?