<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.organicdatascience.org/gleonfellowship/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ianm</id>
		<title>Gleon Fellowship - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.organicdatascience.org/gleonfellowship/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ianm"/>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php/Special:Contributions/Ianm"/>
		<updated>2026-04-05T23:45:18Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=518</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=518"/>
				<updated>2015-01-21T04:23:28Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Set PropertyValue: TargetDate = 2015-01-20&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Update working directory&lt;br /&gt;
&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Load raster package (may have to install first)&lt;br /&gt;
&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Make list of asci files in already specified working directory&lt;br /&gt;
&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Check number of files in raster list&lt;br /&gt;
&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Crete stack of rasters in list&lt;br /&gt;
&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
&lt;br /&gt;
library(maptools)&lt;br /&gt;
&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (point data)&lt;br /&gt;
&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (zonal polygon data)&lt;br /&gt;
&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Progress=100|&lt;br /&gt;
	StartDate=2015-01-20|&lt;br /&gt;
	TargetDate=2015-01-20|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=517</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=517"/>
				<updated>2015-01-21T04:23:15Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Set PropertyValue: StartDate = 2015-01-20&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Update working directory&lt;br /&gt;
&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Load raster package (may have to install first)&lt;br /&gt;
&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Make list of asci files in already specified working directory&lt;br /&gt;
&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Check number of files in raster list&lt;br /&gt;
&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Crete stack of rasters in list&lt;br /&gt;
&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
&lt;br /&gt;
library(maptools)&lt;br /&gt;
&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (point data)&lt;br /&gt;
&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (zonal polygon data)&lt;br /&gt;
&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Progress=100|&lt;br /&gt;
	StartDate=2015-01-20|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=516</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=516"/>
				<updated>2015-01-21T04:23:10Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Set PropertyValue: Progress = 100&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Update working directory&lt;br /&gt;
&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Load raster package (may have to install first)&lt;br /&gt;
&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Make list of asci files in already specified working directory&lt;br /&gt;
&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Check number of files in raster list&lt;br /&gt;
&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Crete stack of rasters in list&lt;br /&gt;
&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
&lt;br /&gt;
library(maptools)&lt;br /&gt;
&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (point data)&lt;br /&gt;
&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (zonal polygon data)&lt;br /&gt;
&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Progress=100|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=515</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=515"/>
				<updated>2015-01-21T04:22:55Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Update working directory&lt;br /&gt;
&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Load raster package (may have to install first)&lt;br /&gt;
&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Make list of asci files in already specified working directory&lt;br /&gt;
&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Check number of files in raster list&lt;br /&gt;
&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Crete stack of rasters in list&lt;br /&gt;
&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
&lt;br /&gt;
library(maptools)&lt;br /&gt;
&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (point data)&lt;br /&gt;
&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (zonal polygon data)&lt;br /&gt;
&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=514</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=514"/>
				<updated>2015-01-21T04:22:28Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Update working directory&lt;br /&gt;
&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Load raster package (may have to install first)&lt;br /&gt;
&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Make list of asci files in already specified working directory&lt;br /&gt;
&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Check number of files in raster list&lt;br /&gt;
&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Crete stack of rasters in list&lt;br /&gt;
&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
&lt;br /&gt;
library(maptools)&lt;br /&gt;
&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (point data)&lt;br /&gt;
&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (zonal polygon data)&lt;br /&gt;
&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=513</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=513"/>
				<updated>2015-01-21T04:21:47Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Update working directory&lt;br /&gt;
&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Load raster package (may have to install first)&lt;br /&gt;
&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Make list of asci files in already specified working directory&lt;br /&gt;
&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Check number of files in raster list&lt;br /&gt;
&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Crete stack of rasters in list&lt;br /&gt;
&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
&lt;br /&gt;
library(maptools)&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (point data)&lt;br /&gt;
&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Output csv file (zonal polygon data)&lt;br /&gt;
&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=512</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=512"/>
				<updated>2015-01-21T04:20:37Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Update working directory&lt;br /&gt;
&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Load raster package (may have to install first)&lt;br /&gt;
&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
# Make list of asci files in already specified working directory&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
# Check number of files in raster list&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
# Crete stack of rasters in list&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
# Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
library(maptools) # (may have to install)&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
# Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (point data)&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (zonal polygon data)&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=511</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=511"/>
				<updated>2015-01-21T04:19:46Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Update working directory&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Load raster package (may have to install first)&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
# Make list of asci files in already specified working directory&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
# Check number of files in raster list&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
# Crete stack of rasters in list&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
# Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
library(maptools) # (may have to install)&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
# Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (point data)&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (zonal polygon data)&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=510</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=510"/>
				<updated>2015-01-21T04:19:17Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;#&amp;lt;/nowiki&amp;gt; Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
# Update working directory&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Load raster package (may have to install first)&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
# Make list of asci files in already specified working directory&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
# Check number of files in raster list&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
# Crete stack of rasters in list&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
# Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
library(maptools) # (may have to install)&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
# Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (point data)&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (zonal polygon data)&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=509</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=509"/>
				<updated>2015-01-21T04:18:31Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
