# PooledArray.PooledVector causing StackOverflowError in GeoStats when using viz/plot, expected?

**URL:** <https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962>\
**Category:** Geo\
**Tags:** geostats\
**Created:** [October 7, 2025, 11:39pm UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962 "2025-10-07T23:39:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![diadora77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diadora77/32/220469_2.png) [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Post date:** [October 7, 2025, 11:39pm UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962/1 "2025-10-07T23:39:16Z")

</div>

I ran into a situation that had me going in circle in that GeoStats `viz/plot` does not play well with PooledArray.PooledVector of anything(?). Situation was reading in a csv file into a dataframe then using GeoStats `viz` function. Below I pasted snippets of `Point` example followed by the plot error. I ran into same issue with PooledArray of `Quadrangles`. Primary question, is this expected? I can provide a MWE file and accompanying code if useful. My fix, for the record, is setting `pool=false` for `CSV.read` to avoid the creation of PooledArray.PooledVector altogether.

```julia-auto
julia> df.Rlatlon #<-- this did not play well with viz/plot
994-element PooledArrays.PooledVector{Meshes.Point{Meshes.𝔼{2}, CoordRefSystems.Cartesian2D{CoordRefSystems.NoDatum, Unitful.Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}}, UInt32, Vector{UInt32}}:
 Point(x: 40.47916666666667 m, y: -105.04166666666666 m)
 Point(x: 46.395833333333336 m, y: 8.958333333333332 m)
 Point(x: 37.145833333333336 m, y: -113.45833333333333 m)...

julia> df.latlon #<-- this plotted fine
994-element Vector{Meshes.Point{Meshes.𝔼{2}, CoordRefSystems.Cartesian2D{CoordRefSystems.NoDatum, Unitful.Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}}}:
 Point(x: 40.6875 m, y: -104.95833333333333 m)
 Point(x: 50.1875 m, y: 8.375 m)
 Point(x: 41.145833333333336 m, y: -96.20833333333333 m)...

 julia> plot(df.Rlatlon, color=df.SNR)
ERROR: StackOverflowError:
Stacktrace:
  [1] _stable_typeof
    @ ./operators.jl:929 [inlined]
  [2] Base.Fix2(f::typeof(isequal), x::Type)
    @ Base ./operators.jl:1140
  [3] isequal
    @ ./operators.jl:1155 [inlined]
  [4] allequal
    @ ./set.jl:650 [inlined]
  [5] Meshes.GeometrySet(geoms::PooledArrays.PooledVector{Meshes.Point{Meshes.𝔼{…}, CoordRefSystems.Cartesian2D{…}}, UInt32, Vector{UInt32}})
    @ Meshes ~/.julia/packages/Meshes/0ChqX/src/domains/sets.jl:29
  [6] Meshes.GeometrySet(geoms::PooledArrays.PooledVector{Meshes.Point{Meshes.𝔼{…}, CoordRefSystems.Cartesian2D{…}}, UInt32, Vector{UInt32}}) (repeats 74748 times)
    @ Meshes ~/.julia/packages/Meshes/0ChqX/src/domains/sets.jl:35
  [7] convert_arguments(::Type{Plot{Meshes.viz}}, geoms::PooledArrays.PooledVector{Meshes.Point{Meshes.𝔼{…}, CoordRefSystems.Cartesian2D{…}}, UInt32, Vector{UInt32}})
    @ MeshesMakieExt ~/.julia/packages/Meshes/0ChqX/ext/fallbacks.jl:22
  [8] conversion_pipeline(P::Type{…}, used_attrs::Tuple{}, args::Tuple{…}, kw_obs::Observable{…}, args_obs::Tuple{…}, user_attributes::Dict{…}, deregister::Vector{…}, recursion::Int64)
    @ Makie ~/.julia/packages/Makie/ux0Te/src/interfaces.jl:222
  [9] conversion_pipeline(P::Type{…}, used_attrs::Tuple{}, args::Tuple{…}, kw_obs::Observable{…}, args_obs::Tuple{…}, user_attributes::Dict{…}, deregister::Vector{…})
    @ Makie ~/.julia/packages/Makie/ux0Te/src/interfaces.jl:213
 [10] (Plot{Meshes.viz})(user_args::Tuple{PooledArrays.PooledVector{Meshes.Point{…}, UInt32, Vector{…}}}, user_attributes::Dict{Symbol, Any})
    @ Makie ~/.julia/packages/Makie/ux0Te/src/interfaces.jl:273
 [11] _create_plot(F::Function, attributes::Dict{Symbol, Any}, args::PooledArrays.PooledVector{Meshes.Point{…}, UInt32, Vector{…}})
    @ Makie ~/.julia/packages/Makie/ux0Te/src/figureplotting.jl:316
 [12] plot(args::PooledArrays.PooledVector{Meshes.Point{Meshes.𝔼{…}, CoordRefSystems.Cartesian2D{…}}, UInt32, Vector{UInt32}}; kw::@Kwargs{color::Vector{Int64}})
    @ MakieCore ~/.julia/packages/MakieCore/rZ9WV/src/recipes.jl:58
 [13] top-level scope
    @ REPL[25]:1
Some type information was truncated. Use `show(err)` to see complete types.

```

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 8, 2025, 12:03am UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962/2 "2025-10-08T00:03:58Z")

</div>

@diadora77 in theory the `viz` recipe (that gets called when you pass a vector of Meshes.jl geometries) supports any type of vector. The stacktrace in the error message indicates that the error is coming from the `GeometrySet` constructor with `PooledVector`.

