Skip to content

GB.Meta() errors for Multi Geometries #63

Closed
@Sov-trotter

Description

@Sov-trotter

For Geometries like MultiPoint, MultiPolygon the following error occurs,

julia> using GeometryBasicsjulia> p1 = Point(3, 1)
2-element Point{2,Int64} with indices SOneTo(2):
3
1
julia> poi = meta(p1, city="Abuja", rainfall=1221.2)
2-element PointMeta{2,Int64,Point{2,Int64},(:city, :rainfall),Tuple{String,Float64}} with indices SOneTo(2):
3
1
julia> MultiPoint([p1])
1-element MultiPoint{2,Int64,Point{2,Int64},Array{Point{2,Int64},1}}:
[3, 1]
julia> meta(MultiPoint([p1]), city="Abuja", rainfall=1221.2)
ERROR: Metadata needs to be an array with the same length as data items. Found: String

also passing the metadata as a NamedTuple reproduces the error,

julia> using GeometryBasics; const GB = GeometryBasics
GeometryBasics

julia> tup = (featurecla = "Land", min_zoom = 0, scalerank = 0)
(featurecla = "Land", min_zoom = 0, scalerank = 0)

julia> polys = [Polygon(rand(Point{2, Float32}, 20)) for i in 1:10];

julia> multipoly = MultiPolygon(polys; tup...)  
ERROR: Metadata needs to be an array with the same length as data items. Found: String

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions