Commit 457e392
committed
Add functions to store and retrieve extra bit in osmium::Location
The way coordinates in OSM work, storing a "location" needs 8 bytes, 4
bytes each for the longitude and latitude. But the longitude goes from
-180° to +180° while the latitude only goes from -90° to +90°, so there
is one unused bit in those 8 bytes that always has the same value as
the sign bit.
Sometimes it can be useful to use that single bit for something, because
there are many processing steps where we need to store *all* locations
of all nodes anyway and because there are so many nodes, every bit we
can save, counts.
So this adds some functionality to the osmium::Location class for
storing and retrieving the extra bit without affecting the rest of the
use of the Location class. This code does not attach any specific
meaning to that extra bit, that is for users of the functionality to
decide.
Internal storage is backwards compatible for valid coordinates and
the "undefined" coordinate. Behaviour for invalid coordinates has
changed.
For all of this to be activated you need to define the macro
OSMIUM_LOCATION_WITH_EXTRA_BIT in your source code before including
osmium/osm/location.hpp.
Fixes #3951 parent e45352d commit 457e392
4 files changed
Lines changed: 604 additions & 5 deletions
File tree
- include/osmium/osm
- test
- t/osm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
267 | 268 | | |
268 | 269 | | |
269 | 270 | | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
270 | 278 | | |
271 | 279 | | |
272 | 280 | | |
| |||
277 | 285 | | |
278 | 286 | | |
279 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
280 | 313 | | |
281 | 314 | | |
282 | 315 | | |
| |||
310 | 343 | | |
311 | 344 | | |
312 | 345 | | |
313 | | - | |
| 346 | + | |
314 | 347 | | |
315 | 348 | | |
316 | 349 | | |
| |||
320 | 353 | | |
321 | 354 | | |
322 | 355 | | |
323 | | - | |
| 356 | + | |
324 | 357 | | |
325 | 358 | | |
326 | 359 | | |
| |||
329 | 362 | | |
330 | 363 | | |
331 | 364 | | |
332 | | - | |
| 365 | + | |
333 | 366 | | |
334 | 367 | | |
335 | 368 | | |
| |||
379 | 412 | | |
380 | 413 | | |
381 | 414 | | |
382 | | - | |
| 415 | + | |
383 | 416 | | |
384 | 417 | | |
385 | 418 | | |
386 | 419 | | |
387 | 420 | | |
388 | 421 | | |
389 | 422 | | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
390 | 428 | | |
391 | | - | |
| 429 | + | |
392 | 430 | | |
393 | 431 | | |
394 | 432 | | |
| |||
479 | 517 | | |
480 | 518 | | |
481 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
482 | 587 | | |
483 | 588 | | |
484 | 589 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
0 commit comments