From 01fc84736fc67124a4edf332045c8a5216a520c8 Mon Sep 17 00:00:00 2001 From: Takuya Iwanaga Date: Wed, 12 Jul 2023 12:42:07 +1000 Subject: [PATCH] Support extraction of a set of features e.g., `fc[1]; fc[1:10]; fc[[1,20,30,40,50]]` --- src/geojson_types.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geojson_types.jl b/src/geojson_types.jl index bc45e3f..45413f5 100644 --- a/src/geojson_types.jl +++ b/src/geojson_types.jl @@ -265,7 +265,7 @@ Base.length(fc::AbstractFeatureCollection) = length(features(fc)) Base.lastindex(fc::AbstractFeatureCollection) = length(features(fc)) Base.IteratorSize(::Type{<:AbstractFeatureCollection}) = Base.HasLength() Base.size(fc::AbstractFeatureCollection) = size(features(fc)) -Base.getindex(fc::AbstractFeatureCollection, i::Int) = features(fc)[i] +Base.getindex(fc::AbstractFeatureCollection, i::Union{Int,UnitRange,Vector}) = features(fc)[i] Base.IndexStyle(::AbstractFeatureCollection) = IndexLinear() bbox(x::GeoJSONT) = getfield(x, :bbox)