-
Notifications
You must be signed in to change notification settings - Fork 5
merc_location_to_tile_coords seems to produce incorrect tile position #4
Copy link
Copy link
Open
Description
To me it seems that merc_location_to_tile_coords with zoom values other than 8 produces incorrect positions inside a tile. For example
let paris = (48.864716, 2.349014);
let latlon = slippy_map_tiles::LatLon::new(paris.0 as f32, paris.1 as f32)
.unwrap()
.to_3857();
info!("3857 {:?}", latlon);
// 3857 (261491.05, 6251937.5)
// This seems to be the correct 3857 location
let tile_coord =
slippy_map_tiles::merc_location_to_tile_coords(latlon.0 as f64, latlon.1 as f64, 8);
info!("pos {:?}", tile_coord);
// pos ((129, 167), (171, 14))
// this is the correct location within this tile at zoom 8
with a zoom of 10, pos becomes:
pos ((518, 671), (174, 830)), which given a 256x256 image, is out of bounds. Lower values than 8 seem to work correctly on the x axis but leave y at zero, zoom 4:
pos ((8, 10), (26, 0))
It could be entirely possible that I am using the library incorrectly - if so, sorry in advance!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels