Saturday, June 11, 2011

Cartography in GnuPlot tutorial

Okay... Cartography maybe sounds so alien to you ... so what the heck is it ?

According to old buddy Google, arghh.. beat it. I just copy and pasta here

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
car·tog·ra·phy
noun /kärˈtägrəfē/ 

The science or practice of drawing maps
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Ok, so we know that roughly the cartography got something to do with my Geography or Social Studies (Kajian Tempatan) ages ago ....


Sadly, this art of map making is almost lost to nowadays secondary students.
(I can vouch for it, they never learn cartography in Form 2/Form3)
But never mind, we can do cartography of whole world map using Gnuplot. All you need to have is Linux Ubuntu, Gnuplot software (available for free thru Ubuntu Software Center) plus the extra edited data files which I am going to share in some links later.

By the way, GNUPlot is one of the  free mathematical plotting software used by scientist and engineers in Linux environment to plot out the statistical graph. Heck, even one of my friends plotted performances evaluation between TCP Reno/ TCP Vegas/TCP Tahoe using GNUPlot in his FYP and the results is coming out nice. It is not very wide known that you can plot world map in 3D using Gnuplot.

So I share with you steps by steps of the plotting cartography:

1. Install Gnuplot    
(This steps is no brainer if you uses Ubuntu. For other Distro, sorry you are on your own)
P.S: See the manual guide for more informations on how to install for other Linux distro
2.Open up your terminal and type "gnuplot"
You should seen the followings


3. Okay now import the world.cor / world.dat / srl.dat into your Linux desktop
For more explainations on what the functions of data files, refer to the link 

world.cor- Plotting the sites locations with X symbols
world.dat- Plotting the rudimentary coast line of the world
srl.dat-      Plot the name of the sites

4. Copy and paste the followings to the GNUPlot terminal

#--------------------------------------------------------------
#NOTE: Replace "user" with your created user name of Ubuntu
#--------------------------------------------------------------
#set terminal png transparent nocrop enhanced font arial 8 size 420,320
#set output '/home/user/Desktop/worldoutput.png'
#--------------------------------------------------------------
#This work is license free, you make tweak it to do what ever stuffs that you wanted to do

#set variable for latitude and longitude
set dummy u,v

set angles degrees

#set legend off
set key off

#set the default angle view and size of globe
set parametric
set view 60, 40, 1.2, 1.25

#set the meshgrids, the higher the value, the more mesh grids appears
set samples 32, 32
set isosamples 15, 15

#set the map plot
set mapping spherical
set yzeroaxis linetype 0 linewidth 1.000
set ticslevel 0
set title "World Map in 3D using GNUPlot"

#set the min/max range of the longitude and latitude
set urange [ -90.0000 : 90.0000 ] noreverse nowriteback
set vrange [ 0.00000 : 360.000 ] noreverse nowriteback

#Plotting consists of 3 parts
#Part 1:Plot the coast line from world.dat files
#Part 2:Plot the coordinate of place use symbol x from world.cor
#Part 3:Plot the name of place using specific fonts

splot cos(u)*cos(v),cos(u)*sin(v),sin(u) with lines lt 5 ,'/home/user/Desktop/world.dat' with lines lt 2 , '/home/user/Desktop/world.cor' with points lt 1 pt 2 , '/home/user/Desktop/srl.dat' using 3:2:(1):1:4 with labels notitle point pt 6 lw .1 font "Helvetica,10"  lt -1

##############################

5.If successfully plotted, you will be able to see the followings almost nicely plotted maps

6.Voila ! Success.

You sir/madam had successfully done what is previously deemed impossible.

1 comment:

Xu Whai Tuck said...

World.cor Link -

http://zeushammer.blogspot.com/2011/06/worldcor.html

Srl.dat Link -

http://zeushammer.blogspot.com/2011/06/srldat.html

World.dat Link -

http://zeushammer.blogspot.com/2011/06/worlddat.html

Another random post to read ? Come !

Related Posts with Thumbnails