Repository navigation
Replace geoarrow with sfarrow - #1116
wrridgeway wants to merge 9 commits into
Conversation
| # rJava's LD_LIBRARY_PATH from .Renviron isn't picked up by the dynamic | ||
| # linker in time, so preload libjvm.so by absolute path first. | ||
| dyn.load("/usr/lib/jvm/java-21-openjdk-amd64/lib/server/libjvm.so") | ||
| # tabulizer/RJavaTools reflects into JDK internals (e.g. java.util | ||
| # iterators), which Java 16+'s module system denies by default (JEP 396). | ||
| # Must be set before the JVM starts, i.e. before library(rJava). | ||
| options(java.parameters = c( | ||
| "--add-opens=java.base/java.util=ALL-UNNAMED", | ||
| "--add-opens=java.base/java.lang=ALL-UNNAMED" | ||
| )) |
There was a problem hiding this comment.
I know you're iffy about this, but I tried tabulapdf and ran into the same exact issue. The good news is that this is one small file that we should never need to rebuild, not something we have to do on a yearly basis. If you'd like, we could open a new PR to try and figure out some other solution that moves away from tabulizer and tabulapdf. I'd prefer not to get bogged down in fixing this problem in this PR.
There was a problem hiding this comment.
Makes sense, I opened #1119 to track the effort to simplify this. I'll dig into it in November if I can find the time.
| esri_chicago_geojson <- here(footprint_tmp_dir, "chicago-2008.geojson") | ||
| esri_chicago_remote_raw <- file.path( | ||
| input_bucket, "esri", "chicago-2008.parquet" | ||
| input_bucket, "esri", "chicago-2008.geojson" |
There was a problem hiding this comment.
These files were incorrectly specified.
There was a problem hiding this comment.
I'm am leaving the big changes from #1100 for another PR.
| parcels <- sfarrow::read_sf_dataset(arrow::open_dataset( | ||
| paste0("s3://ccao-data-warehouse-us-east-1/spatial/parcel/year=", year) | ||
| )) | ||
| )) %>% | ||
| select(-geometry) %>% | ||
| rename(geometry = geometry_3435) | ||
|
|
There was a problem hiding this comment.
I'm guessing it's from updating sf, but this script throws a ton of errors when we're dealing with two geometry columns. Since it immediately sets the parcels object to epsg:3435 for processing on line 30 (gone now) I'm just getting rid of the 4326 column right off the bat here. The raw parcel geoparquets are all saved with geometry_3435 as their active geometry column, so they ingest with a crs of epsg:3435 and renaming geometry_3435 means we don't have to edit all the spatial manipulation below.
There was a problem hiding this comment.
We update a number of packages for compatibility with R 4.6.1.
jeancochrane
left a comment
There was a problem hiding this comment.
Thank you for your persistence! I like that this change is much simpler than #1100, even though sfarrow is not actively maintained.
| library(arrow) | ||
| library(ccao) | ||
| library(DBI) | ||
| library(geoarrow) |
There was a problem hiding this comment.
[Question, non-blocking] Do you have any idea why this script doesn't write out files like the rest of the ETL raw scripts do? I assume it's not causing problems but I'm curious.
| # rJava's LD_LIBRARY_PATH from .Renviron isn't picked up by the dynamic | ||
| # linker in time, so preload libjvm.so by absolute path first. | ||
| dyn.load("/usr/lib/jvm/java-21-openjdk-amd64/lib/server/libjvm.so") | ||
| # tabulizer/RJavaTools reflects into JDK internals (e.g. java.util | ||
| # iterators), which Java 16+'s module system denies by default (JEP 396). | ||
| # Must be set before the JVM starts, i.e. before library(rJava). | ||
| options(java.parameters = c( | ||
| "--add-opens=java.base/java.util=ALL-UNNAMED", | ||
| "--add-opens=java.base/java.lang=ALL-UNNAMED" | ||
| )) |
There was a problem hiding this comment.
Makes sense, I opened #1119 to track the effort to simplify this. I'll dig into it in November if I can find the time.
I did significantly less testing for this PR than #1100, but I also made much smaller changes.
sfarrowis not having any issues reading our current geoparquet files and handling them the same asgeoarrowdid as far as I can tell. I did rewrite the parcel geoparquet for 2025 in the dev bucket, as well as the neighborhood geoparquet for 2021. I rebuiltz_de_wridgeway_location.vw_pin10_location_filland reran my testing script and got exactly the same results as in #1110. Script is pasted below. Note, this PR will not make the changes to the parcel files #1100 did that lead to the tax district changes shown below. Those are persisted from rebuilding raw parcel data in that PR and using a different source for attributes.vw_pin10_location_fill
The ultimate test to see if using standard, non-spatial parquet files in athena produces the same spatial results as using geo-parquets made with
geoarrowis to build our location db and check the new version ofvw_pin10_location_fillagainst the old version.