Group Abstract Group Abstract

Message Boards Message Boards

1
|
9.5K Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Accelerating data download from Wolfram curated database?

POSTED BY: Michal Ramsza
2 Replies

Thank you very much. Using the Listable attribute makes it way faster. Also, it is, indeed, better to partition a list into shorter lists because otherwise one can get operation timeout errors. I have the following results.

In[2]:= level1 = Entity["Country", "Poland"]["AdministrativeDivisions"];
In[3]:= GeoDistance[level1, level1, DistanceFunction -> "Center"]; // AbsoluteTiming

Out[3]= {1.11975, Null}

So, this is fast enough for my purposes. Thank you again. Interestingly, we have

In[7]:= Attributes[GeoDistance]

Out[7]= {Protected, ReadProtected}

So, it does not say that GeoDistance[] has attribute Listable.

POSTED BY: Michal Ramsza

You should take advantage of GeoDistance listability.

In[2]:= level1$dists = 
   GeoDistance[level1, level1, 
    DistanceFunction -> "Center"]; // AbsoluteTiming

Out[2]= {0.91751, Null}

Also with the default option is fast:

In[3]:= level1$dists2 = GeoDistance[level1, level1]; // AbsoluteTiming

Out[3]= {1.34659, Null}

But for a list as long as level2, you should do partition yourself and call GeoDistance in groups. Instead of using Partition, you can also use directly the natural partition of first administrative divisions, something like:

In[4]:= level2u = AdministrativeDivisionData[#, "Subdivisions"] & /@ level1;

In[5]:= level2$dist = Outer[GeoDistance, level2u, level2u, 1]; // AbsoluteTiming

Out[5]= {288.062, Null}
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard