Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkAndshark committed Dec 30, 2024
1 parent 3b3224f commit a68126d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions martin/src/cog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ fn get_meta(path: &PathBuf) -> Result<Meta, FileError> {
} else {
None
};

let (tiling_schema_name, zoom_level) = get_tilling_schema(&mut decoder).unwrap_or((None, None));

let images_ifd = get_images_ifd(&mut decoder);

let mut zoom_and_ifd: HashMap<u8, usize> = HashMap::new();
Expand Down Expand Up @@ -325,19 +328,14 @@ fn get_meta(path: &PathBuf) -> Result<Meta, FileError> {
.max()
.ok_or_else(|| CogError::NoImagesFound(path.clone()))?;

let (tiling_schema_name, zoom_level) = get_tilling_schema(&mut decoder).unwrap_or((None, None));

let google_compatible_max_zoom =
if tiling_schema_name == Some("GoogleMapsCompatible".to_string()) {
zoom_level
} else {
None
};
let google_compatible_min_zoom = if let Some(google_max_zoom) = google_compatible_max_zoom {
Some(google_max_zoom - max_zoom + min_zoom)
} else {
None
};
let google_compatible_min_zoom =
google_compatible_max_zoom.map(|google_max_zoom| google_max_zoom - max_zoom + min_zoom);

Ok(Meta {
min_zoom: *min_zoom,
Expand Down
4 changes: 2 additions & 2 deletions tests/expected/auto/google_compatible.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"maxzoom": 2,
"minzoom": 0,
"maxzoom": 14,
"minzoom": 12,
"tilejson": "3.0.0",
"tiles": [
"http://localhost:3111/google_compatible/{z}/{x}/{y}"
Expand Down

0 comments on commit a68126d

Please sign in to comment.