-
Notifications
You must be signed in to change notification settings - Fork 69
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
Question about tile-grid #275
Comments
My goal is to actually render vector tiles. For that I want to get a list of xyz coordinates which need to be fetched in order to render an arbitrary bounding box defined in geographic coordinates. |
I found a cool tool which describes what the correct values are which I'm looking for: https://www.maptiler.com/google-maps-coordinates-tile-bounds-projection/#6/11.17/49.81 So it actually seems like GridIterator returns tiles coordinates in TMS format. |
I think I found the solution: The "Google" grid starts from the TopLeft instead of BottomLeft. |
Hallo Max, |
I think, we should follow the OGC Two Dimensional Tile Matrix Set specification http://docs.opengeospatial.org/is/17-083r2/17-083r2.html |
I'm not absolutely sure what you mean, but probably it would be "cleaner" to just iterate over the grid struct :)
yes, in fact I was able to modify the Grid definition and it is working now :)
Maybe in a few months I can understand such a document :D Just starting to write a graphical tile rendering and starting to grasp the complexity of GIS. |
I mean something like:
So you did change
Yes, it's a pity that OGC specs are so complicated... |
Here is an example: use tile_grid::{extent_wgs84_to_merc, Extent, Grid, GridIterator, Origin, Unit};
pub fn google_mercator() -> Grid {
Grid::new(
256,
256,
Extent {
minx: -20037508.3427892480,
miny: -20037508.3427892480,
maxx: 20037508.3427892480,
maxy: 20037508.3427892480,
},
3857,
Unit::Meters,
vec![
156543.0339280410,
78271.5169640205,
39135.75848201025,
19567.879241005125,
9783.939620502562,
4891.969810251281,
2445.9849051256406,
1222.9924525628203,
611.4962262814101,
305.7481131407051,
152.87405657035254,
76.43702828517627,
38.218514142588134,
19.109257071294067,
9.554628535647034,
4.777314267823517,
2.3886571339117584,
1.1943285669558792,
0.5971642834779396,
0.2985821417389698,
0.1492910708694849,
0.07464553543474245,
0.037322767717371225,
],
Origin::TopLeft,
)
}
///
/// Returns coordinates for tiles within bavaria according to the specified grid.
/// The grid is responsible for defining the coordinate system. For example whether
/// [Slippy map tilenames](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames) (also known as
/// XYZ) or [TMS](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#TileMap_Diagram) is
/// used.
///
/// ## Additional Resources:
///
/// * https://www.maptiler.com/google-maps-coordinates-tile-bounds-projection
/// * https://gist.github.com/maptiler/fddb5ce33ba995d5523de9afdf8ef118
pub fn tile_coordinates_bavaria(grid: &Grid, zoom: u8) -> Vec<(u8, u32, u32)> {
let tile_limits = grid.tile_limits(
extent_wgs84_to_merc(&Extent {
minx: 8.9771580802,
miny: 47.2703623267,
maxx: 13.8350427083,
maxy: 50.5644529365,
}),
0,
);
GridIterator::new(zoom, zoom, tile_limits).collect()
} |
Hello, I'm using the tile-grid library outside of t-rex for determining Slippy map tilenames.
I'm a bit confused about the values which are returned by the library. For example:
But
Grid::wgs84().tile_extent_xyz(0, 0, 0)
returnsExtent { minx: -180.0, miny: -90.0, maxx: 0.0, maxy: 90.0 }
. I belive this is not correct or at least I do not understand the result. The implementation in mapcache is equal: https://github.com/mapserver/mapcache/blob/main/lib/grid.c#L51If I fetch the tiles which have been collected, then I'm not able to fetch them from my hosted tile server (nginx with pbf files): https://maps.tuerantuer.org/europe_germany/tiles.json
The text was updated successfully, but these errors were encountered: