Country Data Processing

From GRASS-Wiki
Jump to navigation Jump to search

This tutorial describes how to

  • find free data of country on Internet
  • create new GRASS location
  • import found data into GRASS
  • create new vector layers from existing data
  • create labels
  • display map of a country

GRASS Installation

Required elements

Create directory structure required for this tutorial

  • dataset directory
  $ mkdir ~/grass
  • input data directory
  $ mkdir ~/grass/indata

Create GRASS location using SPEARFISH data to be able create new locations

  $ cd ~/grass
  $ tar zxf spearfish_grass60data-0.3.tar.gz

Start GRASS

  $ grass -text spearfish60/PERMANENT

Obtaining Data

We assume that one wants to create UK map. Following steps can be easily applied to other countries' data.

Country related GIS data can be obtained from Digital Chart of the World.

First create country related input directory

  $ mkdir ~/grass/indata/uk

Let's download UK data

  • go to Digital Chart of the World
  • click Europe link
  • choose United Kingdom in select box on the right and click Continue
  • page _Digital Chart of the World Layer Interface for United Kingdom_ will be displayed
  • click Download Data button
  • another page will be shown, mark checkboxes
    • Populated Places (Polygon)
    • Roads (Line)
    • Rail Roads (Line)
  • click Continue
  • on new page click Compute Data
  • on new page you will be able to obtain set of data (<NUMBER> is part of filename with data exported by DCW)
  <NUMBER>.tar.Z
  • do not hesistate to download data into ~/grass/indata/uk directory

Importing Data

Importing data into GRASS is two fold step

  • create new location with one piece of data
  • import remaining data

Creating New Location

One can create new location using another location. We will use SPEARFISH location to create UK location.

Start GRASS

  $ cd ~/grass
  $ grass62 -text spearfish60/PERMANENT (you need grass 6.2.x for this to work)

Enter UK input data directory and unpack downloaded data from DCW

  $ cd indata/uk
  $ tar zxf <NUMBER>.tar.Z

You will have several files

ponet.e00
country borders
pppoly.e00
populated places
rdline.e00
road network
rrline.e00
rail road network

We will create UK GRASS location using country borders. In SPEARFISH GRASS session use following commands to create location uk and layer borders

  $ cd ~/grass
  $ v.in.ogr dsn=indata/uk/ponet.e00 layer=ARC output=borders location=uk

New location is created. Exit SPEARFISH GRASS session and start GRASS UK session

  $ cd ~/grass
  $ grass62 -text uk/PERMANENT

You can display UK borders

  $ g.region vect=borders    # set region to display
  $ d.mon x0                 # create GRASS monitor
  $ d.vect map=borders       # display borders

Importing Rest of the Data

Having GRASS UK location we can import rest of the data (population places, road and rail networks)

  $ cd ~/grass
  $ grass -text uk/PERMANENT
  $ v.in.ogr dsn=indata/uk/pppoly.e00 layer=ARC output=pcities
  $ v.in.ogr dsn=indata/uk/rdline.e00 layer=ARC output=roads
  $ v.in.ogr dsn=indata/uk/rrline.e00 layer=ARC output=rails

Display data

  $ d.mon x0
  $ g.region vect=borders
  $ d.vect map=borders color=black width=1.2
  $ d.vect map=roads   color=grey           
  $ d.vect map=pcities color=brown

or save it to PNG file uk.png

  $ GRASS_WIDTH=1024 GRASS_HEIGHT=1024 GRASS_PNGFILE=uk.png d.mon start=PNG
  $ d.mon select=PNG
  $ d.vect map=borders color=black width=1.2                             
  $ d.vect map=roads   color=grey                                        
  $ d.vect map=pcities color=brown                                       
  $ d.mon stop=PNG