Skip to content

Plot alocation


Warning

This library is under development, none of the presented solutions are available for download.

Allows the allocation of sampling plots with various types of sampling and plot formats.

Class Parameters

PlotAlocation(shp_dir, epsg)
Parameters Description
shp_dir Directory of the shapefile defining the boundary of the area to be sampled.
epsg The EPSG code of the shapefile defining the boundary of the area to be sampled.

Class Functions

functions and parameters
PlotAlocation.create_plots(distribution, plot_format, plot_area,
                            rectangle_size, sample_number, min_border_distance, 
                            x_y_angle, save_buffer, show_plot, save_dir)

Parameter Description
distribution Type of distribution or allocation that the plots should be subjected to.
plot_format Format of the plot that will be installed.
plot_area Area of the plot that will be installed. Not used when plot_format = 'rectangle'
rectangle_size Used when plot_format = 'rectangle'.Tuple containing the sizes of X and Y of the rectangle (x,y).
sample_number Could be the number of plots or the percentage of the total area that will be sampled. If value < 1 it will be understood as a percentage. If value >= 1 it will be understood that you are setting the quantity of plots to allocate.
min_border_distance Minimum distance in meters that the plots must be from the edge of the shapefile boundaries.
x_y_angle Used when distribution = 'systematic custom'. Sets the distance in X and Y of each line in the grid of the systematic distribution and also the rotation angle in degrees (x,y,angle).
save_buffer If true, saves the buffer considering the plot size around the point.
show_plot If true, displays a figure of the allocation performed.
save_dir If not none, will be the directory where the buffer and points shapefiles will be saved.

Available arguments

  • random : Allocate the plots in a random distribution
  • best sampling : (recommended) Allocate the plots in the best possible distribution for the area considering the established parameters.
  • systematic : Allocate the plots in a grid distribution, does not allow the definition of sample_number and alocate all possible plots.
  • systematic custom : Allocate the plots in a grid distribution with the x and y distances from the grid lines and grid rotation angle defined by the user.
  • round : Consider that plots will have a rounded shape.
  • squared : Consider that plots will have a squared shape.
  • rectangle : Allows user to insert the X and Y sizes of the desired rectangle shape.
  • In order to achieve the best precision in calculation, you must select the UTM zone that your area is in. Find your utm zone.

Example Usage

Random distribution

plot_alocation_example_1.py
1
2
3
4
5
from fptools.inventory_plots import PlotAlocation #(1)
plots = PlotAlocation('example/shapefile/path.shp',epsg='32722') #(2)
plots.create_plots(distribution="random", sample_number=25, plot_area=400,
                    min_border_distance=20, save_dir='points.shp',
                    show_plot=True,save_buffer=True) #(3)

  1. Import PlotAlocation class.
  2. Create the plots variable with PlotAlocation class. Defines the boundary area shapefile path and the epsg.
  3. Create the plots with random distribuition, with 25 sample points, plot area = 400 m², a minimum border distance of 20 meters and save the shapefile as points.shp.
Systematic custom distribution

plot_alocation_example_2.py
1
2
3
4
5
from fptools.inventory_plots import PlotAlocation #(1)
plots = PlotAlocation('example/shapefile/path.shp',epsg='32722') #(2)
plots.create_plots(distribution="systematic custom", x_y_angle=(100,50,45),
                    plot_area=400, min_border_distance=20, save_dir='points.shp',
                    show_plot=True,save_buffer=True) #(3)

  1. Import PlotAlocation class.
  2. Create the plots variable with PlotAlocation class. Defines the boundary area shapefile path and the epsg.
  3. Create the plots with systematic custom distribuition, plot area = 400 m², with x distance = 100 meters, y distance = 50 meters and 45º of grid rotation, with a minimum border distance of 20 meters and save the shapefile as points.shp.
Rectangle plot format

plot_alocation_example_3.py
1
2
3
4
5
from fptools.inventory_plots import PlotAlocation #(1)
plots = PlotAlocation('example/shapefile/path.shp',epsg='32722') #(2)
plots.create_plots(distribution="best sampling", rectangle_size=(20,30), 
                    min_border_distance=20, save_dir='points.shp',
                    show_plot=True,save_buffer=True) #(3)

  1. Import PlotAlocation class.
  2. Create the plots variable with PlotAlocation class. Defines the boundary area shapefile path and the epsg.
  3. Create the plots with best sampling distribuition, a rectangle width (x) = 20 meters and height (y) = 30 meters, with a minimum border distance of 20 meters and save the shapefile as points.shp.