Seems that GeoRegionValuePlot requests data from the internet multiple times to process its plot.

As an example, let's graph smoking per capita worldwide.

smokers = 
    consumption_per_capita", "Data"];
table = Rest@smokers[[1, 1, 2]][[All, 2 ;;]]; 
rule = "Republic of Macedonia" -> "Macedonia"; 
  {CountryData[StringTrim@#[[1]] /. rule], Interpreter["Number"][#[[2]]]} & /@ table, 
  ImageSize -> Large, 
  PlotLabel -> "Cigarrete Consumption Per Capita"]

While waiting for the plot to be graphed, you can see that mathematica accesses servers for information at least twice (Message below shows up twice, then takes additional time to process).

enter image description here

enter image description here

How can the GeoRegionValuePlot performance be improved? Is there a way to cache the information retrieved by the function (maps, polygons, etc) in the local drive so subsequent calls to the GeoRegionValuePlot will perform better?


2 Answers 2


The Wolfram '.wdx' format was made for this. It maintains wolfram code in a file, but only code, unlike a notebook. Read up here for more info.

The first two lines stay the same, then you would export the data as so:

Export["smokers.wdx", table];

This creates a file in MyDocuments (if in windows, otherwise the folder above where your notebooks are normally stored. To open it if you can't find it/lazy, use:)


Then to open this file, use below:

importedtable = Import["smokers.wdx"];

Then plot it with the below (its identical to your's but using the imported data: "importedtable"):

rule = "Republic of Macedonia" -> "Macedonia";
GeoRegionValuePlot[{CountryData[StringTrim@#[[1]] /. rule], Interpreter["Number"[#[[2]]]} & /@ importedsmokers, 
ImageSize -> Large, PlotLabel -> "Cigarrete Consumption Per Capita"]

To use it again and again, just import the ".wdx"

  • $\begingroup$ I believe the poster has issues with CountyData[] and Interpreter[] needing to fetch data multiple times. One can preload curated Country data with CountryData[All,"Preload"]. Remove the Interpreter[] function for such a simple data type transform, ToExpression (not my first choice). I would first manipulate the final list outside the GeoRegionValuePlot[] function to desired format {reg -> val} then pass it in. The List that may be saved to wdx format is that {reg-> val}. $\endgroup$
    – Hans
    Commented Aug 10, 2014 at 16:27
  • $\begingroup$ @Hans, thanks for the answer and comment. I may have to rewrite the question.The issue is not pulling the data itself, but processing the GeoRegionValuePlot. Wanted to use the manipulate function to zoom to specific continents or country groups. The function takes a long time to process. I'll update the question. $\endgroup$
    – Zviovich
    Commented Aug 10, 2014 at 16:51
  • $\begingroup$ @Hans,@PatoCriollo, I see what you mean now. Yes, my way doesn't work, and I don't know how you would. I had a similar problem with GeoGraphics (new to 10 also), and I still don't know how to solve it. Seems like this may be a large problem in 10 that needs a clever work around. $\endgroup$
    – ptolemy0
    Commented Aug 10, 2014 at 17:12

In 10.0.1 at least, the data does get cached (If you run, say, GeoRegionValuePlot[CountryData[] -> "PopulationDensity"]

the second time is much faster with no download icons (although in this case it still takes ~3 sec to paint all the country polygons)

Also notice that the first time, the first download is much faster than the second. it gets "Positions" of each thing first, then gets the "Polygon"s (if necessary).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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