-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
398 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: vapour | ||
Title: Access to the 'Geospatial Data Abstraction Library' ('GDAL') | ||
Version: 0.10.0 | ||
Version: 0.10.9001 | ||
Authors@R: c(person("Michael", "Sumner", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-2471-7511")), | ||
person("Simon", "Wotherspoon", role = "ctb", comment = "RasterIO configuration for resampling options"), | ||
person("Mark", "Padgham", role = "ctb", comment = "helped get started :)"), | ||
|
@@ -27,8 +27,10 @@ LazyData: true | |
LinkingTo: Rcpp | ||
Imports: | ||
jsonlite, | ||
nanoarrow, | ||
Rcpp, | ||
utils | ||
utils, | ||
wk | ||
RoxygenNote: 7.3.1 | ||
Roxygen: list(markdown = TRUE) | ||
Suggests: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,52 @@ | ||
# gdal_ptrs <- function(dsource, layer) { | ||
# layer <- if (missing(layer)) { | ||
# character() | ||
# } else { | ||
# enc2utf8(layer) | ||
# } | ||
# #gdal_ptrs_cpp(dsource, layer) | ||
# } | ||
# | ||
# gdal_vector_data <- function(dsource, layer, ..., sql = NA, options = NULL, quiet = FALSE, | ||
# fid_column_name = character(0), | ||
# if_drivers = character(0), | ||
# extent = NA, | ||
# optional = FALSE, return_stream = FALSE) { | ||
# | ||
# ## vapourize this | ||
# layer <- if (missing(layer)) { | ||
# character() | ||
# } else { | ||
# enc2utf8(layer) | ||
# } | ||
# if (nchar(dsource) < 1L) { | ||
# stop("`dsour` must describe a valid source description for GDAL (input was an empty string).", call. = FALSE) | ||
# } | ||
# dsn_exists <- file.exists(dsource) | ||
# | ||
# if (length(dsource) == 1 && dsn_exists) { | ||
# dsource <- enc2utf8(normalizePath(dsource)) | ||
# } | ||
# | ||
# | ||
# stream <- nanoarrow::nanoarrow_allocate_array_stream() | ||
# | ||
# # | ||
# # info <- gdal_dsn_read_vector_stream(stream, | ||
# # dsource, layer, sql, as.character(options), quiet, | ||
# # if_drivers, extent, dsn_exists, fid_column_name, 80L) | ||
# # | ||
# # | ||
# | ||
# # geometry_column <- unlist(lapply( | ||
# # stream$get_schema()$children, function(s) identical(s$metadata[["ARROW:extension:name"]], "ogc.wkb") | ||
# # )) | ||
# crs <- info[[1L]] | ||
# if (info[[2L]] == -1) { | ||
# num_features = NULL | ||
# } | ||
# | ||
# # df = suppressWarnings(nanoarrow::convert_array_stream(x$stream, x$num_features)) | ||
# #list(stream = stream, crs = crs, num_features = num_features) | ||
# d <- nanoarrow::convert_array_stream(stream, num_features) | ||
# #d$wkb_geometry <- wk::wkb(d$wkb_geometry, crs = crs) | ||
# d | ||
# } | ||
# | ||
# | ||
# | ||
gdal_ptrs <- function(dsource, layer) { | ||
layer <- if (missing(layer)) { | ||
character() | ||
} else { | ||
enc2utf8(layer) | ||
} | ||
#gdal_ptrs_cpp(dsource, layer) | ||
} | ||
|
||
gdal_vector_data <- function(dsource, layer, ..., sql = NA, options = NULL, quiet = FALSE, | ||
fid_column_name = character(0), | ||
if_drivers = character(0), | ||
extent = NA, | ||
optional = FALSE, return_stream = FALSE) { | ||
|
||
## vapourize this | ||
layer <- if (missing(layer)) { | ||
character() | ||
} else { | ||
enc2utf8(layer) | ||
} | ||
if (nchar(dsource) < 1L) { | ||
stop("`dsour` must describe a valid source description for GDAL (input was an empty string).", call. = FALSE) | ||
} | ||
dsn_exists <- file.exists(dsource) | ||
|
||
if (length(dsource) == 1 && dsn_exists) { | ||
dsource <- enc2utf8(normalizePath(dsource)) | ||
} | ||
|
||
|
||
stream <- nanoarrow::nanoarrow_allocate_array_stream() | ||
|
||
info <- gdal_dsn_read_vector_stream(stream, | ||
dsource, layer, sql, as.character(options), quiet, | ||
if_drivers, extent, dsn_exists, fid_column_name, 80L) | ||
|
||
if (return_stream) return(structure(list(stream), crs = info[[1]], num_features = info[[2]])) | ||
# | ||
crs <- info[[1L]] | ||
if (info[[2L]] == -1) { | ||
num_features = NULL | ||
} | ||
|
||
|
||
d <- nanoarrow::convert_array_stream(stream, num_features) | ||
d$wkb_geometry <- wk::wkb(d$wkb_geometry, crs = crs) | ||
d | ||
} | ||
|
||
|
||
|
Oops, something went wrong.