What happens when you try to convert the pooled vector into a geometry set? Can you please try `GeometrySet(df.Rlatlon)`?

We are probably hitting this generic constructor for iterators:

> <https://github.com/JuliaGeometry/Meshes.jl/blob/eeedffaa2a380e3899713ff03e5c46eb2a18ba23/src/domains/sets.jl#L26-L36>

which creates the infinite loop and overflow.

---

<div class="post-metadata">

**Author:** ![diadora77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diadora77/32/220469_2.png) [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Post date:** [October 8, 2025, 1:47am UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962/3 "2025-10-08T01:47:52Z")

</div>

Looks like the same error…

```julia-auto
julia> plot(GeometrySet(df.Rlatlon), color= df.SNR)
ERROR: StackOverflowError:
Stacktrace:
 [1] _stable_typeof
   @ ./operators.jl:929 [inlined]
 [2] Base.Fix2(f::typeof(isequal), x::Type)
   @ Base ./operators.jl:1140
 [3] isequal
   @ ./operators.jl:1155 [inlined]
 [4] allequal
   @ ./set.jl:650 [inlined]
 [5] GeometrySet(geoms::PooledArrays.PooledVector{Meshes.Point{𝔼{2}, Cartesian2D{NoDatum, Quantity{…}}}, UInt32, Vector{UInt32}})
   @ Meshes ~/.julia/packages/Meshes/0ChqX/src/domains/sets.jl:29
 [6] GeometrySet(geoms::PooledArrays.PooledVector{Meshes.Point{𝔼{2}, Cartesian2D{NoDatum, Quantity{…}}}, UInt32, Vector{UInt32}}) (repeats 74760 times)
   @ Meshes ~/.julia/packages/Meshes/0ChqX/src/domains/sets.jl:35
 [7] top-level scope
   @ REPL[155]:1
Some type information was truncated. Use show(err) to see complete types.

```

In case you just wanted the `GeometrySet(df.Rlatlon)`

```julia-auto
julia> GeometrySet(df.Rlatlon)
ERROR: StackOverflowError:
Stacktrace:
 [1] _stable_typeof
   @ ./operators.jl:929 [inlined]
 [2] Base.Fix2(f::typeof(isequal), x::Type)
   @ Base ./operators.jl:1140
 [3] isequal
   @ ./operators.jl:1155 [inlined]
 [4] allequal
   @ ./set.jl:650 [inlined]
 [5] GeometrySet(geoms::PooledArrays.PooledVector{Meshes.Point{𝔼{2}, Cartesian2D{NoDatum, Quantity{…}}}, UInt32, Vector{UInt32}})
   @ Meshes ~/.julia/packages/Meshes/0ChqX/src/domains/sets.jl:29
 [6] GeometrySet(geoms::PooledArrays.PooledVector{Meshes.Point{𝔼{2}, Cartesian2D{NoDatum, Quantity{…}}}, UInt32, Vector{UInt32}}) (repeats 74760 times)
   @ Meshes ~/.julia/packages/Meshes/0ChqX/src/domains/sets.jl:35
 [7] top-level scope
   @ REPL[156]:1
Some type information was truncated. Use show(err) to see complete types.

```

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 8, 2025, 1:49am UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962/4 "2025-10-08T01:49:43Z")

</div>

Yes, the error is caused by the `GeometrySet` constructor. Could you please open an issue on GitHub with a MWE that doesn’t involve `viz` nor `plot`?

---

<div class="post-metadata">

**Author:** ![diadora77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diadora77/32/220469_2.png) [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Post date:** [October 8, 2025, 1:52am UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962/5 "2025-10-08T01:52:29Z")

</div>

Sure, I’ll get something posted tomorrow. Thanks for the sanity check.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 8, 2025, 6:20pm UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962/6 "2025-10-08T18:20:37Z")

</div>

Thank you @diadora77 for considering opening the issue.

---

<div class="post-metadata">

**Author:** ![diadora77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diadora77/32/220469_2.png) [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Post date:** [October 9, 2025, 12:03am UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962/7 "2025-10-09T00:03:44Z")

</div>

Done, [issue opened.](https://github.com/JuliaEarth/GeoStats.jl/issues/551)

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 9, 2025, 1:39pm UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962/8 "2025-10-09T13:39:26Z")

</div>

Issue fixed. Please update your environment after the following PR is merged by the robots:

> <https://github.com/JuliaRegistries/General/pull/140037>
>
> \- Registering package: Meshes
> \- Repository: https://github.com/JuliaGeometry/Mes…hes.jl
> \- Created by: @juliohm
> \- Version: v0.55.2
> \- Commit: d0bf78ded67a45056c170bfe8c5fcaf1836b4c76
> \- Reviewed by: @juliohm
> \- Reference: https://github.com/JuliaGeometry/Meshes.jl/commit/d0bf78ded67a45056c170bfe8c5fcaf1836b4c76#commitcomment-167569110
> \- Description: Computational geometry in Julia

---

<div class="post-metadata">

**Author:** ![diadora77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diadora77/32/220469_2.png) [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Post date:** [October 10, 2025, 12:11am UTC](https://discourse.julialang.org/t/pooledarray-pooledvector-causing-stackoverflowerror-in-geostats-when-using-viz-plot-expected/132962/9 "2025-10-10T00:11:44Z")

</div>

Thanks! It works… but I think I found another similar (but different) scenario when creating a `georef` from a dataframe. I’ll post it to github as an issue.
