Extracting Raster Values from Points in R and GRASS

A common task in GIS analysis is to extract the value of a remotely sensed environmental variable at a point location. For instance we may wish to extract the elevation of a field plot from a digital elevation model. The elevation data is a raster (i.e. grid) and the plots are a point shapefile (or a simple text file of X, Y locations). The command for doing this in ArcGIS is ExtractValuesToPoints available in the Spatial Analyst package. Situations may arise where ArcGIS is not the most efficient way of extracting these values. So, here, I provide a brief overview of how to extract raster values to points in R and GRASS.

Extract Values to Points in R

This is strikingly easy is R. My work usually requires more statistical sophistication than is available in ArcGIS. As a result, I have completely switched to doing the extraction in R. I known I am going to end in R eventually, and it is easier to automate than writing a long python script in ArcGIS.

Data required

For the purpose of this exercise. All the data must be have the same spatial projection.

an ESRI ASCII grid. This could also be an ArcGIS binary grid if you know how to use RGDAL. That perhaps will be another post.
a point shapefile.

You also need the maptools and sp packages.

The Code

That is it. Fast, and easy.

Extracting Values in GRASS

Extracting raster values in GRASS is somewhat faster than in R, but it takes a little bit more planning in that you have to explicitly create the column that the raster values will go into.

Data Required

  • gr : A GRASS grid
  • pt : A GRASS point dataset

The Code

The basic flow of this is that you create an empty column in the point dataset with the right data type (i.e. varchar(10) string of length 10, double precision floating point numbers, int integers). Then, fill the column with the raster values.

Labels: , ,


Blogger Lori said...

Can this be done with multiple ASCIIs at the same time? I want to extract WorldClim variables to species presence points.

June 22, 2011 at 12:35 PM  
Blogger Ashis said...

Dear Todd,
Thanks for the nice posting.

I modified your solution according to my need(skipped the grass part and make workable for multiple raster files) and posted my solution in http://gis-techniques.blogspot.com/2012/10/extract-raster-values-from-points.html.

October 11, 2012 at 6:01 PM  
Blogger Sourav Tiwari said...

Thanks for the Great Information in the post


February 6, 2016 at 1:13 AM  
Blogger Govtapply said...

Latest Govtapply Jobs 2016

Thanks to sharing this nice information i really appreciate your thinking.......

February 15, 2016 at 4:23 AM  
Blogger Nitish Lakhera said...


February 22, 2016 at 7:15 AM  
Blogger raphael said...

Wow amazing i saw this article with execution models you had posted. It was such informative. Really its a wonderful article. Thank you for sharing.

digital marketing training Chennai

February 26, 2016 at 12:23 AM  
Blogger henris said...

Thank you for posting it will be helpful by knowing more about GDAL. Thank you and please keep update like this with this site. Definitely it will be useful for all.

SQL DBA Training in Chennai

March 4, 2016 at 4:03 AM  
Blogger Konnie said...

Hi. When I run the R code with m data I'm getting following error message:

Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘overlay’ for signature ‘"SpatialGridDataFrame", "SpatialPointsDataFrame"’.

Any ideas why? regards, Konnie

March 18, 2016 at 9:06 PM  
Blogger Ridhima said...

Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up.

SEO training in Adyar

April 2, 2016 at 11:07 AM  
Blogger Dianne Wiest said...

It's nice blog I have really enjoyed keeping up with you on this blog.This is very useful post for everyone. Thank you so much this post.

Washington dc dog training

April 7, 2016 at 1:01 AM  
Blogger pankaj karnwal said...

Nice article thanks for sharing with us.
ap 12th result 2016

April 19, 2016 at 7:15 AM  
Blogger pankaj karnwal said...

Nice article thanks for sharing with us.
telangana intermediate result 2016

April 20, 2016 at 3:15 AM  
Blogger subrata das said...

good morning images
good night images
rrb result 2016
whatsapp status
irctc online ticket booking
tatkal ticket booking
best 10 exam result website

May 26, 2016 at 1:56 PM  
Blogger Souvik Das said...


June 1, 2016 at 5:46 PM  
Blogger Training Coimbatore said...

great post

Hadoop training in coimbatore
Java training in coimbatore
Oracle training in coimbatore
Informatica training in coimbatore
Oracle training in coimbatore
Informatica training in coimbatore

June 22, 2016 at 11:26 AM  
Blogger pankaj karnwal said...

Nice article thanks for sharing with us.
ugc net answer key

July 10, 2016 at 3:25 AM  
Blogger pankaj karnwal said...

Nice article thanks for sharing with us.
ctet application form
ctet exam date
ctet notification
ctet admit card
ctet result
ctet online form
ctet answer key
ctet answer key

July 17, 2016 at 5:04 AM  
Blogger Tony Starck said...

This comment has been removed by the author.

August 14, 2016 at 10:13 AM  
Blogger Koushik Mishra said...



megashare movie

September 7, 2016 at 5:47 AM  
Blogger Ashu Sharma said...

CTET Result 2016 will be going to be publishes soon by Central Board of Secondary Education. Download CTET Result 2016 as soon as possible once declared out.

