Re: Caching tiles locally?
- From: Jiří Techet <techet gmail com>
- To: Fabrice Delente <delentef gmail com>
- Cc: libchamplain mailing list <libchamplain-list gnome org>
- Subject: Re: Caching tiles locally?
- Date: Thu, 14 May 2015 14:21:41 +0200
Hi Fabrice,
in principle you have to get the map source from the view using
champlain_view_get_map_source()
then get x, y tile coordinates using
champlain_map_source_get_x()
champlain_map_source_get_y()
for specific latitude and longitude and create a new tile with these coordinates using
champlain_tile_new_full ()
(tile size is 256). At this point you may also want to connect the "render-complete" signal to know when tile gets loaded. Now call
champlain_map_source_fill_tile()
The tile will be filled and cached automatically in libchamplain cache under ~/.cache/champlain.
Now you'll have to do the above in a loop for the area you are interested in and also for the zoom levels you are interested in.
But most importantly, make sure you follow the terms of use of the tile provider you are going to use. See for instance the section "Bulk Downloading" here
This is also the reason why you have to do such a thing manually (provided you know what you are doing and it's legal) and there's no single-call function directly in libchamplain so people don't cause high load on the tile servers.
Cheers,
Jiri
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]