-
-
Notifications
You must be signed in to change notification settings - Fork 219
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 tile statistics to mbtiles #986
Conversation
29c1fba
to
8c35ffa
Compare
This comment was marked as outdated.
This comment was marked as outdated.
8c35ffa
to
21b4180
Compare
P.S. It is usually better to use |
Thx! Didn't know that before : ) |
Forgot to mention - I am not certain if you are affected by this, but mbtiles invert the Y value ( |
Thx for the mention. I did some research and I hope it's right.
Tile Origin and Bbox of 3857
Length of one single tile(20037508.34 * 2) / (2^zoom_level) MinX,MaxXMinX = OriginX + X * TileLength MinY,MaxY |
where | ||
for<'e> &'e mut T: SqliteExecutor<'e>, | ||
{ | ||
let file_size = query!( |
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.
Seems that PathBuf
couldn't work with file:something?mode=memory
together. Using sql query for the file size instead of PathBuf
now. @nyurik
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, seems reasonable. The alternative would be to have Option
for the size, and set it to None if unable to get it from the filesystem.
@bdon you did something similar for pmtiles, right? |
where | ||
for<'e> &'e mut T: SqliteExecutor<'e>, | ||
{ | ||
let file_size = query!( |
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, seems reasonable. The alternative would be to have Option
for the size, and set it to None if unable to get it from the filesystem.
Co-authored-by: Yuri Astrakhan <[email protected]>
e1f48d3
to
eefaf72
Compare
mbtiles/src/mbtiles.rs
Outdated
if self.count != 0 { | ||
let smallest = SizeFormatterBinary::new(self.smallest.expect("The smallest tile size of all zoom levels shouldn't be None when the tiles count of all zoom level is not 0")); | ||
let largest = SizeFormatterBinary::new(self.largest.expect("The largest tile size of all zoom levels shouldn't be None when the tiles count of all zoom level is not 0")); |
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.
no point for all this complex expect
strings which will never happen. Might as well do a simpler variant:
if self.count != 0 { | |
let smallest = SizeFormatterBinary::new(self.smallest.expect("The smallest tile size of all zoom levels shouldn't be None when the tiles count of all zoom level is not 0")); | |
let largest = SizeFormatterBinary::new(self.largest.expect("The largest tile size of all zoom levels shouldn't be None when the tiles count of all zoom level is not 0")); | |
if let (Some(smallest), Some(largest)) = (self.smallest, self.largest) { | |
let smallest = SizeFormatterBinary::new(smallest); | |
let largest = SizeFormatterBinary::new(largest); |
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.
Is The largest tile size of all zoom levels shouldn't be None
Ok? Or just "Couldn't be None".
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.
you don't need to do any asserts (.expected(...)
) - you can simply check if both values are not None, and if so, use them.
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.
Awesome job, well done, thank you!!!
Thx all your guidance !Hope I can do better in next : ) |
Try to fix #964