3
$\begingroup$

I have a huge association of counties associated with some values. I am creating a GeoRegionValuePlot for this data. But every time I execute this the code in a fresh kernel, it always downloads the GeoGraphic tiles and this makes the plotting slow and time consuming.

Here is an example of what I am doing:

countries = 
  Entity["Country", #] & /@ {"UnitedStates", "Canada", "Mexico", 
    "Spain", "France", "Norway", "Egypt", "SaudiArabia", "Vietnam", 
    "Australia"};
values := RandomInteger[{1000, 9999}, 10];
data = AssociationThread[countries -> values];
GeoRegionValuePlot[data]

Is there a way to cache the downloaded tiles into .mx files that I can load everytime I run this code instead of downloading the tiles from the server?

$\endgroup$
2
$\begingroup$

A possible solution is use the GeoServer option extend the "CacheDuration". The default duration is 1 day but can be increased to 7 days with the following.

GeoRegionValuePlot[
 data,
 GeoServer -> {Automatic, "Storage" -> {"CacheDuration" -> Quantity[7, "Days"]}}
 ]

There is also the undocumented GeoGraphics`TileData function but I have not looked too deep into how you would use that or reincorporate its result back into geo-graphic functions. Perhaps someone else will give it a go.

Hope this helps.

$\endgroup$
  • $\begingroup$ The CacheDuration stores the data as long as the current session is active. If I start a new session, it again downloads the tiles. $\endgroup$ – Sâu May 2 '20 at 13:59
  • $\begingroup$ @Sâu Then you may want to look into that GeoGraphics`TileData function to see if your can store and restore. $\endgroup$ – Edmund May 2 '20 at 14:33
  • $\begingroup$ Can you point to any links, please? I am unable to find anything. Thanks. $\endgroup$ – Sâu May 2 '20 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.