Skip to main content
Question

From ECW to MBTILES

  • December 21, 2016
  • 4 replies
  • 293 views

oscard
Influencer
Forum|alt.badge.img+22

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!

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • December 21, 2016

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.


jdh
Contributor
Forum|alt.badge.img+40
  • Contributor
  • December 21, 2016

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.

oscard
Influencer
Forum|alt.badge.img+22
  • Author
  • Influencer
  • December 22, 2016

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

 

 

 


fmelizard
Safer
Forum|alt.badge.img+21
  • Safer
  • December 22, 2016

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.