-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
Initial PMTiles support #2882
base: main
Are you sure you want to change the base?
Initial PMTiles support #2882
Conversation
Bloaty Results 🐋Compared to main
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2882-compared-to-main.txtCompared to d387090 (legacy)
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2882-compared-to-legacy.txt |
Benchmark Results ⚡
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/benchmark-results/pr-2882-compared-to-main.txt |
Bloaty Results (iOS) 🐋Compared to main
Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-2882-compared-to-main.txt |
6888722
to
e0bed86
Compare
I could probably figure this out from reading the code, but does this add support for reading local pmtiles files, reading over http, or both? |
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.
Great stuff!
Needs some tests. Due to the binary size increase we also need to make sure there is an opt-out with a preprocessor macro
It is agnostic about it, it just makes requests to the Resource Loader, then it use the appropriate source, that is, you can use |
Thank you! It was a great effort to achieve this implementation, but I'm still learning how to make such a component integration properly. Some adjustements will be made. Since the |
94f448c
to
e778def
Compare
03b9ef4
to
d3c191c
Compare
Hi, @louwers. Could you check also the last commit, please? I'm not sure if I took the best way to control the PMTiles code using CMake. |
d3c191c
to
5e9e6cc
Compare
namespace { | ||
// https://github.com/protomaps/PMTiles/blob/main/spec/v3/spec.md#3-header | ||
constexpr int PMTILES_HEADER_OFFSET = 0; | ||
constexpr int PMTILES_HEADER_LENGTH = 127; |
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 all upper case names should be reserved for macros. https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#nl9-use-all_caps-for-macro-names-only
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.
Originally I wanted to declare these numbers as defines, but how to use them correctly? The compiler complains when I define them using #define.
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.
Keep it constexpr
, but lowercase them.
Also camelcase maybe pmtilesHeaderOffset
?
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.
Looks OK!
I would prefer as little #define
s in the codebase as possible. Maybe zero, with a dummy implementation available?
Some tests are also still needed.
Interesting. My implementation was in direction of vanishing alway everything if |
I want to avoid The dummy implementation would be another file that does not pull in the PMTiles library as a dependency, which is where the bulk of the binary size increase is coming from. The dummy implementation would just always return |
Okay, I will think about it and implement these changes. Without |
I tried it out with wipfli's FourSquare POI PMTiles. https://wipfli.github.io/foursquare-os-places-pmtiles/style.json The On Android nothing is visible when using this style Seems to be some font loading issue. When I remove all Symbol layers the layers using the
Can't seem to reproduce it second time around. Android: 2024-11-22 15:16:57.088 12254-12254 Mbgl org.maplibre.android.testapp E {android.testapp}[Style]: Failed to load source foursquare-10M: Error fetching PMTiles header: HTTP status code 206 |
Now seems fully functional on Android! Untitled.mp4 |
@louwers That's nice! So now the only requirement is the |
The fact that the Android tests were passing, while in fact PMTiles did not work means we need additional test coverage. Edit: Oh the network tests do not run on Android. That is probably why. |
I agree, probably this is the cause, but I still need help to verify if coverage tests are enough for PMTiles. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
dd8a01f
to
28c4b01
Compare
Since now we can test PMTiles with Windows-CI (and other workflows, of course) and tests are passing, I think we are ready for the review. |
This PR introduces the PMTiles support, which was first asked in #1978. It's experimental for now, and needs more testing, so I need everyone interested in this feature to test it, so we can mitigate problems that can arise from my modifications.