# Update working directory&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Load raster package (may have to install first)&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
# Make list of asci files in already specified working directory&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
# Check number of files in raster list&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
# Crete stack of rasters in list&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
# Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
library(maptools) # (may have to install)&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
# Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (point data)&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (zonal polygon data)&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=508</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=508"/>
				<updated>2015-01-21T04:17:48Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;# Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
# Update working directory&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Load raster package (may have to install first)&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
# Make list of asci files in already specified working directory&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
# Check number of files in raster list&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
# Crete stack of rasters in list&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
# Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
library(maptools) # (may have to install)&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
# Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (point data)&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (zonal polygon data)&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=507</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=507"/>
				<updated>2015-01-21T04:16:55Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
# Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
# Update working directory&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Load raster package (may have to install first)&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
# Make list of asci files in already specified working directory&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
# Check number of files in raster list&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
# Crete stack of rasters in list&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
# Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
library(maptools) # (may have to install)&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
# Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (point data)&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (zonal polygon data)&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=506</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=506"/>
				<updated>2015-01-21T04:15:30Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
# Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
# Update working directory&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Load raster package (may have to install first)&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
# Make list of asci files in already specified working directory&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
# Check number of files in raster list&lt;br /&gt;
length = length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
# Crete stack of rasters in list&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
# Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
library(maptools) # (may have to install)&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
# Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (point data)&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (zonal polygon data)&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=505</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=505"/>
				<updated>2015-01-21T04:14:26Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Premise'''&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
Use of zonal statistics is widely applicable across disciplines that utilize spatial datasets.&lt;br /&gt;
&lt;br /&gt;
'''What You'll Need'''&lt;br /&gt;
The approach shown here uses the mpatools and raster libraries in R&lt;br /&gt;
http://cran.r-project.org/web/packages/maptools/maptools.pdf&lt;br /&gt;
http://cran.r-project.org/web/packages/raster/raster.pdf&lt;br /&gt;
&lt;br /&gt;
'''Example Code'''&lt;br /&gt;
&lt;br /&gt;
This is a code that you could adapt for your own purposes; hopefully it is enough to guide you. You'll obviously need to designate your own directories and name your own files. Also, this code contains lines for polygons and points; you may very well want one or the other. The list function might be confusing. I used pattern-matching to pick out only March precipitation grids from my directory (which contained grids for all months). The pattern=&amp;quot;mar.asc$&amp;quot; tells R to pick out files with a specific type of name, in this case ascii grids for March. &lt;br /&gt;
&lt;br /&gt;
This example extracts March precipitation data for a set of study plots in the Tehachapi Mountains, CA. The outputs are csv files written to a user-specified directory.&lt;br /&gt;
&lt;br /&gt;
# Import a shapefile to R and use it to extract zonal statistics from a directory of rasters&lt;br /&gt;
&lt;br /&gt;
# Update working directory&lt;br /&gt;
setwd(&amp;quot;H:/Ian_GIS/Climate/precip/Tejon/Historic&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Load raster package (may have to install first)&lt;br /&gt;
library(raster)&lt;br /&gt;
&lt;br /&gt;
# Make list of asci files in already specified working directory&lt;br /&gt;
Clim_list = list.files(pattern = &amp;quot;mar.asc$&amp;quot;) # &amp;quot;mar.asc$&amp;quot; queries files in directory ending in this pattern&lt;br /&gt;
&lt;br /&gt;
# Check number of files in raster list&lt;br /&gt;
length=length(Clim_list) &lt;br /&gt;
&lt;br /&gt;
# Crete stack of rasters in list&lt;br /&gt;
Clim_stack = stack(Clim_list)&lt;br /&gt;
&lt;br /&gt;
# Create spatial dataset from shapefile (use points, polygons or lines)&lt;br /&gt;
library(maptools) # (may have to install)&lt;br /&gt;
points = readShapePoints(&amp;quot;H:/Ian_GIS/Tejon_data/TejonPlots/TejonPoints&amp;quot;)&lt;br /&gt;
studyarea = readShapePoly(&amp;quot;H:/Ian_GIS/Tejon_data/FullStudyArea/Tejon_study_area&amp;quot;,IDvar=&amp;quot;ID&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Extract raster pixels from point dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  ex = extract(Clim_stack,points,method='simple',layer=1,nl=length, df=T)&lt;br /&gt;
  ex$ID = NULL}&lt;br /&gt;
&lt;br /&gt;
# Extract study area mean from polygon dataset&lt;br /&gt;
for(j in 1:length) { &lt;br /&gt;
  bus = extract(Clim_stack,studyarea, fun=mean, layer=1, nl=length, df=T, na.rm=T)&lt;br /&gt;
  bus$ID = NULL}&lt;br /&gt;
bus = t(bus)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (point data)&lt;br /&gt;
write.csv(ex, &amp;quot;H:/Ian_GIS/Tejon/TejonPlots/Mar_precip_pts.csv&amp;quot;, row.names=plots$Id, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# Output csv file (zonal polygon data)&lt;br /&gt;
write.csv(bus, &amp;quot;H:/Ian_GIS/Tejon/FullStudyArea/Mar_precip_SA.csv&amp;quot;, na=&amp;quot;NA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=504</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=504"/>
				<updated>2015-01-21T04:03:08Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Premise'''&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R.The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&lt;br /&gt;
'''Zonal Statistics'''&lt;br /&gt;
Let's say you have a series of annual precipitation grids for a given site. Within this site you have a set of study plots and you want to extract precipitation values from each grid for each of your study plots. This is great application of zonal statistics. If you plots are points, zonal statistics will simply extract precipitation values for the location of each point. If your plots are lines or polygons, zonal statistics can be used to calculate the mean (or some other statistic) precipitation for each plot.&lt;br /&gt;
&lt;br /&gt;
'''Skill Relevance and Usefulness'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=503</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=503"/>
				<updated>2015-01-21T03:59:21Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
'''Premise'''&lt;br /&gt;
A surprising number of people is unaware that you can use GIS shapefiles in R&lt;br /&gt;
&lt;br /&gt;
The maptools library imports .shp points, lines and polygons&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=502</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=502"/>
				<updated>2015-01-21T03:56:06Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Added PropertyValue: Expertise = GIS&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=GIS|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=501</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=501"/>
				<updated>2015-01-21T03:56:04Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Added PropertyValue: Expertise = raster&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=Raster|&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=500</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=500"/>
				<updated>2015-01-21T03:55:59Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Added PropertyValue: Expertise = r programming&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=R_programming|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=499</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=499"/>
				<updated>2015-01-21T03:55:56Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Deleted PropertyValue: Expertise = r&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=498</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=498"/>
				<updated>2015-01-21T03:55:53Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Added PropertyValue: Expertise = r&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Expertise=R|&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=497</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=497"/>
				<updated>2015-01-21T03:55:19Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Set PropertyValue: Owner = Ian McCullough&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Owner=Ian_McCullough|&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=496</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=496"/>
				<updated>2015-01-21T03:55:09Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Added PropertyValue: Participants = Ian McCullough&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Participants=Ian_McCullough|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=495</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=495"/>
				<updated>2015-01-21T03:54:57Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Set PropertyValue: Type = low&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:|&lt;br /&gt;
	Type=Low}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=493</id>
		<title>Zonal Statistics or Extracting Raster Data</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Zonal_Statistics_or_Extracting_Raster_Data&amp;diff=493"/>
				<updated>2015-01-21T03:54:26Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Creating new page with Category: Task&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	<entry>
		<id>https://www.organicdatascience.org/gleonfellowship/index.php?title=Skills_Sharing_Activity&amp;diff=494</id>
		<title>Skills Sharing Activity</title>
		<link rel="alternate" type="text/html" href="https://www.organicdatascience.org/gleonfellowship/index.php?title=Skills_Sharing_Activity&amp;diff=494"/>
				<updated>2015-01-21T03:54:26Z</updated>
		
		<summary type="html">&lt;p&gt;Ianm: Added PropertyValue: SubTask = Zonal Statistics or Extracting Raster Data&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Task]]&lt;br /&gt;
