Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
Merge branch 'main' of https://github.com/j-miszczyszyn/foRestools

# Conflicts:
#	.Rhistory
  • Loading branch information
j-miszczyszyn committed Mar 7, 2024
2 parents 7b23853 + 0f3ec1e commit eef1af8
Show file tree
Hide file tree
Showing 5 changed files with 324 additions and 0 deletions.
275 changes: 275 additions & 0 deletions .Rhistory
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,279 @@ devtools::check()
usethis::use_pkgdown_github_pages()
usethis::use_pkgdown_github_pages()
usethis::use_pkgdown_github_pages()
<<<<<<< HEAD
usethis::use_news_md()
=======
usethis::use_pkgdown_github_pages()
git config --global user.signingkey YOUR_KEY_ID
git config --global user.signingkey YOUR_KEY_ID
devtools::test()
usethis::use_pkgdown_github_pages()
library(foRestools)
r=stars::read_stars("D:/01_UR\01_PROJEKTY/02_Jemiola/02_rezerwat_narol/JEMIOŁA_NAROL_rezerwat_psscene_analytic_8b_sr_udm2/PSScene/20200324_083816_55_2277_3B_AnalyticMS_SR_8b_clip.tif")
r=stars::read_stars("D:/01_UR\01_PROJEKTY/02_Jemiola/02_rezerwat_narol/JEMIOŁA_NAROL_rezerwat_psscene_analytic_8b_sr_udm2/PSScene/20200324_083816_55_2277_3B_AnalyticMS_SR_8b_clip.tif")
r=stars::read_stars("D:/01_UR/1_PROJEKTY/02_Jemiola/02_rezerwat_narol/JEMIOŁA_NAROL_rezerwat_psscene_analytic_8b_sr_udm2/PSScene/20200324_083816_55_2277_3B_AnalyticMS_SR_8b_clip.tif")
r=stars::read_stars("D:/01_UR/01_PROJEKTY/02_Jemiola/01_Cisowa/03_Najnowsze_daty/Jemiola_Cisowa_psscene_analytic_8b_sr_udm2/PSScene/20200403_083920_30_2275_3B_AnalyticMS_SR_8b_harmonized_clip.tif")
define_red(6)
define_nir(8)
calculate_NDVI(r)
calculate_NDVI(r, ndvi)
devtools::load_all(".")
calculate_NDVI(r)
#' Calculate NDVI index
#'
#' @param r - stars object
#'
#' @return
#' @export
#'
#' @examples calculate_NDVI(r)
calculate_NDVI=function(r){
red=r[, , , band_red, drop = TRUE]
nir=r[, , , band_nir, drop = TRUE]
ndvi = (nir - red) / (nir + red)
return(ndvi)
}
calculate_NDVI(r)
ndvi=calculate_NDVI(r)
plot(ndvi)
usethis::use_pkgdown()
usethis::use_pkgdown_github_pages()
pkgdown::build_site()
usethis::use_pkgdown_github_pages()
devtools::load_all(".")
library(foRestools)
devtools::load_all(".")
devtools::check()
# #Set a filepath to your raster
r=system.file("raster/elev.tif", package = "spData")
library(foRestools)
# #Set a filepath to your raster
r=system.file("raster/Raster.tif", package = "spData")
# #
# # #Set number of bands
define_nir(8)
define_red(6)
#
# # #Chose and calculate index
ndvi=calculate_NDVI(r)
library(foRestools)
# #Set a filepath to your raster
r=system.file("raster/Raster.tif", package = "spData")
# #
# # #Set number of bands
define_nir(8)
define_red(6)
#
# # #Chose and calculate index
ndvi=calculate_NDVI(r)
library(foRestools)
# #Set a filepath to your raster
r=system.file("raster/Raster.tif", package = "spData")
# #
# # #Set number of bands
define_nir(8)
define_red(6)
#
# # #Chose and calculate index
ndvi=calculate_NDVI(r)
#' Calculate NDVI index
#'
#' @param r - stars object
#'
#' @return
#' @export
#'
#' @examples calculate_NDVI(r)
calculate_NDVI=function(r){
red=r[, , , band_red, drop = TRUE]
nir=r[, , , band_nir, drop = TRUE]
ndvi = (nir - red) / (nir + red)
}
ndvi=calculate_NDVI(r)
red=r[, , , 8, drop = TRUE]
nir=r[, , , 6, drop = TRUE]
# #Set a filepath to your raster
r=system.file("raster/20230723_083411_89_2415_3B_AnalyticMS_SR_8b_clip.tif", package = "spData")
system.file("raster/20230723_083411_89_2415_3B_AnalyticMS_SR_8b_clip.tif", package = "spData")
system.file("raster/20230723_083411_89_2415_3B_AnalyticMS_SR_8b_clip.tif", package = "spData")
system.file("raster/", package = "spData")
library(foRestools)
system.file("raster/", package = "spData")
system.file("raster", package = "spData")
# #Set a filepath to your raster
r=system.file("raster", package = "spData")
system.file("raster", package = "spData") |> dir()
system.file("data/raster", package = "spData") |> dir()
# #Set a filepath to your raster
r=system.file("data/raster", package = "spData")
system.file("raster", package = "foRestools")
system.file("raster")
remotes::install_github("kadyb/rgugik")
library(rgugik)
counties = county_names
counties = counties[substr(counties$TERYT, 1, 2) == "16", "TERYT"]
counties_geom = borders_get(TERYT = counties)
plot(st_geometry(counties_geom), main = "Opolskie")
plot(sf::st_geometry(counties_geom), main = "Opolskie")
req_df = ortho_request(counties_geom)
View(req_df)
warnings()
View(req_df)
req_df = DEM_request(counties_geom)
library(sf)
counties_geom=st_union(counties_geom)
plot(st_geometry(counties_geom), main = "Opolskie")
req_df = DEM_request(counties_geom)
aoi=counties_geom
siatka=st_make_grid(aoi, n=4)
plot(siatka)
plot(aoi, add=T)
aoi=st_intersection(aoi, siatka)
plot(aoi)
View(aoi)
wynik_dem=data_frame()
for (i in 1:nrow(aoi) {
nrow(aoi)
View(aoi)
#
counties = county_names
counties = counties[substr(counties$TERYT, 1, 2) == "16", "TERYT"]
counties_geom = borders_get(TERYT = counties)
counties_geom=st_union(counties_geom)
plot(st_geometry(counties_geom), main = "Opolskie")
req_df = DEM_request(counties_geom)
aoi=counties_geom
siatka=st_make_grid(aoi, n=4)
plot(siatka)
aoi=st_intersection(aoi, siatka)
plot(aoi)
wynik_dem=data_frame()
for (i in 1:length(aoi$geometry) {
for (i in 1:length(aoi$geometry) {
remotes::install_github("kadyb/rgugik")
}
aoi=st_as_sf(counties_geom)
aoi=st_as_sf(counties_geom)
siatka=st_make_grid(aoi, n=4)
plot(siatka)
aoi=st_intersection(aoi, siatka)
plot(aoi)
nrow(aoi)
for (i in 1:nrow(aoi) {
for (i in 1:nrow(aoi)) {
req_df = DEM_request(aoi[i, ])
wynik_dem = bind_rows(wynik_dem, req_df)
}
library(tidyverse)
for (i in 1:nrow(aoi)) {
req_df = DEM_request(aoi[i, ])
wynik_dem = bind_rows(wynik_dem, req_df)
}
wynik_dem=data_frame()
for (i in 1:nrow(aoi)) {
req_df = DEM_request(aoi[i, ])
wynik_dem = bind_rows(wynik_dem, req_df)
}
warnings()
aoi=st_as_sf(counties_geom)
siatka=st_make_grid(aoi, n=10)
plot(siatka)
aoi=st_intersection(aoi, siatka)
plot(aoi)
wynik_dem=data_frame()
for (i in 1:nrow(aoi)) {
req_df = DEM_request(aoi[i, ])
wynik_dem = bind_rows(wynik_dem, req_df)
}
#
counties = county_names
counties = counties[substr(counties$TERYT, 1, 2) == "16", "TERYT"]
counties_geom = borders_get(TERYT = counties)
#
commune_names = county_names
commune_names = commune_names[substr(commune_names$TERYT, 1, 2) == "16", "TERYT"]
commune_names_geom = borders_get(TERYT = commune_names)
commune_names_geom=st_union(commune_names_geom)
plot(st_geometry(commune_names_geom), main = "Opolskie")
#
commune_names = county_names
commune_names = commune_names[substr(commune_names$TERYT, 1, 2) == "16", "TERYT"]
commune_names = commune_names[substr(commune_names$TERYT==1]
commune_names = commune_names[substr(commune_names$TERYT==1)]
#
commune_names = county_names
commune_names = commune_names[substr(commune_names$TERYT==1)]
counties = county_names
counties = counties[substr(counties$TERYT, 1, 2) == "16", "TERYT"]
counties_geom = borders_get(TERYT = counties)
counties_geom=st_union(counties_geom)
plot(st_geometry(counties_geom), main = "Opolskie")
counties = county_names
counties = counties[substr(counties$TERYT, 1, 2) == "16", "TERYT"]
counties_geom = borders_get(TERYT = counties)
View(counties_geom)
counties_geom=subset(counties_geom$TERYT==1)
View(commune_names_geom)
View(counties_geom)
counties_geom=dplyr::select(TERYT==1)
counties_geom=dplyr::select(counties_geom,TERYT==1)
counties_geom %>% dplyr::select(TERYT==1)
View(commune_names_geom)
View(counties_geom)
counties_geom %>% dplyr::select(TERYT==1601)
#
counties = county_names
counties = counties[substr(counties$TERYT, 1, 2) == "16", "TERYT"]
counties_geom = borders_get(TERYT = counties)
counties_geom %>% dplyr::select(TERYT==1601)
View(commune_names)
View(counties_geom)
View(aoi)
View(counties_geom)
counties_geom= counties_geom %>%
dplyr::select(TERYT=1601)
counties_geom= counties_geom[1]
counties_geom= counties_geom[1,]
plot(st_geometry(counties_geom))
req_df = DEM_request(counties_geom)
siatka=st_make_grid(aoi, n=10)
aoi=st_as_sf(counties_geom)
siatka=st_make_grid(aoi, n=10)
plot(siatka)
aoi=st_intersection(aoi, siatka)
plot(aoi)
wynik_dem=data_frame()
for (i in 1:nrow(aoi)) {
req_df = DEM_request(aoi[i, ])
wynik_dem = bind_rows(wynik_dem, req_df)
}
View(wynik_dem)
req_df = DEM_request(counties_geom)
devtools::load_all(".")
devtools::load_all(".")
usethis::use_pkgdown_github_pages()
usethis::use_pkgdown_github_pages()
devtools::check()
devtools::load_all()
devtools::document()
usethis::use_pkgdown_()
usethis::use_pkgdown()
usethis::use_pkgdown_github_pages()
usethis::use_package_doc()
library(foRestools)
?foRestools
?foRestools
devtools::load_all(".")
?foRestools
library(foRestools)
define_nir(8)
?foRestools
??foRestools
??foRestools
use_package_doc()
use_this::use_package_doc()
usethis::use_package_doc()
?foRestools
usethis::use_citation()
>>>>>>> 0f3ec1e93f4cbba677f125d8310b550f0f1464b6
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export(calculate_GSAVI)
export(calculate_MSAVI)
export(calculate_NDVI)
export(calculate_TGI)
export(calculate_new_position)
export(define_AOI)
export(define_blue)
export(define_coastal_blue)
Expand Down
17 changes: 17 additions & 0 deletions R/calculate_new_position.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#' Title
#'
#' @param start_lon
#' @param start_lat
#' @param distance
#' @param bearing
#'
#' @return
#' @export
#'
#' @examples
calculate_new_position <- function(start_lon, start_lat, distance, bearing) {
# Obliczenie nowych współrzędnych z użyciem funkcji destPoint() z pakietu geosphere
new_position <- geosphere::destPoint(c(start_lon, start_lat), bearing, distance)
# Zwrócenie nowych współrzędnych
return(list(longitude = new_position[1], latitude = new_position[2]))
}
11 changes: 11 additions & 0 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bibentry(
bibtype = "Article",
title = ,
author = ,
journal = ,
year = ,
volume = ,
number = ,
pages = ,
doi =
)
20 changes: 20 additions & 0 deletions man/calculate_new_position.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eef1af8

Please sign in to comment.