Skip to content

Commit

Permalink
allow LineStringTrain in Polygon wrapper (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz authored May 11, 2023
1 parent cd04721 commit efc9d96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ for (geomtype, trait, childtype, child_trait, length_check, nesting) in (
(:LineString, :LineStringTrait, :Point, :PointTrait, >=(2), 1),
(:LinearRing, :LinearRingTrait, :Point, :PointTrait, >=(3), 1),
(:MultiPoint, :MultiPointTrait, :Point, :PointTrait, nothing, 1),
(:Polygon, :PolygonTrait, :LinearRing, :LinearRingTrait, nothing, 2),
(:Polygon, :PolygonTrait, :LinearRing, :AbstractCurveTrait, nothing, 2),
(:MultiLineString, :MultiLineStringTrait, :LineString, :LineStringTrait, nothing, 2),
(:MultiCurve, :MultiCurveTrait, :LineString, :AbstractCurveTrait, nothing, 2),
(:MultiPolygon, :MultiPolygonTrait, :Polygon, :PolygonTrait, nothing, 3),
Expand Down
4 changes: 4 additions & 0 deletions test/test_wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ polygon = GI.Polygon([linearring, linearring])
polygon_crs = GI.Polygon(polygon; crs=EPSG(4326))
@test parent(polygon_crs) === parent(polygon)
@test GI.crs(polygon_crs) === EPSG(4326)
# Make sure `linestring` is also ok in polygons
polygon = GI.Polygon([linestring, linestring])
@test GI.getgeom(polygon, 1) === linestring
@test collect(GI.getgeom(polygon)) == [linestring, linestring]

# MultiPoint
multipoint = GI.MultiPoint([(1, 2), (3, 4), (3, 2), (1, 4), (7, 8), (9, 10)])
Expand Down

0 comments on commit efc9d96

Please sign in to comment.