-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vignetts for big area download support
- Loading branch information
1 parent
7e8c5c9
commit 11fb651
Showing
5 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.Rproj.user | ||
docs | ||
inst/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
title: "Pobieranie dużych obszarów z wykorzystaniem rgugik i foRestools" | ||
output: | ||
word_document: default | ||
html_document: | ||
df_print: paged | ||
pdf_document: default | ||
--- | ||
# Wczytanie potrzebnych bibliotek | ||
```{r} | ||
library(rgugik) | ||
library(tidyverse) | ||
library(here) | ||
library(sf) | ||
library(mapview) | ||
``` | ||
|
||
# Przygotowanie AOI (Area of Interest) | ||
|
||
Utworzenie zmiennej aoi przechowującej nazwy miejscowość i ich kody TERYT | ||
```{r} | ||
aoi = commune_names | ||
``` | ||
|
||
Wybór dowolnej miejscowości po nazwie np. Krynica oraz pobranie granic tej miejscowości | ||
```{r} | ||
aoi= aoi %>% | ||
filter(NAME=="Krynica-Zdrój") | ||
aoi_geometry = borders_get(TERYT = aoi$TERYT) | ||
``` | ||
|
||
Wyświetlanie granic w sposób interaktywny | ||
```{r} | ||
mapview(aoi_geometry) | ||
``` | ||
|
||
# Pakiet foRestools - instalacja i wczytanie | ||
```{r} | ||
# devtools::install_github("https://github.com/j-miszczyszyn/foRestools.git") | ||
library(foRestools) | ||
``` | ||
|
||
# Przygotowoanie pliki wektorowego | ||
|
||
W omawianym przykładzie przygotowano AOI Krynicy-Zdrój, należy zapisać kopie pliku i zapamiętać jego ścieżkę. | ||
Pobierać możemy też innymi plikami niż omówiony w przykładzie, należy pamiętać aby był on w układzie PL-1992 | ||
```{r} | ||
# st_write(counties_geom, "aoi_geometry.shp") | ||
``` | ||
|
||
# Pobieranie informacji dla AOI | ||
|
||
W rgugik dostępne są funkcje *rgugik::dem_request* oraz *rgugik::ortho_request* jednak posiadają ograniczenie do 1000 rekordów. | ||
Aby pobrać większe obszary wykorzystamy funkcję która dzieli wskazany polygon na mniejsze. Nie określamy wymiarów, a jedynie współczynnik np.10. Jako wynik scaloną tabelę dla całego AOI. | ||
|
||
```{r} | ||
table_dem=dem_download_big_area_rgugik("aoi_geometry.shp",10) | ||
``` | ||
Wyświetlmy 15 rekordów wynikowej tabeli. | ||
```{r} | ||
print(table_dem[1:25,]) | ||
``` | ||
|
||
Przykład wywołania unikalnych wartości w tabeli | ||
```{r} | ||
print(unique(table_dem$product)) | ||
print(unique(table_dem$year)) | ||
print(unique(table_dem$VRS)) | ||
``` | ||
|
||
## Selekcja przed pobieraniem | ||
|
||
Otrzymaliśmy tabelę zawierającą wszystkie dostępne w GUGIK produkty, jednak aby wybrać jedynie te które nas interesują należy odfiltrować tabelę. W podanym przykładzie wybierzemy DTM, dodatkowo spełniający warunek "rok > 2020". Po więcej możliwości operowania tabelami odsyłam do pakiety *tidyverse*. | ||
|
||
```{r} | ||
table_select=table_dem %>% | ||
filter(product=="DTM") %>% | ||
filter(year > 2020) | ||
``` | ||
|
||
|
||
Gdyby połączenie z serwerem nie było stabilne można zwiększyć czas oczekiwania na połączenie np.2000 ms | ||
```{r} | ||
options(timeout = 2000) | ||
``` | ||
|
||
#Pobieranie | ||
|
||
Linijka wywołująca pobieranie. Możliwe jest wskazanie ścieżki docelowej folderu zapisu. | ||
```{r} | ||
# tile_download(table_select) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.html | ||
*.R |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: "Rgugik_big_area_support" | ||
output: rmarkdown::html_vignette | ||
vignette: > | ||
%\VignetteIndexEntry{Rgugik_big_area_support} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
```{r, include = FALSE} | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "#>" | ||
) | ||
``` | ||
|
||
```{r setup} | ||
library(foRestools) | ||
``` |