JuliaGeo / GeoJSON.jl

Utilities for working with GeoJSON data in Julia
https://juliageo.org/GeoJSON.jl/stable/
MIT License
67 stars 10 forks source link

add firstindex support, x[begin] #78

Open visr opened 1 year ago

visr commented 1 year ago

This errors for all GeoJSON types that otherwise support getindex:

using GeoJSON
p = GeoJSON.read("""{"type":"Point","coordinates":[30,10]}""")
p[begin]  # MethodError: no method matching firstindex(::GeoJSON.Point{2, Float32})

x[end] does work so I guess that has a fine fallback. I assume this is a matter of Base.firstindex(...) = 1 for a few types.

https://docs.julialang.org/en/v1/manual/interfaces/#Indexing