Visualization of shapefile - Meshes.jl viz! very slow

oscarvdvelde
Mon, 20 May 2024 22:02:14 +0000
Visualization

Hi. I am switching from using a low resolution GeoJSON file of the entire world (size 23 MB), which was used in the example given by GeoMakie, to a higher resolution shapefile of two countries (using Meshes I merged FRA_adm0 and ESP_adm0.shp geometries read by GeoIO, resulting in 7 MB size .shp).

I used to plot the GeoJSON-based data using poly! of GLMakie:

julia> @time p1 = poly!(ax1, countries; color=(:black,0.0), strokewidth = 1.25, overdraw = true)
  0.263541 seconds (108.53 k allocations: 66.155 MiB, 7.19% gc time)

It consistently loads very quickly. However, when I plot the geometry data of the shapefile, I get:

julia> @time p1 = viz!(ax1,countryshp.geometry,segmentsize=0.5,showsegments=true,segmentcolor=:green,alpha=0.0)
  4.659398 seconds (5.39 M allocations: 12.536 GiB, 37.29% gc time, 2.13% compilation time)

and this is the optimistic measurement, because many times it freezes the entire multi-axis plot window for more than 30 seconds. I suppose that is the GC trying to deal with the allocations. It is not even a large shapefile.

Any suggestions? Is it possible to convert this to a format that poly! can handle instead?

22 posts - 3 participants