-
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple mbtiles and martin-cp fixes (#1083)
* BREAKING: `martin-cp` will now set `format=pbf` instead of `mvt`. This is what QGIS and possibly others expect, and this is what tools like tilelive generates. * `martin-cp` sets `minzoom` and `maxzoom` metadata values based on the zoom parameters * Add `mbtiles meta-update` command to refresh zoom levels based on the present tiles. Partially addresses items in #1081
- Loading branch information
Showing
14 changed files
with
181 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ lints.workspace = true | |
|
||
[package] | ||
name = "martin-tile-utils" | ||
version = "0.3.0" | ||
version = "0.3.1" | ||
authors = ["Yuri Astrakhan <[email protected]>", "MapLibre contributors"] | ||
description = "Utilites to help with map tile processing, such as type and compression detection. Used by the MapLibre's Martin tile server." | ||
keywords = ["maps", "tiles", "mvt", "tileserver"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
mbtiles/.sqlx/query-47bdc12fe7b34fb2e4e1fc3b937bba64268170ab6e5381abfe07df24d8133229.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ lints.workspace = true | |
|
||
[package] | ||
name = "mbtiles" | ||
version = "0.8.4" | ||
version = "0.8.5" | ||
authors = ["Yuri Astrakhan <[email protected]>", "MapLibre contributors"] | ||
description = "A simple low-level MbTiles access and processing library, with some tile format detection and other relevant heuristics." | ||
keywords = ["mbtiles", "maps", "tiles", "mvt", "tilejson"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use log::info; | ||
use sqlx::query; | ||
|
||
use crate::errors::MbtResult; | ||
use crate::Mbtiles; | ||
|
||
impl Mbtiles { | ||
pub async fn update_metadata(&self) -> MbtResult<()> { | ||
let mut conn = self.open().await?; | ||
|
||
let info = query!( | ||
" | ||
SELECT min(zoom_level) AS min_zoom, | ||
max(zoom_level) AS max_zoom | ||
FROM tiles" | ||
) | ||
.fetch_one(&mut conn) | ||
.await?; | ||
|
||
if let Some(min_zoom) = info.min_zoom { | ||
info!("Updating minzoom to {min_zoom}"); | ||
self.set_metadata_value(&mut conn, "minzoom", &min_zoom) | ||
.await?; | ||
} | ||
if let Some(max_zoom) = info.max_zoom { | ||
info!("Updating maxzoom to {max_zoom}"); | ||
self.set_metadata_value(&mut conn, "maxzoom", &max_zoom) | ||
.await?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
source: mbtiles/tests/copy.rs | ||
expression: actual_value | ||
--- | ||
[[]] | ||
type = 'table' | ||
tbl_name = 'metadata' | ||
sql = ''' | ||
CREATE TABLE metadata ( | ||
name text NOT NULL PRIMARY KEY, | ||
value text)''' | ||
values = [ | ||
'( "maxzoom", "6" )', | ||
'( "md-edit", "value - v1" )', | ||
'( "md-remove", "value - remove" )', | ||
'( "md-same", "value - same" )', | ||
'( "minzoom", "3" )', | ||
] | ||
|
||
[[]] | ||
type = 'table' | ||
tbl_name = 'tiles' | ||
sql = ''' | ||
CREATE TABLE tiles ( | ||
zoom_level integer NOT NULL, | ||
tile_column integer NOT NULL, | ||
tile_row integer NOT NULL, | ||
tile_data blob, | ||
PRIMARY KEY(zoom_level, tile_column, tile_row))''' | ||
values = [ | ||
'( 3, 6, 7, blob(root) )', | ||
'( 5, 0, 0, blob(same) )', | ||
'( 5, 0, 1, blob() )', | ||
'( 5, 1, 1, blob(edit-v1) )', | ||
'( 5, 1, 2, blob() )', | ||
'( 5, 1, 3, blob(non-empty) )', | ||
'( 5, 2, 2, blob(remove) )', | ||
'( 5, 2, 3, blob() )', | ||
'( 6, 0, 3, blob(same) )', | ||
'( 6, 0, 5, blob(1-keep-1-rm) )', | ||
'( 6, 1, 4, blob(edit-v1) )', | ||
'( 6, 2, 6, blob(1-keep-1-rm) )', | ||
] | ||
|
||
[[]] | ||
type = 'index' | ||
tbl_name = 'metadata' | ||
|
||
[[]] | ||
type = 'index' | ||
tbl_name = 'tiles' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.