-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
Add .mbtiles support #549
Add .mbtiles support #549
Conversation
* All tests and internal code now uses ST_TileEnvelope function * Remove `tile_bbox` * Rename test function sources for clarity - this will be needed in a subsequent PR to add other function tests
Can handle the `getmvt(z,x,y) -> [bytea,md5]` case and several others.
* All table sources now use the same system as functions * Proper table name escaping * Prepared statements might speed things up, but this is not certain because we prepare on each get request. At least now we can optimize in one place.
BREAKING: * srid is now the same type as PG -- i32 * renamed config vals `table_sources` and `function_sources` into `tables` and `functions` Fixes: * predictable order of instantiation * bounding boxes computed in parallel for all tables (when not configured) * split up discovery and query creation - this way user overrides happen before the final query is generated * more proper name escaping * lots of test improvements
* Fix id column issue * Detect if postgis is newer than 3.1 and use st_tileenvolope margin param
* Use `PathBuf` instead of `String` where dealing with files * Parse keep_alive as u64 * More config tests to crash if martin output contains warnings or errors
* Use `PathBuf` instead of `String` where dealing with files * Parse keep_alive as u64 * More config tests to crash if martin output contains warnings or errors
* Use `PathBuf` instead of `String` where dealing with files * Parse keep_alive as u64 * More config tests to crash if martin output contains warnings or errors
* Use `PathBuf` instead of `String` where dealing with files * Parse keep_alive as u64 * More config tests to crash if martin output contains warnings or errors
* Since this is a library, all errors should have a strongly typed enum. * table bounds computing function was not escaping identifiers * table bounds computation was also silently ignoring all errors
Codecov ReportBase: 58.65% // Head: 57.75% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #549 +/- ##
==========================================
- Coverage 58.65% 57.75% -0.90%
==========================================
Files 27 29 +2
Lines 2242 2507 +265
==========================================
+ Hits 1315 1448 +133
- Misses 927 1059 +132
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I'm looking right now for a mbtiles server so this comes just in time 😅 I'll test this out now, for a code review the PR is maybe too large. Maybe you can leave comments where you wish reviews. |
Thanks, let me know if you run into any issues. The reason this pr is so big is because it includes two other prs. If you review them in order, they will be much smaller. @stepankuzmin said he will try to get to them today |
src/file_config.rs
Outdated
- /dir-path | ||
- /path/to/pmtiles2.pmtiles | ||
sources: | ||
pm-src1: /tmp/pmtiles.pmtiles |
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.
Probably we should also add the *.mbtiles
test here?
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.
there is no point because this test is not specific to pmtiles - it decodes a sub-element under pmtiles:
or mbtiles:
keys. I will change the filenames to make it clearer.
mbtiles/src/lib.rs
Outdated
pub async fn get_metadata(&self) -> MbtResult<Metadata> { | ||
let mut res = Metadata { | ||
tilejson: tilejson! { | ||
tiles: vec![String::new()], |
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 this adds an empty string in the tiles array.
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, I'll need to fix this, and also handle the x-forwarded-for header (there is a ticket for that). I'll have time tonight to look at it, in a few hrs
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.
That header works for me already. It places the correct host and protocol
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.
which header? We currently handle x-rewrite-url
, which is a really bad one from the security perspective. See #504
@nyurik is there a good source to read more about what this change allows? Would this mean MapLibre can display data from a static .mbtiles file without the need to spin up a map server? |
@ewagstaff this change simply allows mbtiles file to be Martin's source of data, just like Postgres and |
Merge after #548 and #517
Adds a new .mbtiles backend, without the grid support. Uses extensive tile content detection, i.e. if the content is gzipped, png, jpeg, gif, webp.
From CLI, can be as easy as adding a path to a directory that contains a .mbtiles file (works just like pmtiles support)
From configuration file, the path can be specified in a number of ways (same as pmtiles)
Fixes #494