Oft-gensyssample.bash

From Open Foris Wiki

Jump to: navigation, search

This script generates a systematic sample of points over an image or shapefile, with several clustering schemes and user-defined spacing between clusters and plots. Output is a text file with the coordinates of the cluster centre points and the plot points.

Usage: oft-gensyssample.bash <layer> <Dx> <Dy> [scheme] [plots] [dxy] [h]

Where:
<layer> is an input raster or vector layer from which the bounding box of the area will be extracted
<DX> between cluster distance in X direction
<DY> between cluster distance in Y direction
[scheme] clustering scheme. The following schemes are implemented: 
    1 = line in Y direction
    2 = line in X direction
    3 = L shaped
    4 = inverse L shaped
    6 = a square 
[plots] number of plots
[dxy]    distance between the plots
[h]      print header (1) or not (0)

If the optional arguments are not given, oft-gensyssample.bash just creates a systematic grid of points. The cluster centre point is always the northwestern point of the cluster. The script starts generating cluster centre points from the most northwestern point of the bounding box of the input raster or vector layer. For complex geometries, points might therefore also be generated outside the area of interest.


Example:

cd /home/.../OFGT-data
  • Run the command for generating a systematic sample using 250 m distance between the clusters, the square clustering scheme, 8 points per cluster, 60 m distance between the plots, and with a header
oft-gensyssample.bash images/landsat_t1.tif 250 250 5 8 60 1
  • Look at the first lines of your result:
head  results/grid_points.txt
  • This is how they look like:

ID CLUSX CLUSY PLOT X Y

1.000000 729285.000000 -2352885.000000 1.000000 729285.000000 -2352885.000000

1.000000 729285.000000 -2352885.000000 2.000000 729345.000000 -2352885.000000

1.000000 729285.000000 -2352885.000000 3.000000 729405.000000 -2352885.000000

1.000000 729285.000000 -2352885.000000 4.000000 729405.000000 -2352945.000000

...

ID, CLUSX, and CLUSY refer to the cluster centre point which is always the northwestern point of the cluster. PLOT, X, and Y refer to the single points.


  • Load the data in QGIS using 'Add Delimited Text Layer' and see how it overlays on your Landsat image.



Back to Open Foris Toolkit Main Page

Back to Tools & Exercises



Personal tools