|
49 | 49 | keywordstyle=\color{blue},
|
50 | 50 | stringstyle=\color{red},
|
51 | 51 | breaklines=true,
|
52 |
| - morekeywords={function,st,github,qgisprocess,sf,fun,run,qgis,tmp,raster,base,algorithms,p,argument,specs,providers,algorithm}, |
| 52 | + morekeywords={function,st,github,qgisprocess,sf,fun,run,qgis,tmp,raster,base,algorithms,p,argument,specs,providers,algorithm,terra,output,select}, |
53 | 53 | extendedchars=true
|
54 | 54 | }
|
55 | 55 | \definecolor{mycolor}{HTML}{589632}
|
|
69 | 69 |
|
70 | 70 | % ----------------------------------- Cheatsheet ---------------------------------------------- %
|
71 | 71 | \lstset{
|
72 |
| - literate={á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 |
| 72 | + literate={á}{{\"a}}1 {é}{{\"e}}1 {í}{{\"i}}1 {ó}{{\"o}}1 {ú}{{\"u}}1 |
73 | 73 | }
|
74 | 74 | \begin{document}
|
75 | 75 | \pagestyle{footerstyle}
|
|
104 | 104 |
|
105 | 105 | % Mission %
|
106 | 106 | \begin{minipage}{\linewidth}
|
107 |
| - \vspace{-5pt} |
| 107 | + \vspace{-10pt} |
108 | 108 | \textbf{\fontsize{44}{44}\selectfont \textbf{Misión}}\vspace{8pt}\\
|
109 | 109 | El objetivo de qgisprocess es proporcionar una interfaz de R para los algoritmos de geoprocesamiento de QGIS, un popular programa de sistema de información geográfica (SIG) de código abierto. Este paquete es una reimplementación de la funcionalidad proporcionada por el paquete archivado \textbf{RQGIS} o la que parcialmente fue revivido en el paquete \textbf{RQGIS3}
|
110 | 110 | \end{minipage}
|
|
155 | 155 | \vspace{10pt}
|
156 | 156 | \textbf{\fontsize{44}{44}\selectfont \textbf{Instalación}\vspace{5pt}}
|
157 | 157 | \begin{lstlisting}[style=Rstyle]
|
158 |
| - > install.packages('remotes') |
159 |
| - > install_github('r-spatial/qgisprocess') |
| 158 | + > install.packages("remotes") |
| 159 | + > install_github("r-spatial/qgisprocess") |
160 | 160 | > library(qgisprocess)
|
161 | 161 | \end{lstlisting}
|
162 | 162 | \end{minipage}
|
|
202 | 202 | \end{minipage}
|
203 | 203 | \begin{lstlisting}[style=Rstyle]
|
204 | 204 | # Mostrar una descripción de ayuda de la función a usar
|
205 |
| - > qgis_show_help(algorithm ='native:creategrid') |
| 205 | + > qgis_show_help(algorithm ="native:creategrid") |
206 | 206 |
|
207 | 207 | # Mostrar todos los parámetros de la función
|
208 |
| - > qgis_get_argument_specs(algorithm = 'native:creategrid') |
| 208 | + > qgis_get_argument_specs(algorithm = "native:creategrid") |
209 | 209 | \end{lstlisting}
|
210 | 210 | \begin{lstlisting}[style=Rstyle]
|
211 | 211 | # Inicar la ejecucion del algoritmo
|
212 | 212 | > qgis_run_algorithm(
|
213 |
| - algorithm = 'native:creategrid', |
| 213 | + algorithm = "native:creategrid", |
214 | 214 | TYPE = 4,
|
215 |
| - EXTENT = c('794599, 798208, 8931775,8935384'), |
| 215 | + EXTENT = c("794599, 798208, 8931775,8935384"), |
216 | 216 | HSPACING = 1000 ,
|
217 | 217 | VSPACING = 1000,
|
218 |
| - CRS = 'EPSG:32717', |
219 |
| - OUTPUT = 'grid' |
| 218 | + CRS = "EPSG:32717", |
| 219 | + OUTPUT = "grid" |
220 | 220 | )
|
221 | 221 |
|
222 | 222 | # Crear una función basada en un algoritmo específico
|
223 |
| - > grid_fun <- qgis_function('native:creategrid') |
| 223 | + > grid_fun <- qgis_function("native:creategrid") |
224 | 224 | > grid_fun(
|
225 | 225 | TYPE = 4,
|
226 |
| - EXTENT = c('794599,798208,8931775,8935384'), |
| 226 | + EXTENT = c("794599,798208,8931775,8935384"), |
227 | 227 | HSPACING = 1000,
|
228 | 228 | VSPACING = 1000,
|
229 |
| - CRS = 'EPSG:32717', |
230 |
| - OUTPUT = 'grid' |
| 229 | + CRS = "EPSG:32717", |
| 230 | + OUTPUT = "grid" |
231 | 231 | )
|
232 | 232 | \end{lstlisting}
|
233 | 233 |
|
|
239 | 239 | \end{minipage}
|
240 | 240 |
|
241 | 241 | \begin{lstlisting}[style=Rstyle]
|
242 |
| - > qgis_extract_output(result_run_alg, 'OUTPUT') |
| 242 | + > qgis_extract_output(result_run_alg, "OUTPUT") |
243 | 243 | \end{lstlisting}
|
244 | 244 | \begin{lstlisting}[style=Rstyle]
|
245 | 245 | # Un vector de caracteres que indica la ubicación de un archivo temporal.
|
|
267 | 267 | # Cálculo de buffer
|
268 | 268 | > library(sf)
|
269 | 269 | > system.file(
|
270 |
| - 'longlake/longlake_depth.gpkg', |
271 |
| - package = 'qgisprocess' |
| 270 | + "longlake/longlake_depth.gpkg", |
| 271 | + package = "qgisprocess" |
272 | 272 | ) |>
|
273 | 273 | qgis_run_algorithm_p(
|
274 |
| - algorithm = 'native:buffer', |
| 274 | + algorithm = "native:buffer", |
275 | 275 | DISTANCE = 100
|
276 | 276 | ) |> st_as_sf( ) |>
|
277 | 277 | plot( )
|
|
288 | 288 | \begin{lstlisting}[breaklines=true,style=Rstyle]
|
289 | 289 | # Creación de un hexagrid de 400x400
|
290 | 290 | > library(sf)
|
291 |
| -> grid_fun <- qgis_function('native:creategrid') |
| 291 | +> grid_fun <- qgis_function("native:creategrid") |
292 | 292 | > grid_fun(
|
293 | 293 | TYPE = 4,
|
294 |
| - EXTENT = c('409967, 411658, 5083354, 5084777'), |
| 294 | + EXTENT = c("409967, 411658, 5083354, 5084777"), |
295 | 295 | HSPACING = 400,
|
296 | 296 | VSPACING = 400,
|
297 |
| - CRS = 'EPSG:26920', |
298 |
| - OUTPUT = 'grid' |
| 297 | + CRS = "EPSG:26920", |
| 298 | + OUTPUT = "grid" |
299 | 299 | ) |> st_as_sf() |>
|
300 | 300 | select(id) |>
|
301 | 301 | plot()
|
|
311 | 311 | > library(stars)
|
312 | 312 | > dem <- read_stars(
|
313 | 313 | system.file(
|
314 |
| - 'raster/nz_elev.tif', |
315 |
| - package = 'spDataLarge') |
| 314 | + "raster/nz_elev.tif", |
| 315 | + package = "spDataLarge") |
316 | 316 | )
|
317 | 317 | > qgis_run_algorithm(
|
318 |
| - algorithm ='sagang:sagawetnessindex', |
| 318 | + algorithm ="sagang:sagawetnessindex", |
319 | 319 | DEM = dem,
|
320 |
| - TPI = 'tpi.sdat') |> |
321 |
| - qgis_extract_output('TWI') |> |
322 |
| - st_as_stars() |> |
323 |
| - plot(col = cptcity::cpt(pal = 'ocal_blues')) |
| 320 | + TPI = "tpi.sdat") |> |
| 321 | + qgis_extract_output("TWI") |> |
| 322 | + qgis_as_terra() |> |
| 323 | + plot(col = cptcity::cpt(pal = "ocal_blues")) |
324 | 324 | \end{lstlisting}
|
325 | 325 | };
|
326 | 326 | \node[fancytitle, right=0pt,yshift=6pt] at (box.north west) {Raster data};
|
|
0 commit comments