-
Notifications
You must be signed in to change notification settings - Fork 302
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
MapBox VectorTile: bug fixes using an official MapBox stream #2469
base: master
Are you sure you want to change the base?
Conversation
5581f1e
to
9fcfdee
Compare
9fcfdee
to
f1bd8aa
Compare
bc8515d
to
18b1d2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the debug and the fixes :)
@@ -108,6 +108,7 @@ class Source extends InformationsData { | |||
constructor(source) { | |||
super(source); | |||
this.isSource = true; | |||
this.warn = new Set(); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aggregating logs is a good idea and needed in itowns. I think we should not store aggregated logs in objects and pass them around as function parameters. An alternative implementation would be to implement a LogAggregator that stores logs, aggregates them and can log info, warn and errors. A global instance could be used by all itowns components then. If we do so, we need to be careful with memory usage and empty the log cache frequently. And if we don't want to implement it ourselves, I'm sure there are libraries available. However I think that's out of scope of this PR, so I'd be for removing this log aggregation for now and implement it differently later. @Desplandis what is your opinion on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we could have some kind of heap with a max size to aggregate those warnings. I think there should be some kind of library to do it. However, I agree that this is out of scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ftoromanoff can you remove this part from this PR then please ? You can open an issue on this matter if you want to keep track of it
})) { | ||
label.horizonCullingPoint && GlobeLayer.horizonCulling(label.horizonCullingPoint) | ||
// Why do we might need this part ? | ||
// || // Check if content isn't present in visible labels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was to avoid overlapping but I'm not sure we need it too so let's remove it completely in this case. We still have git if we need it later. @Desplandis WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can't reproduce the overlapping and it seems to be the case here. I think we could totally remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for now, it seems that it is not needed on what I tested and I asked @mgermerie why he used it in the first place.
} else if (!collection.features.find(f => f.id === layer.id)) { | ||
feature = collection.newFeatureByReference(feature); | ||
feature.id = layer.id; | ||
feature.order = layer.order; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like some kind of optimization, can you explain in more details why you remove it please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it to simplified. It is also linked to a trouble to link a specifique feature.style to it's properties.
With this optimization I got these error:
linked with
Lines 903 to 914 in 18cc3ee
style.icon.cropValues = function _(p) { | |
const id = iconImg.replace(/\{(.+?)\}/g, (a, b) => (p[b] || '')).trim(); | |
if (sprites[id] === undefined) { | |
const warning = `WARNING: "${id}" not found in sprite file`; | |
if (!warn.has(warning)) { | |
warn.add(warning); | |
console.warn(warning); | |
} | |
sprites[id] = cropValueDefault;// or return cropValueDefault; | |
} | |
return sprites[id]; | |
}; |
The properties of the current featreu doesn't seems to be the right one when the function is called...
That I don't get when each feature as it's own existence. It might probalby be solved other wise to avoid the probable border effect induce by newFeatureByReference
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit weird that you get this warning since we look for features with the same id that would already have been parsed.
If we remove this code I'm not sure we need to features collection at all since from my understanding it is to avoid creating multiple times the same feature in memory. It would be interresting to check if it is common that same features are in different pbf and therefore what if this optimization is really needed. It seems a bit unrelated to this PR though so what I propose is to:
- keep this code but comment it for now
- add a comment above explaining what we've said here: this optimization is not fully working and needs to be re-assessed. It has been deactivated for now, see: https://github.com/iTowns/itowns/pull/2469/files#r1861802136
18b1d2c
to
18cc3ee
Compare
Using the mapbox style file "mapbox://styles/mapbox/streets-v8" on mapLib and on itowns, I noticed the result as not at all comparable.
Thus I looked layers by layers to understand what were we doing wrong in itowns and tried to correct a maximum of bugs. The example using the mapbox stream has been added. (examples/vector_tile_2d_mapbox.html)
What this PR does: