Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46786

Extract UTFGrid from MBTiles database

From Carmen Campos Bordons <embrujada_w@hotmail.com>
Subject Extract UTFGrid from MBTiles database
Date 2013-06-03 12:02 +0000
Newsgroups comp.lang.python
Message-ID <mailman.2592.1370261027.3114.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

I would appreciate any help or comment.
The idea is
to create a server in python that serves maps on the internet. The maps have to
be in MBTiles format, which is a SQLite database that store all the map tiles
in a single file. Taking this as an example http://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html#4.00/36.74/28.30 The tiles are images of the
map in png, like this one http://a.tiles.mapbox.com/v3/mapbox.geography-class/4/7/7.png and apart from the tiles, in the
database is stored the UTFGrid information, like this file http://a.tiles.mapbox.com/v3/mapbox.geography-class/4/7/7.grid.json. The UTFGrid (you can consult in http://www.mapbox.com/developers/utfgrid/) permits than when you hover in the
map, some extra information appears referring to the point where the mouse is.
As you can see in this example http://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html#4.00/36.74/28.30 a infobox appears with the
flag of every country(which is the information stored in the UTFGrid file).

In the
MBTiles database there are two table (also other, but not important in this case):
“tiles”, where are stored the tiles; and “grids”, where is stored the UTFGrid
associated to every tile.

>From the
MBTiles I can extract the tiles and display a normal map, and I can also
extract the UTFGrid file individually (not all together, like the tiles that I
can see the whole map; with the UTFGrid I just get one file). When I show the
map normally, the infoboxes do not appear. But I do not get any error in
command line or in the website. It just like the UTFGrid is empty.

Attached is
the code I am using to access the MBtiles file.

I am using
this SQL to access the MBTiles file

“select
grid from grids where tile_column=? and tile_row=? and zoom_level=?", (x,
y, z)

And if I
change it for this

"select
grid from grids where tile_column=? and tile_row=? and zoom_level=?", (67,
84, 7)

I am
getting always the same UTFGrid, but in this case it shows the infoboxes on the
map, that one for all the tiles.

It is like
if I have this part of the map http://a.tiles.mapbox.com/v3/mapbox.geography-class/page.html#4.00/10.14/17.31 but I always get the
infoboxes of this tile http://a.tiles.mapbox.com/v3/mapbox.geography-class/4/7/7.png I get the infoboxes in all the
tiles, but all of them are showing the flag of that tile.
Thanks,Carmen 		 	   		  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Extract UTFGrid from MBTiles database Carmen Campos Bordons <embrujada_w@hotmail.com> - 2013-06-03 12:02 +0000

csiph-web