November 4, 2016 at 5:43 AM  
Blogger Kate said...

This comment has been removed by the author.

November 21, 2016 at 6:03 AM  
Blogger Narendra Modi said...

Recruitment Notification is one of the Top most Job Portal Govt jobs in AP 2017 there

November 25, 2016 at 12:56 AM  
Blogger juju said...

Sarkari Recruitment is one of the biggest Indian Job Site so here you will getLatest Govt Jobs 2017so

December 29, 2016 at 6:57 AM  
Blogger Akhila Mouli said...

Sarkari Recruitment is one of the biggest Indian Job Site so here you will getKPSC Jobs 2017so

January 7, 2017 at 4:31 AM  
Blogger Akhila Mouli said...

Sarkari Recruitment is one of the biggest Indian Job Site so here you will getKPSC Jobs 2017so

January 7, 2017 at 4:31 AM  
Blogger Sofiya G said...

I enjoyed over read your blog post. Your blog have nice information , I got good idas from this amazing blog .I am always searching like this type blog post. I hope I will see again...
KSEEB Board 12th result publish in puc result - http://puc-results.in/ , puc result 2017 - http://pucresult.co.in/ , pue.kar.nic.in - http://pue-kar-nic.in/

February 20, 2017 at 12:43 PM  
Blogger Sofiya G said...

This is nice and amazing information. Thanks for sharing keep it up.

KSEEB announce Karnataka 10th result 2017 on sslc result 2017 karnataka - http://karnatakasslcresults.in/
CBSE Board relese 10th and 12th cbse results on cbse 10th result - http://cbse10thresult2017nic.com/

February 20, 2017 at 12:49 PM  
Blogger Sofiya G said...

Kerala, Karnataka and Tamilnadu 10th result named as sslc result, that here you can find it. - https://sslc-result-nic.in/
Kerala Board 10th examination result notifications here at sslc result 2017 kerala - http://keralasslcresult2017.in/

TN Board release 10th result here on sslc result 2017 tamilnadu - http://tn-sslcresult.in/
Maharashtra Board publishing 10th result and 12th here ssc result 2017 maharashtra - http://mahsscresult.in/

February 20, 2017 at 12:51 PM  
Blogger Sofiya G said...

All Indian SSC(10th) Results publishing here ssc result 2017 - http://ssc-result-nic.in/ and all HSC(12th) publishing here hsc result 2017 - http://hsc-result-nic.in/ also all inermediate results here intermediate result 2017 - http://intermediate-result.in/

Indian Super League and knock out tournament Live fixtures, time table and results Isl 2017 standings - http://isl2017.in/

February 20, 2017 at 12:51 PM  
Blogger Unknown said...

AP Exam Results is the best Ap Inter 2nd year results 2017

March 5, 2017 at 11:50 PM  
Blogger sravan rao said...

Here you can get the complete information about Life Insurance policies. For more click here
Life Insurance

March 28, 2017 at 1:15 AM  
Blogger sravan rao said...

Click here to Get airtel digital TV monthly packs and enjoy your favorite tv channels.
airtel dth

March 28, 2017 at 8:23 AM  
Blogger sravan rao said...

IBPS RRB notification released. Get the latest details about IBPS RRB Clerk Jobs 2017.
IBPS RRB Clerk Jobs 2017

April 5, 2017 at 11:46 PM  
Blogger sravan rao said...

Here you can get the Union Public Service Commission (UPSC) latest recruitment notification and current examination details. For more click here
UPSC Recruitment

April 6, 2017 at 12:17 AM  
Blogger sravan rao said...

Here you can get the SBI PO Previous Papers with solved answers. For more click below link
Download here

April 6, 2017 at 12:51 AM  
Blogger sravan rao said...

Candidates can view the ISI Entrance Exam Result through this site.
ISI Result

April 6, 2017 at 1:28 AM  
Blogger sravan rao said...

Click here to get all the information regarding SSC CGL Notification 2017, Rcruitment, exam dates, exam results, score card.
SSC CGL Jobs 2017

April 6, 2017 at 2:12 AM  
Blogger sravan rao said...

JEE Mains paper1& paper2 Result details are available. To get the more information click on the below link.
JEE Mains Paper 2 Result

April 6, 2017 at 2:19 AM  
Blogger sravan rao said...

Click here for more information about current silver price in chennai.
silver price in chennai

April 7, 2017 at 3:18 AM  
Blogger sravan rao said...

Apple TV is one of the great and best devices for media consumptions. Here all details regarding Kodi installation on apple Tv are provided. Click here
Kodi Apple TV

April 8, 2017 at 5:38 AM  
Blogger sravan rao said...

Get information about Passport Police Verification Process And Status Pre-Police Verification.
Go here

April 13, 2017 at 3:50 AM  
Blogger bashar ahmed said...

SSC result 2017
SSC result 2017

April 13, 2017 at 4:33 AM  
Blogger hello iletsfly said...

There will ge going to releases out Telangana Jr Inter Results 2017 on April 17th for the current session. Check out TS Jr Inter Result 2017 from here also.

