Message from discussion
Database storage for tiles
Received: by 10.91.47.27 with SMTP id z27mr1221942agj.2.1292229336649;
Mon, 13 Dec 2010 00:35:36 -0800 (PST)
X-BeenThere: osmdroid@googlegroups.com
Received: by 10.91.172.9 with SMTP id z9ls1083451ago.7.p; Mon, 13 Dec 2010
00:35:36 -0800 (PST)
MIME-Version: 1.0
Received: by 10.90.72.3 with SMTP id u3mr193721aga.47.1292229336366; Mon, 13
Dec 2010 00:35:36 -0800 (PST)
Received: by z9g2000yqz.googlegroups.com with HTTP; Mon, 13 Dec 2010 00:35:36
-0800 (PST)
Date: Mon, 13 Dec 2010 00:35:36 -0800 (PST)
In-Reply-To: <201012121825.38622.valentin.blot0@gmail.com>
X-IP: 193.173.106.62
References: <201011261105.08265.valentin.blot0@gmail.com> <201012121825.38622.valentin.blot0@gmail.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10,gzip(gfe)
Message-ID: <37b46a37-cabf-4e04-ae74-55253b3998b7@z9g2000yqz.googlegroups.com>
Subject: Re: Database storage for tiles
From: Neil <neilb...@gmail.com>
To: osmdroid <osmdroid@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I haven't looked at it. Since I'm the guy that removed the previous
database implementation I might be biased ;-)
However, I'd be inclined to look at this patch after issue 112 has
been merged back to trunk.
Neil
On Dec 12, 6:25=A0pm, Valentin Blot <valentin.bl...@gmail.com> wrote:
> Here is a new version of the patch updated to the latest commits. Don't f=
orget
> to add sqlitejdbc-v056.jar (http://www.zentus.com/sqlitejdbc/) to the fol=
der
> OSMMapTilePackager/lib/
>
> On Dec 12, 6:01 pm, "valentin.blot0" <valentin.bl...@gmail.com> wrote:> N=
oted.
>
> > Did any commiter take a look ? If you think I should change some
> > things, I would be glad to.
>
> > On Dec 10, 7:12 pm, Anders Petersson <and...@gmail.com> wrote:
>
> > > To avoid confusion -- I'm not involved at a code level for now.
> > > /Anders
>
> > > On Fri, Dec 10, 2010 at 7:10 PM, valentin.blot0
>
> <valentin.bl...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > > > Did anyone take a look ? Don't you want to commit it ?
>
> > > > On Nov 26, 11:38 am, "valentin.blot0" <valentin.bl...@gmail.com>
> > > > wrote:
> > > > > Actually I use the native sqlite in the android appli, but (as fa=
r as
> > > > > I know) there is no native sqlite library in java. For the
> > > > > calculation, "a << b" means : integer a moved b bits to the left.
> > > > > actually, at zoom level z, there are 2^z * 2^z tiles, so we encod=
e the
> > > > > (zoomLevel, x, y) tile by the integer which last zoomLevel bits
> > > > > represents y, the zoomLevel bits before represent x, and the
> > > > > log(zoomLevel) bits before represent z.
>
> > > > > On Nov 26, 11:23 am, Anders Petersson <and...@gmail.com> wrote:
>
> > > > > > Cool.
> > > > > > What's the reason for not using the native sqlite?
>
> > > > > > What's this curious calculation:
>
> > > > > > > int index =3D (((z << z) + x) << z) + y;
>
> > > > > > I haven't seen the construction z << z before. Have to think ab=
out
> > > > that.
>
> > > > > > /Anders
>
> > > > > > On Fri, Nov 26, 2010 at 11:05 AM, Valentin Blot <
> > > > valentin.bl...@gmail.com>wrote:
>
> > > > > > > Hi,
>
> > > > > > > I've been working on a storage in sqlite dbs for tiles, almos=
t the
> > > > same way
> > > > > > > it
> > > > > > > is treated with zips.
>
> > > > > > > The issue I had with zips was that every entry in the zip fil=
e is
> put
> > > > in
> > > > > > > memory
> > > > > > > at start, which involves a slow startup and a huge use of mem=
ory,
> > > > which
> > > > > > > caused
> > > > > > > a crash on my phone when loading a zip file containing 50000 =
tiles.
>
> > > > > > > On another hand, storing the tiles directly on sdcard is not =
a
> good
> > > > > > > solution
> > > > > > > either, since it wastes much space because of the small size =
of
> tile
> > > > files.
>
> > > > > > > So I developped an alternative way to store tiles, in a datab=
ase.
> The
> > > > tiles
> > > > > > > are stored as blob objects in db, and in order to have fast a=
ccess
> to
> > > > a
> > > > > > > given
> > > > > > > tile, I compute a unique identifier for each tile, which I us=
e as
> > > > primary.
> > > > > > > After running some tests, this seems to work quite well.
>
> > > > > > > I also modified the packager in order to create the db files.=
The
> > > > usage
> > > > > > > didn't
> > > > > > > change, except it looks at the extension of the output file :=
if it
> > > > is a
> > > > > > > zip
> > > > > > > file it behaves as before, and if it is not, it creates the
> database.
>
> > > > > > > Please have a look at my patch and tell me what you think of =
it.
> In
> > > > order
> > > > > > > for
> > > > > > > the new packager to work, you have to make it depend on the
> library
> > > > > > > sqlitejdbc-v056.jar, found here :http://www.zentus.com/sqlite=
jdbc/
>
>
>
> =A0DataBase.patch