Re: Caching tiles locally?



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

http://wiki.openstreetmap.org/wiki/Tile_usage_policy

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


On Thu, May 14, 2015 at 12:56 PM, Fabrice Delente <delentef gmail com> wrote:
Hello,

I use libchamplain in python+GTK3 to create a small GPS viewer for the
tracks I run in my hometown. I'd like to cache the data for my town on
my computer, so that I don't have to reload the data from the web.
I've looked at the API but don't see how I can do that, can anybody
give me directions? Thanks.
_______________________________________________
libchamplain-list mailing list
libchamplain-list gnome org
https://mail.gnome.org/mailman/listinfo/libchamplain-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]