&lt;br /&gt;
==Introduction to R coding==&lt;br /&gt;
&lt;br /&gt;
The first workshop began with an R Skills Sharing activity. All fellows presented on their chosen skill. &lt;br /&gt;
&lt;br /&gt;
The general instructions were: &lt;br /&gt;
Identify a skill, tool technique you currently do not know how to implement, and learn how to carry it out. Explain the skill’s relevance to you (why did you choose it?) and  to others (how can others use it?), and visualize results in a plot, if appropriate. Overall, you should aim to stretch a bit outside of your current knowledge ‘comfort zone’.&lt;br /&gt;
&lt;br /&gt;
The presentations are included here. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Add any wiki Text above this Line --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Do NOT Edit below this Line --&amp;gt;&lt;br /&gt;
{{#set:&lt;br /&gt;
	Owner=Hilary|&lt;br /&gt;
	StartDate=2015-01-12|&lt;br /&gt;
	SubTask=Zonal_Statistics_or_Extracting_Raster_Data|&lt;br /&gt;
	SubTask=Batch_Files_-_Hilary_Dugan|&lt;br /&gt;
	SubTask=Importing_Google_Maps_to_Plot_Data-_Kait_Farrell|&lt;br /&gt;
	SubTask=Filling_Time-Series_Data_Gaps_-_Derek_Roberts|&lt;br /&gt;
	SubTask=Creating_Maps_and_Assessing_Spatial_Autocorrelation|&lt;br /&gt;
	TargetDate=2015-01-23|&lt;br /&gt;
	Type=Medium}}&lt;/div&gt;</summary>
		<author><name>Ianm</name></author>	</entry>

	</feed>