Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json_render is not accurate for osm node ID #7016

Open
fenwuyaoji opened this issue Aug 16, 2024 · 6 comments
Open

Json_render is not accurate for osm node ID #7016

fenwuyaoji opened this issue Aug 16, 2024 · 6 comments

Comments

@fenwuyaoji
Copy link
Contributor

fenwuyaoji commented Aug 16, 2024

Issue

@Rejudge-F, @DennisOSRM, @SiarheiFedartsou Hi, all. We are facing an inaccurate OSM node ID format issue and I found it's related to #6531.

The case is:
original node ID: 11117421192, after format: 1.111742119e+10.

The reason I think is that PackedOSMIDs

using PackedOSMIDs = util::detail::PackedVector<OSMNodeID, 34, Ownership>;
is 34 bits and the max length of it is 11. Why do we limit the number length to less than 10? I noticed that before #6531, we only limited the decimal to less than 10, but now we limit the whole number. should we rollback to the previous version or just relax the length to 11?

Steps to reproduce

Add below test case to unit_tests/util/json_render.cpp.

    output.clear();
    renderer(11117421192);
    BOOST_CHECK_EQUAL(output, "1.111742119e+10");
@Rejudge-F
Copy link
Contributor

If a rollback is performed, it will cause more serious problems, resulting in incorrect map match results. In addition, I found that the ID type used by OSRM elsewhere is int32, with a maximum of 10 digits. If only this place is modified, there seem to be problems elsewhere.
If you modify the type used by osrm, it would be a relatively large project, so I recommend that you could shrink the ID within the int32 range.

@fenwuyaoji
Copy link
Contributor Author

fenwuyaoji commented Aug 16, 2024

thanks for your quick response. I see your point. how about just relax it to 11, like .11g? I think this part is only used for json format, right? then nothing will be affected I think.

@Rejudge-F
Copy link
Contributor

@fenwuyaoji I think you can fork this repository and modify it, but I don’t recommend doing so. Many parts of the code use the INT32 type for OSM IDs. Therefore, I suggest that you keep your IDs within the INT32 range and then use OSRM to process the data.
By the way, whether it’s 10-digit or 11-digit IDs, neither seems to be an ideal solution. If you can find a more universal way to solve this problem, that would be the best.

@fenwuyaoji
Copy link
Contributor Author

okay, I will look through the code and see whether I can do anything better to solve it.

@fenwuyaoji
Copy link
Contributor Author

fenwuyaoji commented Aug 19, 2024

Hi, I found that in the file

using OSMNodeID = osrm::Alias<std::uint64_t, tag::osm_node_id>;
, should be proposed in #6020 , OSMNodeID is typed of uint64, while NodeID/EdgeID/NameID are uint32. As also mentioned in #6341, I think the internal osm ID should be max to 34-bit. what you said 'Many parts of the code use the INT32 type for OSM IDs.' I think it's NodeID, not OSMNodeID.
please see this summary: #6341 (comment)
many guys are facing the same issue, e.g. #6758, #6594. I think it's worth to relax it to 11 in json_render.

@mjjbell HI, do you have any idea on this issue?

@Rejudge-F
Copy link
Contributor

I thank you are right, it seems reasonable to expand to 11 digits and you can submit a PR to see the administrator's opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants