FishnetFunction: Fishnet Tool

Description Usage Arguments Value Examples

View source: R/FishnetFunction.R

Description

This function creates a fishnet polygon from an input shapefile. The output fishnet will be reprojected to UTM.

Usage

1
FishnetFunction(my_poly, extent_only, diff_factor, length_factor)

Arguments

my_poly

A sp objetct.

extent_only

(optional) TRUE (default) or FALSE. If the user input file is a polygon, the extent_only can be set to FALSE and the ouptut fishnet polygon will be cropped to the input file.

diff_factor

Integer. Faktor after which the extent of the input file will be divided into x and y direction.

length_factor

Vector of two integer. Can be used instead of the diff_factor. Distance in meters of one tile n x and y direction.

Value

A fishnet polygon in UTM projection.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(sp)
library(raster)
library(rgdal)
library(rgeos)
library(geosphere)

# Load sample shapefile including the borders of vietnam
vnm_shp <- raster::shapefile(system.file(package = "SpatialDataToolbox", "extdata",
                                         "vietnam_borders.shp"))

# Apply diff_factor
x1 <- FishnetFunction(my_poly = vnm_shp, extent_only = FALSE, diff_factor = 10)

# Apply length_factor
x2 <- FishnetFunction(my_poly = vnm_shp, extent_only = FALSE, length_factor = c(100000,100000))

MBalthasar/SpatialDataToolbox documentation built on Jan. 29, 2020, 3:15 a.m.