From 5932575a0d65ba231d0427ca263e41ddb2e18614 Mon Sep 17 00:00:00 2001 From: Laura DeCicco Date: Tue, 7 Jul 2026 14:25:42 -0500 Subject: [PATCH] Revert "fix: don't request `id` as a property (omit it) for id/geometry-only OGC calls" --- R/get_ogc_data.R | 11 +++-------- tests/testthat/tests_general.R | 32 -------------------------------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/R/get_ogc_data.R b/R/get_ogc_data.R index d78519fd6..89ebb6306 100644 --- a/R/get_ogc_data.R +++ b/R/get_ogc_data.R @@ -171,14 +171,9 @@ switch_properties_id <- function(properties, id) { } if (length(properties) == 0) { - # If a user requested only id and/or geometry, properties is now empty. - # The feature "id" always comes back (and geometry is handled by - # skipGeometry), so omit the properties filter entirely rather than - # requesting "id": several collections (e.g. daily, continuous) now - # reject "id" as a selectable property, and it also fails the - # available-properties check below. rejigger_cols() still subsets the - # result to the requested id column. - properties <- NA_character_ + # If a user requested only id and/or geometry, properties would now be empty + # geometry is taken care of with skipGeometry + properties <- "id" } } diff --git a/tests/testthat/tests_general.R b/tests/testthat/tests_general.R index f0830ffa9..25d272e57 100644 --- a/tests/testthat/tests_general.R +++ b/tests/testthat/tests_general.R @@ -648,35 +648,3 @@ test_that("format_dates", { "2025-10-01/2026-02-02" ) }) - -test_that("switch_properties_id drops id and geometry from the wire properties", { - # The feature "id" always comes back (renamed to the service id - # downstream) and several collections (e.g. daily, continuous) now reject - # "id" as a selectable property, so it must never be sent. A request for - # only id and/or geometry must omit the properties filter (NA), not fall - # back to "id". - expect_true(all(is.na( - dataRetrieval:::switch_properties_id("daily_id", id = "daily_id") - ))) - expect_true(all(is.na( - dataRetrieval:::switch_properties_id("id", id = "daily_id") - ))) - expect_true(all(is.na( - dataRetrieval:::switch_properties_id(c("daily_id", "geometry"), id = "daily_id") - ))) - - # Mixed requests: the id alias and geometry are dropped, real properties kept. - expect_equal( - dataRetrieval:::switch_properties_id(c("daily_id", "value"), id = "daily_id"), - "value" - ) - expect_equal( - dataRetrieval:::switch_properties_id(c("id", "value", "geometry"), id = "daily_id"), - "value" - ) - - # No properties requested -> unchanged (NA passes through). - expect_true(all(is.na( - dataRetrieval:::switch_properties_id(NA, id = "daily_id") - ))) -})