### Sidebar

spatial-ecology.org

Trainings:

Learn:

Data:

Community:
teachers
students
projects
Matera 2015
Vancouver 2015
Santa Barbara 2015
Site design
Hands on:
Installations

Donations
USD

GBP

wiki:exercise2

# Exercise 2a: Extract Landsat profiles from vector

In this exercise, the following tools will be used:

• pktools: pkextract and pkogrstat
• awk (basic)

Create a directory for this exercise:

`mkdir -p \${OUTPUTDIR}/exercise2`

Extract Landsat profiles from forest in Cornwall (mean value for each polygon)

`pkextract -i \${LANDSATDIR}/\${LANDSATIMG} -s \${OUTPUTDIR}/exercise1/cornwall_forest_3035.shp -o \${OUTPUTDIR}/exercise2/forest_landsat.shp -r mean -polygon`

Calculate statistics using pkstatogr

`pkstatogr -i \${OUTPUTDIR}/exercise2/forest_landsat.shp -n B0 -n B1 -n B2 -n B3 -n B4 -n B5 -n B6 -n B7 -mean -stdev| awk '{print \$4,\$6}' > \${OUTPUTDIR}/exercise2/forest_landsat_mean_stdev.txt`

Extract Landsat profiles from water in Cornwall (mean value for each polygon)

`pkextract -i \${LANDSATDIR}/\${LANDSATIMG} -s \${OUTPUTDIR}/exercise1/cornwall_water_3035.shp -o \${OUTPUTDIR}/exercise2/water_landsat.shp -r mean -polygon`

Calculate statistics using pkstatogr

`pkstatogr -i \${OUTPUTDIR}/exercise2/water_landsat.shp -n B0 -n B1 -n B2 -n B3 -n B4 -n B5 -n B6 -n B7 -mean -stdev| awk '{print \$4,\$6}' > \${OUTPUTDIR}/exercise2/water_landsat_mean_stdev.txt`