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

reported crash in dependency package #62

Closed
SymbolixAU opened this issue Jan 17, 2019 · 2 comments
Closed

reported crash in dependency package #62

SymbolixAU opened this issue Jan 17, 2019 · 2 comments
Assignees
Milestone

Comments

@SymbolixAU
Copy link
Owner

@SymbolixAU SymbolixAU commented Jan 17, 2019

ATFutures/geoplumber#57

This crashes

library(geoplumber)
uol <- rbind(uni_point, uni_poly)

This doesn't

library(sf) ## for subsetting
geojsonsf::sf_geojson( uol[1, "name"] )
geojsonsf::sf_geojson( uol[2, "name"] )
geojsonsf::sf_geojson( uni_point )
geojsonsf::sf_geojson( uni_poly )

Seems to be when all factor levels are the same

library(sf)
pt1 <- sf::st_point(c(0,0))
pt2 <- sf::st_point(c(1,1))

sfc <- sf::st_sfc( list(pt1, pt2) )
sf <- sf::st_sf( geometry = sfc )

sf$id <- factor(1)

This doesn't seem to be in jsonify; these are fine:

df <- data.frame(id = 1:2, val = c("a","a"))
jsonify::to_json( df )
jsonify::to_json( uol )
@SymbolixAU SymbolixAU self-assigned this Jan 17, 2019
@SymbolixAU SymbolixAU added this to the v1.3 milestone Jan 17, 2019
SymbolixAU added a commit to SymbolixAU/jsonify that referenced this issue Jan 17, 2019
SymbolixAU added a commit that referenced this issue Jan 17, 2019
SymbolixAU added a commit to SymbolixAU/jsonify that referenced this issue Jan 17, 2019
@SymbolixAU
Copy link
Owner Author

@SymbolixAU SymbolixAU commented Jan 24, 2019

not closing until I know the reason it wasn't happening directly in jsonify

@SymbolixAU
Copy link
Owner Author

@SymbolixAU SymbolixAU commented Jan 24, 2019

reason:

geojsonsf enters through

jsonify::writers::simple::write_value( writer, this_vec, i, -1, false, factors_as_string  );

But there was only one 'level', but it was asking to subset by more than one row, so it was getting a subset error, hence the crash.

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

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.