April 14, 2017 at 5:35 AM  
Blogger OnlineGovernmentJobs said...

On April 17th, 2017 there will be announces TS Junior Intermediate Result 2017. Students can check and download TS Junior Intermediate Result 2017 here also.

April 14, 2017 at 9:53 AM  
Blogger sravan rao said...

LIC Online Term Insurance Plan Premium Calculator Provide Premium details chart & Feature Benefits of LIC Term Insurance Policy.
lic e term insurance plan

April 19, 2017 at 3:56 AM  
Blogger sravan rao said...

Get all the information regarding the Equated Monthly Installment. Also check EMI features, benefits,a nd payment options.
what is emi

April 20, 2017 at 7:40 AM  
Blogger nikky said...

KSEEB Board is going to declare Karnataka SSLC Result today. Students can check the results at official website of karresults.nic.in.

April 25, 2017 at 6:34 AM  
Blogger nikky said...

TN Board is going to declare Tamilnadu SSLC Result today. Students can check the results at official website of tnresults.nic.in.

May 12, 2017 at 12:53 AM  
Blogger amrutha said...

Are you searching for best 4k television? Here is it

May 16, 2017 at 6:29 AM  
Blogger amrutha said...

CBSE Results is going to declare soon on cbseresults.nic.in and cbseresults-co.in
cbse result
cbse results 2017
cbse 10th result 2017
cbse 12th results 2017

May 17, 2017 at 2:10 AM  
Blogger sri harsha said...

TS DSC 2017
Telangana DSC 2017
TS DSC Notification 2017
TS DSC Model Papers 2017
Sakshi TS DSC Model Papers 2017
Namasthe Telangana TS DSC Model Papers 2017
TS DSC District wise Vacancies list 2017

June 4, 2017 at 10:56 AM  
Blogger sri harsha said...

Telangana DSC Recruitment 2017 Notification is announced in last week of December with District wise Vacancies lists TS DSC 2017 , Telangana DSC 2017, TS DSC Notification 2017, TS DSC Model Papers 2017, Sakshi TS DSC Model Papers 2017, Namasthe Telangana TS DSC Model Papers 2017, TS DSC District wise Vacancies list 2017 Government Primary and Secondary Schools for Secondary Grade Teacher (SGT),Language Pandit (LP),School Assistant(SA)and Physical Education Teacher (PET) Posts with the TS DSC 2017.

June 26, 2017 at 1:44 PM  
Blogger Philips Huges said...

Its very useful to me. Wonderful blog.. Thanks for sharing informative Post.

Installment loans
Payday loans
Title loans

June 28, 2017 at 2:04 PM  
Blogger sravan rao said...

Latest price list of Fully Automatic Washing Machines in India. Compare Fully Automatic Washing Machine price list and buy online at lowest price.
Fully Automatic Washing Machine

July 15, 2017 at 3:44 AM  
Blogger sravan rao said...

Check the full list of Whirlpool refrigerators / fridges in India. Compare prices and buy the best refrigerator for your home
Know more

July 17, 2017 at 1:04 AM  
Blogger sravan rao said...

List of latest, upcoming lg TV price list in India, lg TV models, specifications and features.
lg tv price

July 18, 2017 at 12:37 AM  
Blogger Isabella Olivia said...

This information is impressive; I am inspired with your post writing style & how continuously you describe this topic.

Pawn Shop

Pawn Loans

Pawn Shops

Pawn Loan

Pawn Shop near me

August 30, 2017 at 2:37 PM  
Blogger Unknown said...

Direct Link to fill the application form of DRDO Recruitment 2017

Apply Online Punjab and Haryana High Court Clerk Recruitment 2017

September 5, 2017 at 8:24 AM  
Blogger govtjobs adda said...

Thank you for sharing.Click here to get the details about govt jobs after diploma

September 6, 2017 at 6:49 AM  
Blogger employment updates said...

Nice webpage. Click here for latest govt jobs

September 7, 2017 at 7:04 AM  
Blogger kingrani said...

Flipkart offers on Televisions
Flipkart Discount offers on Kitchen Appliances

September 26, 2017 at 5:59 AM  
Blogger ISL 2017 Football Followers Fan said...

This one is really an interesting article. You really did a great decision. Never Give Up on your goals bro. Keep Rocking. Have a great day. Here is the link-

ISL is one of the top football leagues in India

Indian Super League ISL 2017 Schedule, Squads, Fixtures

Watch ISL 2017 Live Streaming online in HD | TV Telecast Free

{*Top*} Atlético de Kolkata| Indian Super League ISL 2017

ISL Final Result| Indian Super League Football Goals Videos

October 20, 2017 at 10:43 AM  
Blogger rahil khan said...

You can get the all latest JNTU updates at here

November 3, 2017 at 7:28 AM  
Blogger Aryan Arps said...

Nice Information. Thanks for sharing such a nice information.
Nice Information. Thanks for sharing such a nice information.

December 2, 2017 at 1:49 AM  
Blogger David Smith said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.

December 7, 2017 at 11:48 PM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home