Skip to content

Error decoding response body when calling near_point() #9

@jjoeldaniel

Description

@jjoeldaniel

Environment

OS: Windows Server 2025
R Version: 4.5.1
arcgisplaces Version: 0.1.2
Kernel: IRkernel 1.3.2

When using the example code

coffee <- near_point(x = -122.334, y = 47.655, search_text = "Coffee")
coffee

I run into the following error:

Error Logs
ERROR while rich displaying an object: Error in dim(rvec) <- dim(x): dims [product 0] do not match the length of object [2]

Traceback:
1. sapply(x, f, simplify = simplify)
2. lapply(X = X, FUN = FUN, ...)
3. FUN(X[[i]], ...)
4. tryCatch(withCallingHandlers({
 .     if (!mime %in% names(repr::mime2repr)) 
 .         stop("No repr_* for mimetype ", mime, " in repr::mime2repr")
 .     rpr <- repr::mime2repr[[mime]](obj)
 .     if (is.null(rpr)) 
 .         return(NULL)
 .     prepare_content(is.raw(rpr), rpr)
 . }, error = error_handler), error = outer_handler)
5. tryCatchList(expr, classes, parentenv, handlers)
6. tryCatchOne(expr, names, parentenv, handlers[[1L]])
7. doTryCatch(return(expr), name, parentenv, handler)
8. withCallingHandlers({
 .     if (!mime %in% names(repr::mime2repr)) 
 .         stop("No repr_* for mimetype ", mime, " in repr::mime2repr")
 .     rpr <- repr::mime2repr[[mime]](obj)
 .     if (is.null(rpr)) 
 .         return(NULL)
 .     prepare_content(is.raw(rpr), rpr)
 . }, error = error_handler)
9. repr::mime2repr[[mime]](obj)
10. repr_text.data.frame(obj)
11. ellip_limit_arr(obj, rows, cols)
12. arr_parts_format(parts)
13. structure(lapply(parts, arr_part_format), omit = attr(parts, 
  .     "omit"))
14. lapply(parts, arr_part_format)
15. FUN(X[[i]], ...)
16. vapply(part, function(col) {
  .     if (is.matrix(col)) 
  .         apply(apply(col, 2L, format), 1L, paste, collapse = ", ")
  .     else format(col)
  . }, character(nrow(part)))
17. FUN(X[[i]], ...)
18. format(col)
19. format.AsIs(col)

str() output:

coffee <- near_point(x = -122.334, y = 47.655, search_text = "Coffee")
str(coffee)

# Classes 'sf' and 'data.frame':	0 obs. of  5 variables:
#  $ place_id  : chr 
#  $ name      : chr 
#  $ distance  : num 
#  $ categories:Classes 'AsIs' and 'data.frame':	0 obs. of  2 variables:
#   ..$ category_id: chr 
#   ..$ label      : chr 
#  $ geometry  :sfc_POINT of length 0 - attr(*, "sf_column")= chr "geometry"
#  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA
#   ..- attr(*, "names")= chr [1:5] "place_id" "name" "distance" "categories" ...

I also tested this on a Linux machine with the following environment details:

OS: Ubuntu 22.04
R Version: 4.5.1
arcgisplaces Version: 0.1.2
Kernel: Ark 0.1.195

coffee <- near_point(x = -122.334, y = 47.655, search_text = "Coffee")
coffee

# error decoding response body
# Simple feature collection with 0 features and 4 fields
# Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
# Geodetic CRS:  WGS 84
# [1] place_id   name       distance   categories geometry  
# <0 rows> (or 0-length row.names)

str(coffee)

# error decoding response body
# Classes ‘sf’ and 'data.frame': 0 obs. of  5 variables:
#  $ place_id  : chr 
#  $ name      : chr 
#  $ distance  : num 
#  $ categories:Classes ‘AsIs’ and 'data.frame': 0 obs. of  2 variables:
#   ..$ category_id: chr 
#   ..$ label      : chr 
#  $ geometry  :sfc_POINT of length 0 - attr(*, "sf_column")= chr "geometry"
#  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA
#   ..- attr(*, "names")= chr [1:5] "place_id" "name" "distance" "categories" ...

sf::st_drop_geometry(coffee)

# error decoding response body
# [1] place_id   name       distance   categories
# <0 rows> (or 0-length row.names)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions