1

Closed

implement MBTiles

description

Felix has added support for MBTiles.

I made some modification to get it work with custom tile schema's.

Some remarks on my changes:
  • I added constructor arguments for a specific TileSchema. This is what I use for the RD projection/schema.
  • There are now 3 ways to specify a schema
    1) the default MBTiles schema is assumed when nothing is specified.
    2) specified in the constructor
    3) through the 'map' table that is used in the haiti sample.
  • I now assume the extent is in the projection of the TileSchema. So in the case of regular MBTiles it needs to be in SphericalMercator.
  • I have not implemented this yet, so I just left this as a todo.
  • Reading the extents of the tiles per layer is slow. But this now only happens when there is a 'map' table. Perhaps it could be improved with indexes.
  • The bbox per layer (used as an optimization in MBTiles) is also required by WMTS. We should prepare for this so MBTiles needs no custom code for this.
  • I added a none 'type' (base|overlay). You can no specify the type in the constructor. When no type is specified it is read from the 'metadata' table.
  • I did not test MBTiles in Silverlight.
Closed Apr 24 at 7:37 AM by pauldendulk
not an issue

comments

FObermaier wrote Apr 23, 2012 at 8:10 AM

IMHO if a different schema is used this has to be made clear in the metadata table since the MBTiles spec states (https://github.com/mapbox/mbtiles-spec/blob/master/1.1/spec.md) that "The global-mercator (aka Spherical Mercator) profile is assumed" (bold). Perhaps we should make a feature request for using other schemas.

We can speed up construction by just querying for the present zoom-levels and than just query row/col extent for the lowest zoom-level and compute it for the others. This would leave it to the provider of the MBTiles file to ensure its consitency. I don't know if that would be suitable for WMTS as well.

pauldendulk wrote Apr 23, 2012 at 3:57 PM

The current implementation does assumes spherical mercator. Yet it is possible to override this by adding a TileSchema as constructor argument. The argument is optional. Strictly speaking such a tileset is not MBTiles. Internally we call it RDTiles (RD referring to the dutch projection system).

I guess setting the right index should also improve performance.

FObermaier wrote Apr 24, 2012 at 7:02 AM

I guess setting the right index should also improve performance.
Probably will, but that means we'll have to check every mbtiles sqlite database for presence of indices for the required columns and if not there add them. Plus: the spec askes for a table called "tiles" but the mbtiles databases I've seen so far it is a view. That makes it even harder to evaluate where to create the indices.