From e9500a0b0503756e2a5391a4ba32320487f0b5d0 Mon Sep 17 00:00:00 2001 From: Josiah Parry Date: Thu, 21 Nov 2024 10:42:04 -0800 Subject: [PATCH] if NULL crs return NA --- DESCRIPTION | 2 +- NAMESPACE | 1 + NEWS.md | 1 + R/post-process.R | 3 ++- man/arcpbf-package.Rd | 23 +++++++++++++++++++++++ man/httr2.Rd | 5 +++-- 6 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 man/arcpbf-package.Rd diff --git a/DESCRIPTION b/DESCRIPTION index ce984a8..7edaf7c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -12,7 +12,7 @@ BugReports: https://github.com/R-ArcGIS/arcpbf/issues Encoding: UTF-8 Language: en Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Config/rextendr/version: 0.3.1.9000 SystemRequirements: Cargo (Rust's package manager), rustc >= 1.70 Suggests: diff --git a/NAMESPACE b/NAMESPACE index 797bb48..23e5f71 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -6,4 +6,5 @@ export(process_pbf) export(read_pbf) export(resp_body_pbf) export(resps_data_pbf) +importFrom(rlang,"%||%") useDynLib(arcpbf, .registration = TRUE) diff --git a/NEWS.md b/NEWS.md index 94eeddb..acd6a75 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # arcpbf (development version) +* Handles missing CRS and closes h/t @elipousson for reporting * Returns warning message when `esriFieldBlob` is encountered * Fixes bug where an error occured when a query returned no rows diff --git a/R/post-process.R b/R/post-process.R index 661a9d9..d60b7e0 100644 --- a/R/post-process.R +++ b/R/post-process.R @@ -96,8 +96,9 @@ post_process_list <- function(x, use_sf) { # helper function to determine which component of the spatialReference needs # to be passed to sf::st_crs() to create the spatial reference object +#' @importFrom rlang %||% crs <- function(sr) { possible_crs <- sr[c("latest_wkid", "wkid", "wkt")] valid_crs_idx <- which(!is.na(possible_crs))[1] - possible_crs[[valid_crs_idx]] + possible_crs[[valid_crs_idx]] %||% NA } diff --git a/man/arcpbf-package.Rd b/man/arcpbf-package.Rd new file mode 100644 index 0000000..07a8787 --- /dev/null +++ b/man/arcpbf-package.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/extendr-wrappers.R +\docType{package} +\name{arcpbf-package} +\alias{arcpbf} +\alias{arcpbf-package} +\title{arcpbf: Process ArcGIS Protocol Buffer FeatureCollections} +\description{ +Fast processing of ArcGIS FeatureCollection protocol buffers in R. It is designed to work seamlessly with 'httr2' and integrates with 'sf'. +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://r.esri.com/arcpbf/} + \item \url{https://github.com/R-ArcGIS/arcpbf} + \item Report bugs at \url{https://github.com/R-ArcGIS/arcpbf/issues} +} + +} +\author{ +\strong{Maintainer}: Josiah Parry \email{josiah.parry@gmail.com} (\href{https://orcid.org/0000-0001-9910-865X}{ORCID}) + +} diff --git a/man/httr2.Rd b/man/httr2.Rd index 835e894..d48c36c 100644 --- a/man/httr2.Rd +++ b/man/httr2.Rd @@ -10,7 +10,7 @@ resp_body_pbf(resp, post_process = TRUE, use_sf = TRUE) resps_data_pbf(resps, post_process = TRUE, use_sf = TRUE) } \arguments{ -\item{resp}{A response object.} +\item{resp}{A httr2 \link[httr2]{response} object, created by \code{\link[httr2:req_perform]{req_perform()}}.} \item{post_process}{default \code{TRUE}. Apply \code{post_process_pbf()} to the pbf body.} @@ -57,7 +57,8 @@ if (rlang::is_installed(c("httr2", "sf")) && interactive()) { "https://services.arcgis.com/P3ePLMYs2RVChkJx", "arcgis", "rest", "services", "ACS_Population_by_Race_and_Hispanic_Origin_Boundaries", - "FeatureServer", "2", "query", fsep = "/" + "FeatureServer", "2", "query", + fsep = "/" ) # create the base request