You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All of the previous examples read spatial information from files stored on your hard drive.
410
410
However, GDAL also allows reading data directly from online resources, such as HTTP/HTTPS/FTP web resources.
411
411
The only thing we need to do is to add a `/vsicurl/` prefix before the path to the file.
412
+
This tells GDAL to use its virtual file system for network resources, which uses **HTTP Range requests** to fetch only the specific byte ranges needed for an operation rather than downloading the entire file.
412
413
Let's try it by connecting to the global monthly snow probability at 500-m resolution for the period 2000-2012.
413
414
Snow probability for December is stored as a Cloud Optimized GeoTIFF (COG) file (see Section \@ref(file-formats)) at [zenodo.org](https://zenodo.org/record/5774954/files/clm_snow.prob_esacci.dec_p.90_500m_s0..0cm_2000..2012_v2.0.tif).
414
415
To read an online file, we just need to provide its URL together with the `/vsicurl/` prefix.
#> name : clm_snow.prob_esacci.dec_p.90_500m_s0..0cm_2000..2012_v2.0
429
430
```
430
431
431
432
\index{COG}
432
-
Due to the fact that the input data is COG, we are actually not reading this file to our RAM, but rather creating a connection to it without obtaining any values.
433
-
Its values will be read if we apply any value-based operation (e.g., `crop()` or `extract()`).
433
+
When combined with the `/vsicurl/` prefix, COG files enable highly efficient remote data access.
434
+
Instead of reading the whole file into RAM, GDAL creates a connection that **selectively fetches** only the byte ranges needed for subsequent operations (e.g., `crop()` or `extract()`), making it possible to work with multi-gigabyte files over the internet almost as if they were local.
434
435
This allows us also to just read a tiny portion of the data without downloading the entire file.
435
436
For example, we can get the snow probability for December in Reykjavik (70%) by specifying its coordinates and applying the `extract()` function:
Having created a scenario in which approximately 4000 trips have switched from driving to cycling, we can now model where this updated modeled cycling activity will take place.
#> coord. ref. : ETRS89-extended / LAEA Europe (EPSG:3035)
147
+
#> coord. ref. : ETRS89-extended / LAEA Europe (EPSG:3035)
148
148
#> source(s) : memory
149
-
#> names : pop, women, mean_age, hh_size
150
-
#> min values : 3, 0, 8.5, 1
151
-
#> max values : 24164, 100, 104.4, 144
149
+
#> names : pop, women, mean_age, hh_size
150
+
#> min values : 3, 0, 8.5, 1
151
+
#> max values : 24164, 100, 104.43, 143.88
152
152
```
153
153
154
154
\BeginKnitrBlock{rmdnote}<divclass="rmdnote">Note that we are using an equal-area projection (EPSG:3035; Lambert Equal Area Europe), i.e., a projected CRS\index{CRS!projected} where each grid cell has the same area, here 1000 * 1000 square meters.
<scriptsrc="libs/bs4_book-1.0.0/bs4_book.js"></script><metaname="citation_title" content="Chapter 3 Attribute data operations | Geocomputation with R">
0 commit comments