Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish_layer() fails with mapply error #184

Closed
mmachir opened this issue Apr 19, 2024 · 5 comments · Fixed by R-ArcGIS/arcgisutils#48
Closed

publish_layer() fails with mapply error #184

mmachir opened this issue Apr 19, 2024 · 5 comments · Fixed by R-ArcGIS/arcgisutils#48

Comments

@mmachir
Copy link
Collaborator

mmachir commented Apr 19, 2024

Describe the bug
Publishing a hosted feature layer using publish_layer() is failing currently.

To Reproduce

library(arcgis)
#> Attaching core arcgis packages:
#> → arcgisutils v0.2.0.9000
#> → arcgislayers v0.2.0
set_arc_token(auth_user())
nc <- sf::read_sf(system.file("shape/nc.shp", package = "sf"))
res <- publish_layer(nc, "NorthCarolinaSIDS_test1")
#> Warning in mapply(function(.x, .y) c(list(attributes = c(.y)), geometry =
#> list(.x)), : longer argument not a multiple of length of shorter

Created on 2024-04-19 with reprex v2.1.0

Expected behavior
Publishing should succeed with the valid input data (nc.shp).

Additional context
N/A

@JosiahParry
Copy link
Collaborator

This work is being done in https://github.com/JosiahParry/serde_esri/tree/geom

It's almostttt done. I'll need to figure out how to get this into arcgisutils though. I'm torn between two options:

  • put Rust code inside of arcgisutils and remove C code
  • create another small utility package for json much like arcpbf but here it could be esrijson or something and importing it into arcgisutils

@elipousson this will affect you. Do you have a stance?

@JosiahParry
Copy link
Collaborator

JosiahParry commented Apr 30, 2024

The work being done in serde_esri can also be used to create arrays of features, individual geometries, as well as parse esri json more cleanly.

I think it might be worth the effort to migrate it all to using serde_esri. Most of the scaffolding is there.

What is not:

  • creating feature sets with M or ZM
  • parsing json similarly to arcpbf::resps_body_pbf()

This also means that all functions will create the json string directly and not create a list object. So this means all as_geometry(), as_features() and as_featureset() will have to be deprecated.

But the benefit is that we know the geometries will be correct. If you need the list types we can -> create the string -> parse the string

@JosiahParry
Copy link
Collaborator

This is probably also the same time to fix validate_crs() I think. Hm.

@elipousson
Copy link
Contributor

I haven't built anything on top of the lower-level functions directly so, unless there are some possible consequences that I'm not thinking of, I'm somewhat agnostic on the solution.

It all sounds promising though! Happy to help test when it is ready.

@JosiahParry
Copy link
Collaborator

JosiahParry commented May 1, 2024

This is drafted in R-ArcGIS/arcgisutils#48.
There's still a bit of documentation and testing to get written. But I've been able to publish a MULTIPOLYGON and mapviewer recognizes the geometries which is a huge win.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants