
Explore spatial data analysis in R through theory, importing and exporting data, coordinate reference systems assignment and transformation, spatial predicates, raster operations, and building maps and web maps.
Install R, Rtools, and RStudio on Windows, choose the correct downloads, and complete the default setup to enable your spatial data analysis workflow.
Unzip course files, open the R project, and explore the OData, resources, and scripts folders while installing and loading key spatial packages (sf, terra, raster) to prepare maps across sections.
Outline the course structure and distinguish spatial data from non-spatial data. Introduce geometry types—points, lines, polygons—and the simple features vector data used in AR, then practical exercises.
Differentiate spatial data from non-spatial data by examining geographical location, then explore vectorial data types: points, lines, polygons, and raster data grids with examples like ndvi and climate maps.
Learn the seven core geometry types in vectorial data—points, multipoints, linestrings, multi-line strings, polygons, multi polygons, and geometry collections—defined by coordinates, including rings and holes.
Explore simple features in R using the SF package, including the simple feature geometry list column, multi polygon geometries, attributes, bounding boxes, and the spatial reference system and proj string.
Explore spatial data analysis in R using the sf package, perform tidyverse-based EDA, convert non-spatial data to spatial, and import/export vector data, coordinates, and bounding boxes.
Download spatial data in R using geodata and sf. Explore GBIF Cerambyx cerdo occurrences and filters such as continent and country codes.
Explore a dataset by inspecting its structure with glimpse, select key variables, and summarize continental and country distributions using table formats and percent formatting in R.
Perform time-based exploratory data analysis in R by converting dates, extracting year and month, grouping by year, and visualizing trends with ggplot, while filtering to Europe and top countries.
Convert a data frame to a simple features spatial object using st_as_sf, specifying longitude and latitude columns and a coordinate reference system, yielding an sf object with point geometries.
Explore vectorial data formats, from Esri shape files (SHP) with DBF attributes and optional CRS, to the Geopackage, a single sqlite-based spatial database for vector and raster data.
export shapefiles from R by writing vector data with sf objects, manage the DSN path, and compare append versus overwrite behavior between two export functions.
Import shapefiles into R using two equivalent functions, setting the data source name and comparing a data frame output with a table output, including import feedback.
export a geopackage, create multiple layers within the database, and read a specific layer using the layer argument; compare file sizes with shapefiles and explore geojson as an alternative.
Explore exploratory data analysis in R by plotting with base plot and sf objects, inspect Cerambyx cerdo, and visualize geometry with ggplot2 and geom_sf.
Learn how simple features behave as tidy data, with columns as variables and rows as observations. Practice mutating, grouping, summarizing, and plotting using tidyverse tools on sf objects.
Extract the bounding box from an SF object with st_bbox, obtaining x mean, y mean, x max, and y max; plot in ggplot as the rectangle that wraps all points.
Extract coordinates and the attributes table from a simple feature object, convert to table or data frame, and create longitude and latitude columns with mutate using st_coordinates.
Extract geometry types in R with the st_geometry_type function on a simple feature, yielding per-observation types (point, line, etc.) and a single type when geometry = false.
Explore coordinates z and m in R, where z denotes altitude and m denotes a measure, and learn to remove them with st_zm for software compatibility.
Review converting non-spatial data to sf objects, exporting vector data to shapefile and geopackage, reading back, handling 3d coordinates, and plotting with geomsf while extracting bounding box and geometry types.
Explore the first challenge by loading geospatial data in R with geodata, tidyverse, and sf; filter wolves to Spain, convert to simple features, and export to a geopackage.
Load packages, download wolf and bear occurrences filtered to Spain, convert to simple features with CRS 4326, and export to geopackage while visualizing with ggplot2.
Explore coordinate reference systems, including geographic and projected coordinates, georeferencing, and CRS types; learn common projections and codifications like EPSG codes, Proj4 string, and well-known text, with RStudio.
Define a coordinate reference system as an earth-based model with a geodetic datum that uses coordinates to locate points unequivocally and georeference geographic coordinates to the earth.
Explore how geographic coordinate systems use angular degrees on a spherical model, while projected coordinate systems convert to 2D meters, enabling maps but introducing shape, area, and distance distortions.
Explore the Universal Transverse Mercator projected coordinate system, a world grid of 60 zones and 20 bands, with easting, northing, central 500,000, and hemisphere-dependent northing.
Explore projections that transform a three-dimensional angular system to a two-dimensional map. Learn planar, conic, and cylindric types, their directions, and names like Mercator and Gall-Peters.
Explore codifications for coordinate reference systems, including well-known text, Proj4 string, and Spatial Reference System Identifier, and see EPSG codes, datum, spheroid, and units define projected and geographic coordinate systems.
Explore codifications for geometries, including well known text and well known binary, and learn how these machine readable formats differ from coordinate reference system metadata.
Explore how to look up a coordinate reference system, such as epsg 25832, view geodesic and projected boundaries, inspect formats (html, json, gml), and explore scope in europe.
Explore coordinate reference systems for spatial data and simple features, download a europe map, and transform between crs with Proj4. Visualize data in different crs and build your web map.
Explore coordinate reference systems for a simple features dataset in R by inspecting st_crs, extracting epsg codes, and accessing well-known text representations and CRS elements.
Transform coordinate reference systems with st_transform, download europe geospatial data via eurostat, and convert from epsg 4326 to 3035, observing units switch from degrees to meters.
Compare Europe visualizations across different coordinate reference systems using ggplot2 and geom_sf, highlighting the impact of units, datums, and epsg settings on map shapes and axes, with patchwork grids.
Transform coordinate reference systems with Proj4 in R using st_transform, exploring EPSG codes, a Proj4 string, or WKT objects, and visualizing Europe Robinson and MacArthur projections with ggplot.
Use on-the-fly crs transformation in ggplot with sf objects to plot coordinates without changing the original data. Transform to crs 3035 and view axes in meters using proj4 options.
Assign a coordinate reference system to a shapefile in R using st_set_crs. Understand that applying the wrong crs distorts plots and blocks transformations.
Explore key spatial data operations in R: obtain CRS with st_crs, list parameters, transform with st_transform, use coord_sf for on-the-fly changes, assign CRS with st_set_crs, and visualize with mapview.
Load and transform spatial data with tidyverse, sf, and eurostat. Visualize a two-layer map of Spain with Camino de Santiago using ggplot2 and geomsf.
Explore the solution to challenge 02 by loading and transforming a geospatial Camino Frances layer, projecting to 4326, and creating interactive maps with ggplot and map view.
Explore geometry operations in R, from predicates for spatial filtering and joins to measurements of lines and areas, and unary and binary transformations of simple feature geometries, with practice exercises.
Explore spatial predicates in R, including contains, within, covers, covered by, crosses, touches, disjoint, intersects, and overlaps, and apply them to spatial filters and joins.
Explore the SPH package's three measures: SST length for lines, SST area for polygons, and SST distance for geometry pairs, including point-to-polygon distances.
Apply unary transformations to each geometry, including centroid, buffer, converting invalid geometries to valid, simplifying geometries, and generating Voronoi polygons and Delaunay triangulation.
Learn how binary transformations operate on polygons x and y, using st_intersection, st_union, st_difference, st_symmetric_difference, and st_crop with bounding-box cropping.
Practice predicate functions for counting, spatial filters, and spatial unions. Calculate area and length; apply centroid, buffer; intersection, crop; expand map view; download Spanish map with Map Spain; tackle exercises.
Load bear data and national parks, Camino de Santiago, and Spanish municipalities with sf and Terra, set crs 25830, transform to WGS84, remove theta coordinate, and clean geometries.
Use predicates to count bear observations by municipality in Spain, computing bear intersections with municipalities using st intercepts, and label results by municipality name to reveal 53 observations in Somiedo.
Explore spatial filtering with predicates in R, comparing classic dplyr filters to sf spatial filters. Visualize municipalities intersecting Sierra de las Nieves and learn st_intersects usage.
Explore spatial filters II by using the street touches predicate on an sf object to identify municipalities that border another, visualize with map view and customize popups to show names.
Learn to perform a spatial join in R with st_join using st_intersects to attach bear observations to Spanish municipalities, then summarize by municipality and filter for counts over ten.
Learn to calculate lengths in spatial data with sf in R: compute stage lengths, convert to kilometers, and sum the Camino Francés total length (968 km) using mutate and st_length.
Calculate polygon areas in R with st_area, convert units to square kilometers, filter to Lugo province, and use slice_max to identify the five largest municipalities.
Learn to calculate distances between spatial features in R using street distance, convert matrix outputs to vectors with as.numeric, set units to kilometers, and visualize Camino Quiroga stages in Mapview.
Apply unary transformations to compute the centroid of each of Spain's 19 autonomous communities, then visualize the centroids with ggplot in R.
Apply the buffer unary transformation to the Sierra Nevada national park to create a five-kilometer radius, then identify intersecting municipalities by filtering with intersects and visualize with map view.
Make invalid geometries valid using st_make_valid, guided by st_is_valid checks and the valid_sf workflow. See how polygons become multipolygons and how topology errors, like self-intersection, block operations such as st_difference.
Apply unary transformations to simplify polygons by using st_is_simple and st_simplify, compare simple and invalid geometries with ggplot visuals and patchwork.
learn to create voronoi polygons around centroids in R using st_centroid and st_voronoi, address crs issues with st_transform to utm 25830, and visualize results with ggplot2.
Learn to perform Delaunay triangulation on the centroids of Spain's autonomous communities by transforming to projected coordinates, creating a multipoint, and visualizing the resulting triangles.
This lecture demonstrates intersection and crop transformations on bear occurrences in Asturias, including CRS transformation to the BR PSF geodetic system and comparing the resulting outputs.
Compute the difference between a 5 km buffer around Sierra de las Nieves and the park polygon to isolate the outer area, using binary transformations and map visualization.
Master the symmetric difference in spatial data analysis with R, and extract Natura 2000 areas in Cantabria using st transform, st filter, and intersects.
Explore using the Terra package to convert simple features to sparse vectors, apply symmetric difference with simdiff, and visualize vector-based spatial differences.
Compare st_combine and st_union when merging geometries and observe how borders and duplicates are treated. Cast multi-point results back to individual points to recover the original 860 features.
Explore union and dissolve of geometries by combining two objects, Asturias and Galicia, aligning CRS with st_transform, applying st_union, and converting to sf when needed.
Dissolve Spanish municipalities by province to create a single boundary per province, using group by and summarize to compute total area and cast to multipolygon, noting holes from missing municipalities.
Explore core geospatial analysis in R with layers, intersects, and spatial predicates, using terra equivalents for filters, length, area, distance, centroid, and Voronoi and Delaunay triangulation.
Tackle challenge 03 by loading spatial data in R, executing adjacent plots and Cerambyx datasets in Spain and Germany, calculating river length, and plotting results.
Explore solving challenge 03 by loading spatial data layers in R, including the rivers of Spain, Europe map, and features for Germany, then extract ceramics year and cadastral references.
Apply spatial filters with sf to find adjacent plots, filter Cerambyx cerdo in Germany, and rivers crossing Madrid, then visualize results and add nuts name via spatial join.
Perform river length calculations, deduplicate by river name, and summarize in R, then build plot centers and buffers for interactive maps, leading to Cerambyx cerdo analysis and raster data prep.
Welcome to my Spatial Data Analysis in R course!
This course is designed for beginners and intermediate-level individuals who want to delve into the fascinating world of spatial data analysis using the R programming language. We will focus on the latest packages and practices for working with real-world spatial data.
Course Content:
Section 01: Introduction to Spatial Data
Get to know the essential fundamentals of spatial data analysis.
Learn to handle spatial data in R.
Section 02: Coordinate Reference Systems
Explore coordinate reference systems and their importance in spatial analysis.
Section 03: Geometric Operations
Learn to perform key operations with geometries, including spatial filters, spatial joins, spatial predicates, and transformations like centroids and buffers.
Section 04: Raster Data
Learn what raster data is and the most common tasks with this type of data.
This section includes a brief introduction to remote sensing.
Section 05: Maps with ggplot2
Master the creation of amazing maps using ggplot2. Unify your prior skills to effectively visualize spatial data.
Section 06: Web Maps
Take your visualizations to the next level by creating interactive web maps with mapview and leaflet extensions, including synchronized maps.
Course Details:
Duration: Approximately 14 hours and 30 minutes.
Lessons: Over 150 lessons that will guide you from basics to advanced techniques in spatial data analysis in R.
Teaching Mode:
Theory and Theory Quizzes
Guided Practices
Proposed Exercises with Solutions
This course is intensive, starting from the basics and taking you to acquire advanced skills in spatial data analysis and visualization. Upon completion, you will not only be an intermediate user but an expert with solid knowledge in the exciting field of spatial analysis.
I invite you to join me and explore the power of R in spatial data analysis!
Hope to see you in class!