-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
MapDataController::getMapDataWithGeometry
returns incomplete Ways
#4980
Comments
Adjusting the cache would most likely need some more work... sure, I would do it. Currently nodes are only stored in I think the [Edit: I overlooked the |
Regarding If you are saying that fetching nodes outside of the bbox without caching, ... well, this basically would need to be done for every single bbox no? There will always be one |
In the initial bbox fetch for those ways, the nodes are included and thus will be in the Though maybe if |
Biggest potential issue when So even returning removed nodes on See master...Helium314:SCEE:complete_ways for more comments. |
Disclaimer, the cache is your brainchild, which is why
And, I guess, optimizations could always be done later, after the fix. If we have a working version first, we could also have tests for that first, so when finally coming to the performance optimizations, we can be more sure that everything is working as expected because it is covered by tests.
I've looked at the other |
So I'll start with fetching nodes from DB and simply clearing nodeCache on trim, and do some performance logging. |
After some testing I think fetching nodes from DB is fine. It's necessary only after trimming, which does not occur frequently, and those nodes are put to |
I stumbled upon a weird issue that might be a bug in the cache. Looks like it's triggered by e.g. for This leads to incomplete tiles in The issue with the cache seems to be that these removed incomplete tiles are added to SpatialCache again as empty tiles when fetching newly added nodes form |
Oh wow, that's cool! I mean, that you maybe found some bug. Bugs in the cache can lead to all sorts of esoteric problems. I suggest you write a test for this and fix it in a separate branch though, it has nothing to do with this here, right? |
No, only that I noticed it as part of this work. But the |
Hmm, not sure about that. Maybe we conversed about this already. Maybe one of the two is inclusive on one edge and the other is exclusive on one edge. There is some lengthy comment in |
But I think you are right... TilesRect.asBoundingBox should return a bounding box that is floating-point-imprecision smaller than the tilesrect. So if you call BoundingBox.enclosingTilesRect, it should return again the same TilesRect. |
I had a suspicion that |
Because of float imprecision I presume? |
I guess, but didn't investigate any further |
@westnordost this bug may still happen in a more subtle way. When playing with an update to the insert node capabilities of SCEE, I had a crash because node -16 was not in the map data. Looks like we completely overlooked |
I think as part of @Helium314 's extensive caching PR or even a bit earlier than than, we made bounding box queries to local map data mimic the behavior of the OpenStreetMap API:
However, we have overlooked something: The OpenStreetMap API never returns incomplete ways. In other words, if a way is included in the result set, it always also includes all nodes of the way, even if some of these nodes are not in the given bounding box. Currently,
MapDataController::getMapDataWithGeometry
returns all ways that have nodes within the given bounding box, but omits nodes of these ways that are not within the given bounding box.This inconsistency has not been deliberate, but an oversight (at least from my part). I am pretty sure this is the source of #4925, maybe others. It definitely affects #4976.
A fix would look like this in the
ElementDao
(plus tests)...but I think the
MapDataCache
also would need to be changed somewhat. I looked a bit into that, and it'd be more than a few lines of code. @Helium314, what do you think? Do you think my assessment is correct? And if yes, would you be willing to take care of changing theMapDataCache
to this effect?The text was updated successfully, but these errors were encountered: