osmcode / libosmium

Fast and flexible C++ library for working with OpenStreetMap data.
https://osmcode.org/libosmium/
Boost Software License 1.0
467 stars 113 forks source link

Issue related to Box. #298

Closed gorishaa9 closed 4 years ago

gorishaa9 commented 4 years ago

Hi,

I am running into an unexpected problem. A snippet of the code is as follows:

cout << minX << "\t" << minY << "\t" << maxX << "\t" << maxY << "\n"; boost::shared_ptr<osmium::Box> box{new osmium::Box(minX, minY, maxX, maxY)}; cout << box->bottom_left().x() << "\t" << box->bottom_left().y() << "\t" << box->top_right().x() << "\t" << box->top_right().y() << "\n \n";

And I obtain the following result:

1011805074 2682240255 1011814894 2682245203 -2147483648 -2147483648 -2147483648 -2147483648

What could be the possible reason for this? I tried this for different coordinates but the result was the same. Please let me know. Thanks.

joto commented 4 years ago

Box expects coordinates in WGS84 when you are using that constructor. Your coordinates are way out of bounds so you get an invalid Box object. I'll amend the documentation to make this clearer.

gorishaa9 commented 4 years ago

Okay, thanks.