Skip to content

Do not store elevation if NaN - #3012

Merged
karussell merged 8 commits into
masterfrom
ele_nan
May 16, 2024
Merged

karussell merged 8 commits into
masterfrom
ele_nan

Conversation

@karussell

Copy link
Copy Markdown
Member

After #3002 an elevation value of NaN got converted to -1000 implicitly (occurs only for SRTM).

We should use 0 as it was before or let it configure.

@karussell karussell added this to the 10.0 milestone May 16, 2024
Comment on lines +1064 to 1076
updateDistancesFor(graph, 0, 3, 0, 0);
updateDistancesFor(graph, 3, 2.5, 0, 0);
updateDistancesFor(graph, 5, 1, 0, 0);
updateDistancesFor(graph, 8, 0, 0, 0);
updateDistancesFor(graph, 1, 3, 1, 0);
updateDistancesFor(graph, 4, 2, 1, 0);
updateDistancesFor(graph, 6, 1, 1, 0);
updateDistancesFor(graph, 9, 0, 1, 0);
updateDistancesFor(graph, 2, 3, 2, 0);
updateDistancesFor(graph, 11, 2, 2, 0);
updateDistancesFor(graph, 7, 1, 2, 0);
updateDistancesFor(graph, 10, 0, 2, 0);
}

@karussell karussell May 16, 2024 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we do not set the elevation we internally use NaN in PointAccess.setNode

public static int eleToUInt(double ele) {
if (Double.isNaN(ele)) throw new IllegalArgumentException("elevation cannot be NaN");
if (ele < -1000) return -1000;
if (ele >= Integer.MAX_VALUE / ELE_FACTOR - 1000) return Integer.MAX_VALUE;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only have 3 bytes for storage so MAX_VALUE is too big

@karussell
karussell merged commit 6603fbb into master May 16, 2024
@karussell
karussell deleted the ele_nan branch May 16, 2024 14:30

This branch was previously deployed

1 inactive deployment
benchmarks — 201b102b Deployed May 16, 2024 by karussell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants