#| output: false
@eval Main using ArchGDAL
@eval Main import GeoInterface as GI
@eval Main function to_linestring(wkts::AbstractVector{<:AbstractString})::String
geoms = ArchGDAL.fromWKT.(wkts)
line = ArchGDAL.createlinestring()
for geom in geoms
n = GI.npoint(geom)
for i in 0:n-1
ArchGDAL.addpoint!(line, ArchGDAL.getx(geom, i), ArchGDAL.gety(geom, i))
end
end
ArchGDAL.toWKT(line)
end
df_plot = @chain df_dv begin
@filter(link_id in ["457307", "409983", "232467"])
@group_by(link_id)
@summarise(
geom_wkt = ~Main.to_linestring(geom_wkt),
count = first(count))
end
This is a subsequent issue to #175. I'm not sure which is the better project for managing (i.e. Tidier or QuartoNotebookRunenr) but I'm noting it here to begin with. I'm running code in a Quarto notebook and rendering it with QuartoNotebookRunner (rather then Jupyter + IJulia). I need to do a bunch of evals into Main scope to get the code to work because QuartoNotebookRunner deliberately runs each notebook in a submodule: Main.Notebook. Is there a better way to do things? I can always revert back to using the DataFrames approach to avoid this but I'd like to use Tidier consistently for all data wrangling in my project if possible.