[Geopackage] Query on gpkg_tile_matrix - matrix_width and matrix_height
Brad Hards
bradh at frogmouth.net
Wed Jun 3 05:41:53 EDT 2015
On Wed, 3 Jun 2015 09:58:39 AM Pepijn Van Eeckhoudt wrote:
> Yes, that’s the intended usage. gpkg_tile_matrix_set and gpkg_tile_matrix
> define the grid/matrix/areas where tiles are located. This is orthogonal to
> presence of data in the user data table.
Yes.
> The misleading part in the spec is the use of the word ‘minimum bounding
> rectangle’. That should probably be removed, but that’s something for the
> SWG to tackle.
Yes.
> If you need to determine the MBR for actually present data you should do a
> SQL query to select minimum and maximum tile_row and tile_column from the
> user data table.
Yes.
> Note that this is identical to WMTS. gpkg_tile_matrix_set and
> gpkg_tile_matrix are equivalent to TileMatrixSet and TileMatrix in WMTS.
> In WMTS you would use TileMatrixLimits to indicate a sub region of the
> entire tile structure that actually contains data. GeoPackage doesn’t have
> this, but you can achieve a similar effect using the SQL query above or the
> extent in gpkg_contents.
OK. I tried a WMTS client implementation once. I'd rather not think about it
again :-)
> To be honest I don’t really understand what the confusion is about. Think
> about this from a georeferencing perspective. Where is a tile (z, c, r)
> located? The equations for that are
>
> tile_matrix_set_width = tile_matrix_set.max_x - tile_matrix_set.min_x
> tile_matrix_set_height = tile_matrix_set.max_y - tile_matrix_set.min_y
> tile_upper_left_x = tile_matrix_set.min_x + c * tile_matrix_set_width /
> tile_matrix(z).matrix_width
Or equivalently,
tile_upper_left_x = tile_matrix_set.min_x + c * tile_matrix(z).pixel_x_size *
tile_matrix(z).tile_width
> tile_upper_left_y = tile_matrix_set.max_y - r *
> tile_matrix_set_height / tile_matrix(z).matrix_height
Or equivalently,
tile_upper_left_y = tile_matrix_set.max_y - r * tile_matrix(z).pixel_y_size *
tile_matrix(z).tile_height
> For each zoom level the following must hold
> tile_matrix_set_width = tile_matrix(z).pixel_x_size *
> tile_matrix(z).tile_width * tile_matrix(z).matrix_width
> tile_matrix_set_height = tile_matrix(z).pixel_y_size *
> tile_matrix(z).tile_height * tile_matrix(z).matrix_height
Yes.
And I think the corrected "Whitehorse" sample reflects that. So I'm happy.
Brad
More information about the Geopackage
mailing list