Question

From ECW to MBTILES

  • 21 December 2016
  • 4 replies
  • 38 views

Userlevel 2
Badge +19

Hi.

I have to store a raster (ECW format) in a MBTILES (the writer is SQLITE).

The raster looks like this:

My first FME attempt has been this one:

The MBTILES format needs two tables in the database: tiles and metada. FME builds the first one and then I create the second one with SQLite Browser.

 

 

After renaming the database from .sqlite to .mbtiles, I add the file to QGIS to see the result:

The bigger the zoom the crazier the puzzle.

I have almost zero experience with FME and I don't know what I could do to fix this.

Does anyone know what is wrong with the process? Or is there a better way to get a MBTILES from a raster?

Thanks for your help!


4 replies

Badge +22

MBTiles uses the Tile Map Service Specification http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#TileMap_Diagram

It counts 0,0 from the lower left.

GoogleMap compatible tiles counts tiles from the upper left.

See http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/ for an interactive map that shows the tile indexes for various schemes and provides python code for conversion between them.

Badge +22

MBTiles uses the Tile Map Service Specification http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#TileMap_Diagram

It counts 0,0 from the lower left.

GoogleMap compatible tiles counts tiles from the upper left.

See http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/ for an interactive map that shows the tile indexes for various schemes and provides python code for conversion between them.

You should be able to use a lookup table to get the number of rows per zoom, and subtract the _tile_row from the WebMapTiler to get the correct column index. Rows are the same in either scheme.
Userlevel 2
Badge +19

MBTiles uses the Tile Map Service Specification http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#TileMap_Diagram

It counts 0,0 from the lower left.

GoogleMap compatible tiles counts tiles from the upper left.

See http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/ for an interactive map that shows the tile indexes for various schemes and provides python code for conversion between them.

Thank you so much!!

 

Thanks to your answer I've been able to solve the puzzle!

 

I only had to calculate the new row number: @pow(2,@Value(_zoom_level)) - @Value(_tile_row) - 1

 

 

 

Userlevel 4
Badge +13

Glad you got it going. There is an MBTiles writer that recently entered FME 2017 beta that I'd welcome you to try as well. We definitely could use feedback! Thanks.

Reply