DIFM-Brain / ofpetrial

GNU General Public License v3.0
0 stars 1 forks source link

geojson format for website #11

Closed brittanikedge closed 4 months ago

brittanikedge commented 5 months ago

DIFM website database uses geojsons

Two options: 1) We add an option to write_trial_files to handle allow saving as geojson and 2) I save them as geojsons within the R script for the website.

brittanikedge commented 5 months ago

@tmieno2 I was thinking about this problem last night. Any thoughts? We wouldn't need another package as st_write enables .geojson extension. I imagine that .shp should be the default since that is the most common use case.

tmieno2 commented 5 months ago

I think it is fine to have st_write to have geojson option as well, but with shp the default obviously as you suggested.

brittanikedge commented 5 months ago

Okay, then I will put that on my list of things to implement today. It's quick, so it might be the first item.

brittanikedge commented 5 months ago

@tmieno2 Did you test writing the files from that example? I am getting an error when I write to shapefile because of the linestring that was in the original boundary and now is in the trial design.

There is no error with the geojson driver, only shapefile.

Screenshot 2024-04-11 at 2 27 17 PM
brittanikedge commented 5 months ago

I finished the edits to the write_trial_files(). I had to make modifications to the code because geojson doesn't support the append argument in st_write. Instead, I had to use unlink() instead to delete a previously created file. Let me know if there is another method you would prefer.

brittanikedge commented 5 months ago

I tested this with other examples and had no errors for geojson or shapefiles. I pushed the edits and opened a new issue for the other problem.