hI!
In name of memory usage, the first part of the code I would suggest the use of Open read, as follows:
SetDirectory["/home/etc...."];
Airports =(*Import["/home/etc.../airports.dat","CSV"];*)
OpenRead["/home/etc.../airports.dat",
BinaryFormat -> True];
Routes =(*Import["home/etc.../routes.dat","CSV"];*)
OpenRead["home/etc.../routes.dat", BinaryFormat -> True];
airports =
Flatten[StringSplit[#, ","] & /@
StringSplit[ReadList[Airports, Record], "\n"],
1] /. {"\\N" -> "Non", "\"\"" -> "Non"};
routes = StringSplit[ReadList[Routes, String], ",", Infinity];
DumpSave["airports.mx", airports];(* here we save files in the format .mx*)
DumpSave["routes.mx", routes];
Close[Routes]; Close[Airports];
Quit[];(*finish kernel*)
And then, for Airports:
SetDirectory["home/etc.../routes"];
<< airports.mx;(*!*)
<< routes.mx;(*!*)
GeoRegionValuePlot[
Table[GeoPosition[ToExpression[airports[[i, {-5, -4}]]]] -> 1., {i, 1,
Length[airports]}], PlotStyle -> PointSize[0.003], PlotRange -> 1,
ImageSize -> Medium];
Quit[];
Routes :
I Use "linksclean = Developer`ToPackedArray[etc...}", as a useful way to packing data.
SetDirectory["home/etc.../routes"];
<< airports.mx;
<< routes.mx;
codecoords =
Table[ToExpression[airports[[i, 5]]] ->
GeoPosition[ToExpression[airports[[i, {-5, -4}]]]], {i, 1,
Length[airports]}];
links = Monitor[
Table[routes[[j, {3, 5}]] /. codecoords, {j, 1, Length[routes]}],
ProgressIndicator[j, {1, Length[routes]}]];
linksclean =
Developer`ToPackedArray[
Select[links,
Head[#[[1]]] == GeoPosition && Head[#[[2]]] == GeoPosition &]];
With[{locations = RandomChoice[linksclean, 14000]},
GeoGraphics[{{Green, Opacity[0.3], AbsoluteThickness[0.0001],
GeoPath[locations, "Geodesic"]}}, GeoRange -> "World",
GeoProjection -> Automatic, GeoBackground -> GeoStyling["ReliefMap"],
ImageSize -> {1200, 600}]];
Quit[];