Following on from the 3D plots of the Earth globes in comments to an earlier post, here's some hacky code to grab longtitude and latitude.

(nb. This code attempts to send the IP address of your primary DNS to so don't run it if you don't want that action.)

if kernelopts(platform)="windows" then
   res:=ssystem("ipconfig /all"): res:=res[2];
   StringTools:-Search("Primary Dns Suffix",res);
   ans:=ssystem("hostname -y"): ans:=ans[2];
end if:

                  latitude, longitude := -41.4569, 147.1793

This could be used to put an arrow or disk marking "you are here" on the plotted globe.

The code to get an IP is very hacky. On Unix/Linux it is assuming use of yp. The dicing up by StringTools is very crude. I ran it on ubuntu 64 and Windows 7 in Maple 15.01 and 16.01 (but the initial IP extraction failed on 14.01). Thus the first part may not work for most people. But once the IP is obtained (in some revised way) then it can be used for `ans` in the HTTP-Get() call.


Please Wait...