[GIS] How to single out country data from a world data map

areagrassintersectionpythonr

Say that i have two "data sources";

  1. A global map of average wind speeds,
  2. A shape file (or similar information) of all country borders in the world.

How do i combine these two sources and extract the average wind speeds of a country?

The wind speed data is structured such that each lat-lon combination has an average wind speed:

Lat, Lon, AvgSpeed
-90, -180, 4.54
-90, -179, 4.55
-90, -178, 4.57
...

The output should be somewhat similar to the input, but with "an extra column" for country:

Lat, Lon, AvgSpeed, Country
-90, -180, 4.54, Country 1
-90, -179, 4.55, Country 1
-90, -178, 4.57, Country 2
...

I have Grass GIS, R and Python installed – but your answer need not be restricted to these software packages/programming languages.

Best Answer

You first need to import the CSV file with v.in.ascii to create a vector points map. Add a new column "Country" of varchar(25) with v.db.addcol. Then simply populate the new column with v.what.vect (see also example in that manual page).

Related Question