-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
213 lines (144 loc) · 7.14 KB
/
README.Rmd
File metadata and controls
213 lines (144 loc) · 7.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# dirigible
<!-- badges: start -->
[](https://www.tidyverse.org/lifecycle/#experimental)
<!-- badges: end -->
GDAL headers for R. (A fresh attempt at vapour with a firmer re-use basis).
The underlying `gdalheaders` namespace is now feature complete with the C++ level of the [vapour package](https://CRAN.r-project.org/package=vapour). The main thing to do is establish this namespace
as a headers-only package, then migrate vapour over to use that. To do that we need Windows and MacOS support,
which includes making sure the rwinlib tools/ stuff works and that the metadata files are set up correctly on
package load, and cleaned up with unload.
## Installation
TBD but don't do it this will break your system
## Example
Linux only for now.
```{r example, eval=TRUE, include=TRUE}
library(dirigible)
f <- system.file("extdata/tab/list_locality_postcode_meander_valley.tab", package = "vapour")
l <- "list_locality_postcode_meander_valley"
## name of driver in use
dirigible:::driver_gdal_cpp(f)
## layer feature count
dirigible:::feature_count_gdal_cpp(f, layer = 0, sql = "", ex = 0)
## vector layer names
dirigible:::layer_names_gdal_cpp(f)
## report fields
dirigible:::report_fields_gdal_cpp(f, 0, sql = "")
## report fields
dirigible:::report_fields_gdal_cpp(f, 0,
sql = "SELECT FID, NAME FROM list_locality_postcode_meander_valley")
## read fields
as.data.frame(dirigible:::read_fields_gdal_cpp(f, layer = 0, sql = "", limit_n = 1, skip_n = 0, ex = 0, fid_column_name = character(0)))
## VSI list
u <- "/vsizip//vsicurl/http://dapds00.nci.org.au/thredds/fileServer/rr2/national_geophysical_compilations/http/radmap_v3_2015_filtered_dose/radmap_v3_2015_filtered_dose.ers.zip"
(paths <- dirigible:::vsi_list_gdal_cpp(u))
## sds
sdsfile <- system.file("extdata/gdal/sds.nc", package = "vapour", mustWork = TRUE)
dirigible:::sds_list_gdal_cpp(sdsfile)
## read names
unlist(dirigible:::read_names_gdal_cpp(f,
layer = 0, sql = "",
limit_n = 10,
skip_n = 0, ex = 0))
osm <- system.file("extdata/osm/osm-ways.osm", package = "vapour", mustWork = TRUE)
unlist(dirigible:::read_names_gdal_cpp(osm,
layer = 1, ## layer 1 is 'lines'
sql = "",
limit_n = 0,
skip_n = 0, ex = 0))
dirigible:::read_fields_gdal_cpp(osm, layer = 1, sql = "", limit_n = 0, skip_n = 0, ex = 0, fid_column_name = "")
## read proj info
names(dirigible:::projection_info_gdal_cpp(f, layer = 0, sql = ""))
## read gcp
gcpfile <- system.file("extdata/gcps/volcano_gcp.tif", package = "vapour", mustWork = TRUE)
dirigible:::raster_gcp_gdal_cpp(gcpfile)
## raster info
dirigible:::raster_info_gdal_cpp(gcpfile, FALSE)
dirigible:::raster_info_gdal_cpp(gcpfile, TRUE)$minmax
## an error, but ok
try(dirigible:::raster_info_gdal_cpp(sdsfile, FALSE))
## read raster
sstif <- system.file("extdata", "sst.tif", package = "vapour", mustWork = TRUE)
## a 5*5 window from a 10*10 region
dirigible:::raster_io_gdal_cpp(sstif, window = c(0, 0, 10, 10, 5, 5), band = 1, resample = "nearestneighbour")
dirigible:::raster_io_gdal_cpp(sstif, window = c(0, 0, 10, 10, 5, 5), band = 1, resample = "lanczos")
## overviews
otif <- system.file("extdata", "volcano_overview.tif", package = "vapour", mustWork = TRUE)
matrix(dirigible:::raster_info_gdal_cpp(otif, FALSE)$overviews, ncol = 2, byrow = TRUE)
## there are none
matrix(dirigible:::raster_info_gdal_cpp(sstif, FALSE)$overviews, ncol = 2, byrow = TRUE)
## compression
dirigible:::raster_info_gdal_cpp(otif, FALSE)
## name of driver in use
dirigible:::driver_gdal_cpp(sstif)
# read geometry
str(dirigible:::read_geometry_gdal_cpp(f, layer = 0, sql = "",
what = "geometry",
textformat = "json",
limit_n = 1, skip_n = 0, ex = 0))
str(dirigible:::read_geometry_gdal_cpp(f, layer = 0, sql = "",
what = "text",
textformat = "json",
limit_n = 1, skip_n = 0, ex = 0))
str(dirigible:::read_geometry_gdal_cpp(f, layer = 0, sql = "",
what = "text",
textformat = "wkt",
limit_n = 1, skip_n = 0, ex = 0))
str(dirigible:::read_geometry_gdal_cpp(f, layer = 0, sql = "",
what = "text",
textformat = "gml",
limit_n = 1, skip_n = 0, ex = 0))
## got to be longlat for kml (just fwiw)
f1 <- system.file("gpkg/nc.gpkg", package = "sf")
str(dirigible:::read_geometry_gdal_cpp(f1, layer = 0, sql = "",
what = "text",
textformat = "kml",
limit_n = 1, skip_n = 0, ex = 0))
f <- system.file("extdata/tab/list_locality_postcode_meander_valley.tab", package = "vapour")
dirigible:::geometry_cpp_limit_skip(f, 0, "", 0, "geometry", limit_n = 2, skip_n = 0)
dirigible:::gdal_read_fids_all(f, 0, "", 0)
dirigible:::gdal_read_fids_ij(f, 0, "", 0, c(5, 10))
dirigible:::gdal_read_fids_ij(f, 0, "", 0, c(57, 58))
dirigible:::gdal_read_fids_ia(f, 0, "", 0, c(55:58))
str(bin <- dirigible:::gdal_dsn_read_geom_all(f, 0, "", 0, "geometry"))
str(bin <- dirigible:::gdal_dsn_read_geom_ij(f, 0, "", 0, "geometry", c(1, 3)))
str(bin <- dirigible:::gdal_dsn_read_geom_ij(f, 0, "", 0, "geometry", c(56, 57)))
str(bin <- dirigible:::gdal_dsn_read_geom_ia(f, 0, "", 0, "geometry", c(1, 3)))
str(bin <- dirigible:::gdal_dsn_read_geom_ia(f, 0, "", 0, "geometry", c(50, 57)))
## by FID
str(bin <- dirigible:::gdal_dsn_read_geom_fa(f, 0, "", 0, "geometry", c(58, 1)))
str(bin <- dirigible:::gdal_dsn_read_geom_fa(f, 0, "", 0, "geometry", c(1, 58, 58, 1)))
## read fields
dirigible:::gdal_dsn_read_fields_all(f, 0, "", 0, fid_column_name = character())
dirigible:::gdal_dsn_read_fields_ij(f, 0, "", 0, fid_column_name = character(), 1:2)
dirigible:::gdal_dsn_read_fields_ia(f, 0, "", 0, fid_column_name = character(), c(1, 34, 57))
dirigible:::gdal_dsn_read_fields_fa(f, 0, "", 0, fid_column_name = character(), c(58, 1, 0, 5))
## sys
dirigible:::version_gdal_cpp()
str(dirigible:::drivers_list_gdal_cpp())
dirigible:::proj_to_wkt_gdal_cpp("+proj=laea +datum=WGS84")
## white zone
dirigible:::dirigible_unload_gdal()
try(dirigible:::layer_names_gdal_cpp(f))
dirigible:::dirigible_load_gdal()
dirigible:::layer_names_gdal_cpp(f)
```
### Warping in memory
Very WIP, needs a lot of thought around UX.
See https://github.com/mdsumner/dirigible/issues/4
---
## Code of Conduct
Please note that the dirigible project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.