|
| 1 | +\documentclass{article} |
| 2 | +\renewcommand{\normalsize}{\fontsize{12}{13}\selectfont} |
| 3 | +\usepackage[landscape]{geometry} |
| 4 | +\usepackage{url} |
| 5 | +\usepackage{multicol} |
| 6 | +\usepackage{amsfonts} |
| 7 | +\usepackage{tikz} |
| 8 | +\usepackage{amsmath} |
| 9 | +\usepackage{listings} |
| 10 | +\usepackage{listingsutf8} |
| 11 | +\lstset{inputencoding=utf8/utf8} |
| 12 | +\usepackage{colortbl} |
| 13 | +\usepackage{xcolor} |
| 14 | +\usepackage{mathtools} |
| 15 | +\usepackage{amssymb} |
| 16 | +\usepackage{enumitem} |
| 17 | +\usepackage[brazilian]{babel} |
| 18 | +\usepackage[utf8]{inputenc} |
| 19 | +\usepackage{adjustbox} |
| 20 | +\usepackage{tcolorbox} |
| 21 | +\usepackage{fancyhdr} |
| 22 | +\usetikzlibrary {shapes.callouts} |
| 23 | +\advance\textheight4in |
| 24 | +\advance\textwidth3in |
| 25 | +\advance\oddsidemargin-1.5in |
| 26 | +\advance\evensidemargin-1.5in |
| 27 | +\parindent0pt |
| 28 | +\parskip2pt |
| 29 | +\newcommand{\hr}{\centerline{\rule{3.5in}{1pt}}} |
| 30 | + |
| 31 | +% Setup the size of paper % |
| 32 | +\geometry{ |
| 33 | + paperwidth=850pt, |
| 34 | + paperheight=1100pt, |
| 35 | + margin=25pt |
| 36 | +} |
| 37 | + |
| 38 | +\lstset{ |
| 39 | + basicstyle=\ttfamily, |
| 40 | + columns=fullflexible, |
| 41 | + showstringspaces=false |
| 42 | +} |
| 43 | + |
| 44 | +% Setup the font with style of R % |
| 45 | +\lstdefinestyle{Rstyle}{ |
| 46 | + inputencoding=utf8/utf8, |
| 47 | + language=R, |
| 48 | + basicstyle=\ttfamily\fontsize{13}{13}\selectfont, |
| 49 | + keywordstyle=\color{blue}, |
| 50 | + stringstyle=\color{red}, |
| 51 | + breaklines=true, |
| 52 | + morekeywords={function,st,github,qgisprocess,sf,fun,run,qgis,tmp,raster,base,algorithms,p,argument,specs,providers,algorithm}, |
| 53 | + extendedchars=true |
| 54 | +} |
| 55 | +\definecolor{mycolor}{HTML}{589632} |
| 56 | + |
| 57 | +% Setup the style of paper % |
| 58 | +\fancypagestyle{footerstyle}{ |
| 59 | + \fancyfoot[C]{% |
| 60 | + \begin{tikzpicture}[remember picture,overlay] |
| 61 | + \node[fill=mycolor, text=white, minimum width=\paperwidth, minimum height=0.7cm, anchor=south] at (current page.south) {}; |
| 62 | + \node[anchor=east, text=white, yshift=0.35cm, xshift=-14.5cm] at (current page.south) {\textcolor{white}{\textbf{Creado por Antony Barja}}}; |
| 63 | + \node[anchor=center, text=white, yshift=0.35cm, xshift= 13.5cm] at (current page.south) {\textcolor{white}{\textbf{Revisado por Floris Vanderhaeghe and actualizado: 23/06/2023}}}; |
| 64 | + \end{tikzpicture} |
| 65 | + } |
| 66 | + \renewcommand{\footrulewidth}{0pt} |
| 67 | + \setlength{\headsep}{0.5cm} |
| 68 | + } |
| 69 | + |
| 70 | +% ----------------------------------- Cheatsheet ---------------------------------------------- % |
| 71 | +\lstset{ |
| 72 | + literate={á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 |
| 73 | +} |
| 74 | +\begin{document} |
| 75 | +\pagestyle{footerstyle} |
| 76 | +\begin{flushleft} |
| 77 | + \begin{adjustbox}{width=850pt} |
| 78 | + \fontsize{40}{30}\selectfont\textbf{QGIS en R con qgisprocess :: CHEAT SHEET} |
| 79 | + \end{adjustbox} |
| 80 | +\end{flushleft} |
| 81 | + |
| 82 | +\begin{tikzpicture}[remember picture, overlay] |
| 83 | + \node[anchor=north east, yshift=-12pt, xshift=-12pt] at (current page.north east) {\includegraphics[width=0.12\textwidth]{qgisprocess.png}}; |
| 84 | +\end{tikzpicture} |
| 85 | + |
| 86 | +\begin{multicols*}{3} |
| 87 | +\setlength{\columnsep}{400pt} |
| 88 | +\tikzset{ |
| 89 | + mybox/.style={ |
| 90 | + draw=gray, |
| 91 | + fill=white, |
| 92 | + line width=0.005pt, |
| 93 | + rectangle, |
| 94 | + rounded corners, |
| 95 | + inner sep=10pt, |
| 96 | + inner ysep=5pt |
| 97 | + }, |
| 98 | + fancytitle/.style={ |
| 99 | + fill=mycolor, |
| 100 | + text=white, |
| 101 | + font=\bfseries |
| 102 | + } |
| 103 | +} |
| 104 | + |
| 105 | +% Mission % |
| 106 | +\begin{minipage}{\linewidth} |
| 107 | + \vspace{-5pt} |
| 108 | + \textbf{\fontsize{44}{44}\selectfont \textbf{Misión}}\vspace{8pt}\\ |
| 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 | +\end{minipage} |
| 111 | + |
| 112 | +% Features % |
| 113 | +\begin{minipage}{\linewidth} |
| 114 | + \vspace{1pt} |
| 115 | + \textbf{\fontsize{44}{44}\selectfont \textbf{Características}}\vspace{8pt}\\ |
| 116 | +Este paquete facilita el uso de algoritmos de procesamiento nativos y algunos de GDAL, GRASS y muchos otros (como SAGA). |
| 117 | +\begin{center} |
| 118 | +\setlength{\arrayrulewidth}{0.001pt} |
| 119 | +\arrayrulecolor{gray} |
| 120 | +\renewcommand{\arraystretch}{1.25} |
| 121 | +\begin{tabular}{|c|c|} |
| 122 | + \hline |
| 123 | + \rowcolor{mycolor} |
| 124 | + \textcolor{white}{\textbf{Proveedor}} & \textcolor{white}{\textbf{Algoritmos}} \\ |
| 125 | + \hline |
| 126 | + qgis & 50 + 242 ( c ++) + 1 (3D) \\ |
| 127 | + \hline |
| 128 | + gdal & 56 \\ |
| 129 | + \hline |
| 130 | + grass & 304 \\ |
| 131 | + \hline |
| 132 | + third-party providers & x \\ |
| 133 | + \hline |
| 134 | + Total & 653 + x \\ |
| 135 | + \hline |
| 136 | +\end{tabular} |
| 137 | +\end{center} |
| 138 | +\end{minipage} |
| 139 | + |
| 140 | +\begin{lstlisting}[style=Rstyle] |
| 141 | + # Mostrar un tibble con proveedores de processing |
| 142 | + > qgis_providers( ) |
| 143 | + # Mostrar un tibble con algoritmos |
| 144 | + > qgis_algorithms( ) |
| 145 | + # Buscar algoritmos con expresiones regulares |
| 146 | + > qgis_search_algorithms( |
| 147 | + algorithm = <x>, |
| 148 | + provider = <y>, |
| 149 | + group = <z> |
| 150 | + ) |
| 151 | +\end{lstlisting} |
| 152 | + |
| 153 | +% Installation % |
| 154 | +\begin{minipage}{\linewidth} |
| 155 | +\vspace{10pt} |
| 156 | + \textbf{\fontsize{44}{44}\selectfont \textbf{Instalación}\vspace{5pt}} |
| 157 | + \begin{lstlisting}[style=Rstyle] |
| 158 | + > install.packages('remotes') |
| 159 | + > install_github('r-spatial/qgisprocess') |
| 160 | + > library(qgisprocess) |
| 161 | + \end{lstlisting} |
| 162 | +\end{minipage} |
| 163 | + |
| 164 | + |
| 165 | +\begin{tikzpicture} |
| 166 | + \node[mybox,text width=11cm] (box) |
| 167 | + {\\ |
| 168 | +Si es necesario, especifique la ruta a la instalación de QGIS antes de cargar qgisprocess: |
| 169 | +\begin{lstlisting}[breaklines=true,style=Rstyle] |
| 170 | +> options("qgisprocess.path" = "C:/Program Files/QGIS 3.30/bin/qgis_process-qgis.bat") |
| 171 | +\end{lstlisting} |
| 172 | + }; |
| 173 | + \node[fancytitle, right=0pt,yshift=6pt] at (box.north west) {GNU/Linux, macOS, Windows}; |
| 174 | +\end{tikzpicture} |
| 175 | + |
| 176 | +\begin{tikzpicture} |
| 177 | + \node[mybox,text width=11cm] (box) |
| 178 | + {\\ |
| 179 | + 1.Instalación de docker. |
| 180 | + |
| 181 | + 2.Descargar la imagen de docker llamado geocomputación. |
| 182 | +\begin{lstlisting}[breaklines=true,style=Rstyle] |
| 183 | +> docker pull geocompr/geocompr:qgis-ext |
| 184 | +\end{lstlisting} |
| 185 | + |
| 186 | + 3. Iniciar la imagen de gecomputación con docker. |
| 187 | +\begin{lstlisting}[breaklines=true,style=Rstyle] |
| 188 | +> docker run -d -p 8786:8787 -v $(pwd):/home/rstudio/data -e PASSWORD=pw geocompr/geocompr:qgis-ext |
| 189 | +\end{lstlisting} |
| 190 | + |
| 191 | + }; |
| 192 | + \node[fancytitle, right=0pt,yshift=6pt] at (box.north west) {Usando docker}; |
| 193 | +\end{tikzpicture} |
| 194 | + |
| 195 | + |
| 196 | +% columa 2 % |
| 197 | +% Input % |
| 198 | +\begin{minipage}{\linewidth} |
| 199 | + \vspace{-5pt} |
| 200 | + \textbf{\fontsize{44}{44}\selectfont \textbf{Funciones de entrada}}\vspace{8pt}\\ |
| 201 | + El paquete ofrece nuevas funcionalidades de entrada para tener un flujo de trabajo más amigable en el entorno de R. |
| 202 | +\end{minipage} |
| 203 | +\begin{lstlisting}[style=Rstyle] |
| 204 | + # Mostrar una descripción de ayuda de la función a usar |
| 205 | + > qgis_show_help(algorithm ='native:creategrid') |
| 206 | + |
| 207 | + # Mostrar todos los parámetros de la función |
| 208 | + > qgis_get_argument_specs(algorithm = 'native:creategrid') |
| 209 | +\end{lstlisting} |
| 210 | +\begin{lstlisting}[style=Rstyle] |
| 211 | + # Inicar la ejecucion del algoritmo |
| 212 | + > qgis_run_algorithm( |
| 213 | + algorithm = 'native:creategrid', |
| 214 | + TYPE = 4, |
| 215 | + EXTENT = c('794599, 798208, 8931775,8935384'), |
| 216 | + HSPACING = 1000 , |
| 217 | + VSPACING = 1000, |
| 218 | + CRS = 'EPSG:32717', |
| 219 | + OUTPUT = 'grid' |
| 220 | + ) |
| 221 | + |
| 222 | + # Crear una función basada en un algoritmo específico |
| 223 | + > grid_fun <- qgis_function('native:creategrid') |
| 224 | + > grid_fun( |
| 225 | + TYPE = 4, |
| 226 | + EXTENT = c('794599,798208,8931775,8935384'), |
| 227 | + HSPACING = 1000, |
| 228 | + VSPACING = 1000, |
| 229 | + CRS = 'EPSG:32717', |
| 230 | + OUTPUT = 'grid' |
| 231 | + ) |
| 232 | +\end{lstlisting} |
| 233 | + |
| 234 | +% Output functions % |
| 235 | +\begin{minipage}{\linewidth} |
| 236 | + \vspace{12pt} |
| 237 | + \textbf{\fontsize{44}{44}\selectfont \textbf{Funciones de salida}}\vspace{8pt}\\ |
| 238 | +qgisprocess nos brinda nuevas funcionalidades para la generación de archivos en formatos vectoriales, raster y otros. Además, permite cargar fácilmente a nuestro entorno de trabajo. |
| 239 | +\end{minipage} |
| 240 | + |
| 241 | +\begin{lstlisting}[style=Rstyle] |
| 242 | + > qgis_extract_output(result_run_alg, 'OUTPUT') |
| 243 | +\end{lstlisting} |
| 244 | +\begin{lstlisting}[style=Rstyle] |
| 245 | +# Un vector de caracteres que indica la ubicación de un archivo temporal. |
| 246 | + > qgis_tmp_base( ) |
| 247 | + > qgis_tmp_file( ".csv" ) |
| 248 | + > qgis_tmp_vector( ) |
| 249 | + > qgis_tmp_raster( ) |
| 250 | +\end{lstlisting} |
| 251 | + |
| 252 | +\vspace{145pt} |
| 253 | + |
| 254 | +% Columna 3 % |
| 255 | +% Pipe % |
| 256 | +\begin{minipage}{\linewidth} |
| 257 | +\vspace{-5pt} |
| 258 | +\textbf{\fontsize{44}{44}\selectfont \textbf{Uso de Pipe}}\vspace{-13pt} |
| 259 | +\vspace{13pt} |
| 260 | +\begin{lstlisting} |
| 261 | + qgisprocess proporciona una función |
| 262 | + llamada qgis_run_algorithm_p() que |
| 263 | + integra de mejor forma el uso de pipelines. |
| 264 | +\end{lstlisting} |
| 265 | +\end{minipage} |
| 266 | +\begin{lstlisting}[style=Rstyle] |
| 267 | + # Cálculo de buffer |
| 268 | + > library(sf) |
| 269 | + > system.file( |
| 270 | + 'longlake/longlake_depth.gpkg', |
| 271 | + package = 'qgisprocess' |
| 272 | + ) |> |
| 273 | + qgis_run_algorithm_p( |
| 274 | + algorithm = 'native:buffer', |
| 275 | + DISTANCE = 100 |
| 276 | + ) |> st_as_sf( ) |> |
| 277 | + plot( ) |
| 278 | +\end{lstlisting} |
| 279 | + |
| 280 | +% Workflow % |
| 281 | +\begin{minipage}{\linewidth} |
| 282 | + \vspace{12pt} |
| 283 | + \textbf{\fontsize{44}{44}\selectfont \textbf{Flujo de trabajo}}\vspace{8pt}\\ |
| 284 | +\end{minipage} |
| 285 | +\begin{tikzpicture} |
| 286 | + \node[mybox,text width=11.5cm] (box) |
| 287 | + {\\ |
| 288 | +\begin{lstlisting}[breaklines=true,style=Rstyle] |
| 289 | +# Creación de un hexagrid de 400x400 |
| 290 | +> library(sf) |
| 291 | +> grid_fun <- qgis_function('native:creategrid') |
| 292 | +> grid_fun( |
| 293 | + TYPE = 4, |
| 294 | + EXTENT = c('409967, 411658, 5083354, 5084777'), |
| 295 | + HSPACING = 400, |
| 296 | + VSPACING = 400, |
| 297 | + CRS = 'EPSG:26920', |
| 298 | + OUTPUT = 'grid' |
| 299 | + ) |> st_as_sf() |> |
| 300 | + select(id) |> |
| 301 | + plot() |
| 302 | +\end{lstlisting} |
| 303 | + }; |
| 304 | +\node[fancytitle, right=0pt, yshift=6pt] at (box.north west) {Vector data}; |
| 305 | +\end{tikzpicture} |
| 306 | +\begin{tikzpicture} |
| 307 | +\node[mybox,text width=11.5cm] (box) |
| 308 | +{ |
| 309 | +\begin{lstlisting}[breaklines=true,style=Rstyle] |
| 310 | + # Cálculo del TWI |
| 311 | + > library(stars) |
| 312 | + > dem <- read_stars( |
| 313 | + system.file( |
| 314 | + 'raster/nz_elev.tif', |
| 315 | + package = 'spDataLarge') |
| 316 | + ) |
| 317 | + > qgis_run_algorithm( |
| 318 | + algorithm ='sagang:sagawetnessindex', |
| 319 | + DEM = dem, |
| 320 | + TPI = 'tpi.sdat') |> |
| 321 | + qgis_extract_output('TWI') |> |
| 322 | + st_as_stars() |> |
| 323 | + plot(col = cptcity::cpt(pal = 'ocal_blues')) |
| 324 | +\end{lstlisting} |
| 325 | +}; |
| 326 | +\node[fancytitle, right=0pt,yshift=6pt] at (box.north west) {Raster data}; |
| 327 | +\end{tikzpicture} |
| 328 | +\end{multicols*} |
| 329 | +\end{document} |
0 commit comments